1 #include "org_ldk_impl_bindings.h"
2 #include <rust_types.h>
7 // Always run a, then assert it is true:
8 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
9 // Assert a is true or do nothing
10 #define CHECK(a) DO_ASSERT(a)
12 // Running a leak check across all the allocations and frees of the JDK is a mess,
13 // so instead we implement our own naive leak checker here, relying on the -wrap
14 // linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated
15 // and free'd in Rust or C across the generated bindings shared library.
19 static mtx_t allocation_mtx;
21 void __attribute__((constructor)) init_mtx() {
22 DO_ASSERT(mtx_init(&allocation_mtx, mtx_plain) == thrd_success);
26 typedef struct allocation {
27 struct allocation* next;
29 const char* struct_name;
33 static allocation* allocation_ll = NULL;
35 void* __real_malloc(size_t len);
36 void* __real_calloc(size_t nmemb, size_t len);
37 static void new_allocation(void* res, const char* struct_name) {
38 allocation* new_alloc = __real_malloc(sizeof(allocation));
40 new_alloc->struct_name = struct_name;
41 new_alloc->bt_len = backtrace(new_alloc->bt, BT_MAX);
42 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
43 new_alloc->next = allocation_ll;
44 allocation_ll = new_alloc;
45 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
47 static void* MALLOC(size_t len, const char* struct_name) {
48 void* res = __real_malloc(len);
49 new_allocation(res, struct_name);
52 void __real_free(void* ptr);
53 static void alloc_freed(void* ptr) {
55 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
56 allocation* it = allocation_ll;
57 while (it->ptr != ptr) {
58 p = it; it = it->next;
60 fprintf(stderr, "Tried to free unknown pointer %p at:\n", ptr);
62 int bt_len = backtrace(bt, BT_MAX);
63 backtrace_symbols_fd(bt, bt_len, STDERR_FILENO);
64 fprintf(stderr, "\n\n");
65 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
66 return; // addrsan should catch malloc-unknown and print more info than we have
69 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
70 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
71 DO_ASSERT(it->ptr == ptr);
74 static void FREE(void* ptr) {
75 if ((long)ptr < 1024) return; // Rust loves to create pointers to the NULL page for dummys
80 void* __wrap_malloc(size_t len) {
81 void* res = __real_malloc(len);
82 new_allocation(res, "malloc call");
85 void* __wrap_calloc(size_t nmemb, size_t len) {
86 void* res = __real_calloc(nmemb, len);
87 new_allocation(res, "calloc call");
90 void __wrap_free(void* ptr) {
91 if (ptr == NULL) return;
96 void* __real_realloc(void* ptr, size_t newlen);
97 void* __wrap_realloc(void* ptr, size_t len) {
98 if (ptr != NULL) alloc_freed(ptr);
99 void* res = __real_realloc(ptr, len);
100 new_allocation(res, "realloc call");
103 void __wrap_reallocarray(void* ptr, size_t new_sz) {
104 // Rust doesn't seem to use reallocarray currently
108 void __attribute__((destructor)) check_leaks() {
109 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
110 fprintf(stderr, "%s %p remains:\n", a->struct_name, a->ptr);
111 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
112 fprintf(stderr, "\n\n");
114 DO_ASSERT(allocation_ll == NULL);
116 static jclass arr_of_B_clz = NULL;
117 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass _b) {
118 arr_of_B_clz = (*env)->FindClass(env, "[B");
119 CHECK(arr_of_B_clz != NULL);
120 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
123 static jmethodID ordinal_meth = NULL;
124 static jmethodID slicedef_meth = NULL;
125 static jclass slicedef_cls = NULL;
126 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
127 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
128 CHECK(ordinal_meth != NULL);
129 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
130 CHECK(slicedef_meth != NULL);
131 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
132 CHECK(slicedef_cls != NULL);
135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
136 return *((bool*)ptr);
138 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
139 return *((long*)ptr);
141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
144 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * _env, jclass _b, jlong ptr, jlong len) {
145 jbyteArray ret_arr = (*_env)->NewByteArray(_env, len);
146 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, len, (unsigned char*)ptr);
149 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * _env, jclass _b, jlong slice_ptr) {
150 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
151 jbyteArray ret_arr = (*_env)->NewByteArray(_env, slice->datalen);
152 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, slice->datalen, slice->data);
155 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * _env, jclass _b, jbyteArray bytes) {
156 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
157 vec->datalen = (*_env)->GetArrayLength(_env, bytes);
158 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
159 (*_env)->GetByteArrayRegion (_env, bytes, 0, vec->datalen, vec->data);
162 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
163 LDKTransaction *txdata = (LDKTransaction*)ptr;
165 slice.data = txdata->data;
166 slice.datalen = txdata->datalen;
167 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (long)&slice);
169 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
170 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
171 txdata->datalen = (*env)->GetArrayLength(env, bytes);
172 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
173 txdata->data_is_owned = false;
174 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
178 LDKTransaction *tx = (LDKTransaction*)ptr;
179 tx->data_is_owned = true;
180 Transaction_free(*tx);
183 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
184 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
185 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
186 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
187 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
188 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
189 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
190 return (long)vec->datalen;
192 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * _env, jclass _b) {
193 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
194 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
195 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
196 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
197 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
198 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
204 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
205 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
206 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
207 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
209 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
210 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
211 case 0: return LDKAccessError_UnknownChain;
212 case 1: return LDKAccessError_UnknownTx;
216 static jclass LDKAccessError_class = NULL;
217 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
218 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
219 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv * env, jclass clz) {
220 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
221 CHECK(LDKAccessError_class != NULL);
222 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
223 CHECK(LDKAccessError_LDKAccessError_UnknownChain != NULL);
224 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
225 CHECK(LDKAccessError_LDKAccessError_UnknownTx != NULL);
227 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
229 case LDKAccessError_UnknownChain:
230 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
231 case LDKAccessError_UnknownTx:
232 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
237 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
238 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
239 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
240 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
244 static jclass LDKChannelMonitorUpdateErr_class = NULL;
245 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
246 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
247 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv * env, jclass clz) {
248 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
249 CHECK(LDKChannelMonitorUpdateErr_class != NULL);
250 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
251 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
252 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
253 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
255 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
257 case LDKChannelMonitorUpdateErr_TemporaryFailure:
258 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
259 case LDKChannelMonitorUpdateErr_PermanentFailure:
260 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
265 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
266 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
267 case 0: return LDKConfirmationTarget_Background;
268 case 1: return LDKConfirmationTarget_Normal;
269 case 2: return LDKConfirmationTarget_HighPriority;
273 static jclass LDKConfirmationTarget_class = NULL;
274 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
275 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
276 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
277 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv * env, jclass clz) {
278 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
279 CHECK(LDKConfirmationTarget_class != NULL);
280 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
281 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
282 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
283 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
284 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
285 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
287 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
289 case LDKConfirmationTarget_Background:
290 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
291 case LDKConfirmationTarget_Normal:
292 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
293 case LDKConfirmationTarget_HighPriority:
294 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
299 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
300 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
301 case 0: return LDKLevel_Off;
302 case 1: return LDKLevel_Error;
303 case 2: return LDKLevel_Warn;
304 case 3: return LDKLevel_Info;
305 case 4: return LDKLevel_Debug;
306 case 5: return LDKLevel_Trace;
310 static jclass LDKLevel_class = NULL;
311 static jfieldID LDKLevel_LDKLevel_Off = NULL;
312 static jfieldID LDKLevel_LDKLevel_Error = NULL;
313 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
314 static jfieldID LDKLevel_LDKLevel_Info = NULL;
315 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
316 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
317 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv * env, jclass clz) {
318 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
319 CHECK(LDKLevel_class != NULL);
320 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
321 CHECK(LDKLevel_LDKLevel_Off != NULL);
322 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
323 CHECK(LDKLevel_LDKLevel_Error != NULL);
324 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
325 CHECK(LDKLevel_LDKLevel_Warn != NULL);
326 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
327 CHECK(LDKLevel_LDKLevel_Info != NULL);
328 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
329 CHECK(LDKLevel_LDKLevel_Debug != NULL);
330 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
331 CHECK(LDKLevel_LDKLevel_Trace != NULL);
333 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
336 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
338 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
340 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
342 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
344 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
346 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
351 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
352 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
353 case 0: return LDKNetwork_Bitcoin;
354 case 1: return LDKNetwork_Testnet;
355 case 2: return LDKNetwork_Regtest;
359 static jclass LDKNetwork_class = NULL;
360 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
361 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
362 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
363 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv * env, jclass clz) {
364 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
365 CHECK(LDKNetwork_class != NULL);
366 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
367 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
368 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
369 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
370 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
371 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
373 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
375 case LDKNetwork_Bitcoin:
376 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
377 case LDKNetwork_Testnet:
378 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
379 case LDKNetwork_Regtest:
380 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
385 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
386 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
387 case 0: return LDKSecp256k1Error_IncorrectSignature;
388 case 1: return LDKSecp256k1Error_InvalidMessage;
389 case 2: return LDKSecp256k1Error_InvalidPublicKey;
390 case 3: return LDKSecp256k1Error_InvalidSignature;
391 case 4: return LDKSecp256k1Error_InvalidSecretKey;
392 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
393 case 6: return LDKSecp256k1Error_InvalidTweak;
394 case 7: return LDKSecp256k1Error_NotEnoughMemory;
395 case 8: return LDKSecp256k1Error_CallbackPanicked;
399 static jclass LDKSecp256k1Error_class = NULL;
400 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
401 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
402 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
403 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
404 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
405 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
406 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
407 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
408 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
409 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv * env, jclass clz) {
410 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
411 CHECK(LDKSecp256k1Error_class != NULL);
412 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
413 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
414 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
415 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
416 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
417 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
418 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
419 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
420 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
421 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
422 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
423 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
424 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
425 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
426 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
427 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
428 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
429 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
431 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
433 case LDKSecp256k1Error_IncorrectSignature:
434 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
435 case LDKSecp256k1Error_InvalidMessage:
436 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
437 case LDKSecp256k1Error_InvalidPublicKey:
438 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
439 case LDKSecp256k1Error_InvalidSignature:
440 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
441 case LDKSecp256k1Error_InvalidSecretKey:
442 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
443 case LDKSecp256k1Error_InvalidRecoveryId:
444 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
445 case LDKSecp256k1Error_InvalidTweak:
446 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
447 case LDKSecp256k1Error_NotEnoughMemory:
448 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
449 case LDKSecp256k1Error_CallbackPanicked:
450 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
455 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
456 LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr;
457 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1new(JNIEnv *env, jclass _b, jbyteArray elems){
460 LDKCVecTempl_u8 *ret = MALLOC(sizeof(LDKCVecTempl_u8), "LDKCVecTempl_u8");
461 ret->datalen = (*env)->GetArrayLength(env, elems);
462 if (ret->datalen == 0) {
465 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVecTempl_u8 Data");
466 jbyte *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
467 for (size_t i = 0; i < ret->datalen; i++) {
468 ret->data[i] = java_elems[i];
470 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
474 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
475 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
477 LDKTransaction b_ref;
478 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
479 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
480 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
481 b_ref.data_is_owned = false;
485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
486 LDKC2TupleTempl_usize__Transaction *tuple = (LDKC2TupleTempl_usize__Transaction*)ptr;
489 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
490 LDKC2TupleTempl_usize__Transaction *tuple = (LDKC2TupleTempl_usize__Transaction*)ptr;
491 LDKTransaction b_var = tuple->b;
492 jbyteArray b_arr = (*_env)->NewByteArray(_env, b_var.datalen);
493 (*_env)->SetByteArrayRegion(_env, b_arr, 0, b_var.datalen, b_var.data);
496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
497 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
499 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
500 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
501 CHECK(val->result_ok);
502 return *val->contents.result;
504 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
505 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
506 CHECK(!val->result_ok);
507 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(_env, (*val->contents.err));
510 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
511 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
513 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
514 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
515 CHECK(val->result_ok);
516 return *val->contents.result;
518 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
519 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
520 CHECK(!val->result_ok);
521 LDKMonitorUpdateError err_var = (*val->contents.err);
522 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
523 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
524 long err_ref = (long)err_var.inner & ~1;
527 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
528 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
530 a_conv.inner = (void*)(a & (~1));
531 a_conv.is_owned = (a & 1) || (a == 0);
532 if (a_conv.inner != NULL)
533 a_conv = OutPoint_clone(&a_conv);
536 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
537 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
538 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
543 LDKC2TupleTempl_OutPoint__CVec_u8Z *tuple = (LDKC2TupleTempl_OutPoint__CVec_u8Z*)ptr;
544 LDKOutPoint a_var = tuple->a;
545 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
546 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
547 long a_ref = (long)a_var.inner & ~1;
550 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
551 LDKC2TupleTempl_OutPoint__CVec_u8Z *tuple = (LDKC2TupleTempl_OutPoint__CVec_u8Z*)ptr;
552 LDKCVec_u8Z b_var = tuple->b;
553 jbyteArray b_arr = (*_env)->NewByteArray(_env, b_var.datalen);
554 (*_env)->SetByteArrayRegion(_env, b_arr, 0, b_var.datalen, b_var.data);
557 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
558 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
559 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
561 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
562 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
563 ret->datalen = (*env)->GetArrayLength(env, elems);
564 if (ret->datalen == 0) {
567 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
568 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
569 for (size_t i = 0; i < ret->datalen; i++) {
570 jlong arr_elem = java_elems[i];
571 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
572 FREE((void*)arr_elem);
573 ret->data[i] = arr_elem_conv;
575 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
579 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlongArray b) {
580 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
581 LDKThirtyTwoBytes a_ref;
582 CHECK((*_env)->GetArrayLength (_env, a) == 32);
583 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
585 LDKCVecTempl_TxOut b_constr;
586 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
587 if (b_constr.datalen > 0)
588 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVecTempl_TxOut Elements");
590 b_constr.data = NULL;
591 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
592 for (size_t h = 0; h < b_constr.datalen; h++) {
593 long arr_conv_7 = b_vals[h];
594 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
595 FREE((void*)arr_conv_7);
596 b_constr.data[h] = arr_conv_7_conv;
598 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
602 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1TxOutZZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
603 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *tuple = (LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
604 jbyteArray a_arr = (*_env)->NewByteArray(_env, 32);
605 (*_env)->SetByteArrayRegion(_env, a_arr, 0, 32, tuple->a.data);
608 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1TxOutZZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
609 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *tuple = (LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
610 LDKCVecTempl_TxOut b_var = tuple->b;
611 jlongArray b_arr = (*_env)->NewLongArray(_env, b_var.datalen);
612 jlong *b_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, b_arr, NULL);
613 for (size_t h = 0; h < b_var.datalen; h++) {
614 long arr_conv_7_ref = (long)&b_var.data[h];
615 b_arr_ptr[h] = arr_conv_7_ref;
617 (*_env)->ReleasePrimitiveArrayCritical(_env, b_arr, b_arr_ptr, 0);
620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
621 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
626 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
627 LDKC2TupleTempl_u64__u64 *tuple = (LDKC2TupleTempl_u64__u64*)ptr;
630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
631 LDKC2TupleTempl_u64__u64 *tuple = (LDKC2TupleTempl_u64__u64*)ptr;
634 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
635 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
636 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
638 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jbyteArray a, jobjectArray b) {
639 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
641 CHECK((*_env)->GetArrayLength (_env, a) == 64);
642 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
644 LDKCVecTempl_Signature b_constr;
645 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
646 if (b_constr.datalen > 0)
647 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVecTempl_Signature Elements");
649 b_constr.data = NULL;
650 for (size_t i = 0; i < b_constr.datalen; i++) {
651 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
652 LDKSignature arr_conv_8_ref;
653 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
654 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
655 b_constr.data[i] = arr_conv_8_ref;
660 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
661 LDKC2TupleTempl_Signature__CVecTempl_Signature *tuple = (LDKC2TupleTempl_Signature__CVecTempl_Signature*)ptr;
662 jbyteArray a_arr = (*_env)->NewByteArray(_env, 64);
663 (*_env)->SetByteArrayRegion(_env, a_arr, 0, 64, tuple->a.compact_form);
666 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
667 LDKC2TupleTempl_Signature__CVecTempl_Signature *tuple = (LDKC2TupleTempl_Signature__CVecTempl_Signature*)ptr;
668 LDKCVecTempl_Signature b_var = tuple->b;
669 jobjectArray b_arr = (*_env)->NewObjectArray(_env, b_var.datalen, arr_of_B_clz, NULL);
670 for (size_t i = 0; i < b_var.datalen; i++) {
671 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
672 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, b_var.data[i].compact_form);
673 (*_env)->SetObjectArrayElement(_env, b_arr, i, arr_conv_8_arr);
677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
678 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
680 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
681 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
682 CHECK(val->result_ok);
683 long res_ref = (long)&(*val->contents.result);
686 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
687 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
688 CHECK(!val->result_ok);
689 return *val->contents.err;
691 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
692 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
694 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
695 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
696 CHECK(val->result_ok);
697 jbyteArray res_arr = (*_env)->NewByteArray(_env, 64);
698 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 64, (*val->contents.result).compact_form);
701 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
702 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
703 CHECK(!val->result_ok);
704 return *val->contents.err;
706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
707 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
709 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
710 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
711 CHECK(val->result_ok);
712 LDKCVecTempl_Signature res_var = (*val->contents.result);
713 jobjectArray res_arr = (*_env)->NewObjectArray(_env, res_var.datalen, arr_of_B_clz, NULL);
714 for (size_t i = 0; i < res_var.datalen; i++) {
715 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
716 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
717 (*_env)->SetObjectArrayElement(_env, res_arr, i, arr_conv_8_arr);
721 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
722 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
723 CHECK(!val->result_ok);
724 return *val->contents.err;
726 static jclass LDKAPIError_APIMisuseError_class = NULL;
727 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
728 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
729 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
730 static jclass LDKAPIError_RouteError_class = NULL;
731 static jmethodID LDKAPIError_RouteError_meth = NULL;
732 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
733 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
734 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
735 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
737 LDKAPIError_APIMisuseError_class =
738 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
739 CHECK(LDKAPIError_APIMisuseError_class != NULL);
740 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
741 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
742 LDKAPIError_FeeRateTooHigh_class =
743 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
744 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
745 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
746 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
747 LDKAPIError_RouteError_class =
748 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
749 CHECK(LDKAPIError_RouteError_class != NULL);
750 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
751 CHECK(LDKAPIError_RouteError_meth != NULL);
752 LDKAPIError_ChannelUnavailable_class =
753 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
754 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
755 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
756 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
757 LDKAPIError_MonitorUpdateFailed_class =
758 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
759 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
760 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
761 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
763 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
764 LDKAPIError *obj = (LDKAPIError*)ptr;
766 case LDKAPIError_APIMisuseError: {
767 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
768 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
769 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
770 return (*_env)->NewObject(_env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
772 case LDKAPIError_FeeRateTooHigh: {
773 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
774 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
775 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
776 return (*_env)->NewObject(_env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
778 case LDKAPIError_RouteError: {
779 LDKStr err_str = obj->route_error.err;
780 char* err_buf = MALLOC(err_str.len + 1, "str conv buf");
781 memcpy(err_buf, err_str.chars, err_str.len);
782 err_buf[err_str.len] = 0;
783 jstring err_conv = (*_env)->NewStringUTF(_env, err_str.chars);
785 return (*_env)->NewObject(_env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
787 case LDKAPIError_ChannelUnavailable: {
788 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
789 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
790 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
791 return (*_env)->NewObject(_env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
793 case LDKAPIError_MonitorUpdateFailed: {
794 return (*_env)->NewObject(_env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
799 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
800 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
802 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
803 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
804 CHECK(val->result_ok);
805 return *val->contents.result;
807 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
808 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
809 CHECK(!val->result_ok);
810 long err_ref = (long)&(*val->contents.err);
813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
814 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
816 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
817 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
818 CHECK(val->result_ok);
819 return *val->contents.result;
821 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
822 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
823 CHECK(!val->result_ok);
824 LDKPaymentSendFailure err_var = (*val->contents.err);
825 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
826 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
827 long err_ref = (long)err_var.inner & ~1;
830 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *_env, jclass _b, jlong a, jlong b, jlong c) {
831 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
832 LDKChannelAnnouncement a_conv;
833 a_conv.inner = (void*)(a & (~1));
834 a_conv.is_owned = (a & 1) || (a == 0);
835 if (a_conv.inner != NULL)
836 a_conv = ChannelAnnouncement_clone(&a_conv);
838 LDKChannelUpdate b_conv;
839 b_conv.inner = (void*)(b & (~1));
840 b_conv.is_owned = (b & 1) || (b == 0);
841 if (b_conv.inner != NULL)
842 b_conv = ChannelUpdate_clone(&b_conv);
844 LDKChannelUpdate c_conv;
845 c_conv.inner = (void*)(c & (~1));
846 c_conv.is_owned = (c & 1) || (c == 0);
847 if (c_conv.inner != NULL)
848 c_conv = ChannelUpdate_clone(&c_conv);
852 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
853 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
854 LDKChannelAnnouncement a_var = tuple->a;
855 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
856 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
857 long a_ref = (long)a_var.inner & ~1;
860 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
861 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
862 LDKChannelUpdate b_var = tuple->b;
863 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
864 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
865 long b_ref = (long)b_var.inner & ~1;
868 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *_env, jclass _b, jlong ptr) {
869 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
870 LDKChannelUpdate c_var = tuple->c;
871 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
872 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
873 long c_ref = (long)c_var.inner & ~1;
876 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
877 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
879 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
880 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
881 CHECK(val->result_ok);
882 return *val->contents.result;
884 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
885 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
886 CHECK(!val->result_ok);
887 LDKPeerHandleError err_var = (*val->contents.err);
888 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
889 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
890 long err_ref = (long)err_var.inner & ~1;
893 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
894 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
895 LDKHTLCOutputInCommitment a_conv;
896 a_conv.inner = (void*)(a & (~1));
897 a_conv.is_owned = (a & 1) || (a == 0);
898 if (a_conv.inner != NULL)
899 a_conv = HTLCOutputInCommitment_clone(&a_conv);
902 CHECK((*_env)->GetArrayLength (_env, b) == 64);
903 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
907 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1HTLCOutputInCommitmentSignatureZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
908 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *tuple = (LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
909 LDKHTLCOutputInCommitment a_var = tuple->a;
910 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
911 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
912 long a_ref = (long)a_var.inner & ~1;
915 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1HTLCOutputInCommitmentSignatureZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
916 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *tuple = (LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
917 jbyteArray b_arr = (*_env)->NewByteArray(_env, 64);
918 (*_env)->SetByteArrayRegion(_env, b_arr, 0, 64, tuple->b.compact_form);
921 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
922 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
923 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
924 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
925 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
926 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
928 LDKSpendableOutputDescriptor_StaticOutput_class =
929 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
930 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
931 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
932 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
933 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
934 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
935 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
936 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
937 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
938 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
939 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
940 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
941 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
942 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
944 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
945 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
947 case LDKSpendableOutputDescriptor_StaticOutput: {
948 LDKOutPoint outpoint_var = obj->static_output.outpoint;
949 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
950 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
951 long outpoint_ref = (long)outpoint_var.inner & ~1;
952 long output_ref = (long)&obj->static_output.output;
953 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
955 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
956 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
957 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
958 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
959 long outpoint_ref = (long)outpoint_var.inner & ~1;
960 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
961 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
962 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
963 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
964 jbyteArray revocation_pubkey_arr = (*_env)->NewByteArray(_env, 33);
965 (*_env)->SetByteArrayRegion(_env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
966 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth, outpoint_ref, per_commitment_point_arr, obj->dynamic_output_p2wsh.to_self_delay, output_ref, key_derivation_params_ref, revocation_pubkey_arr);
968 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
969 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
970 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
971 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
972 long outpoint_ref = (long)outpoint_var.inner & ~1;
973 long output_ref = (long)&obj->static_output_counterparty_payment.output;
974 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
975 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
980 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
981 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
982 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
984 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
985 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
986 ret->datalen = (*env)->GetArrayLength(env, elems);
987 if (ret->datalen == 0) {
990 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
991 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
992 for (size_t i = 0; i < ret->datalen; i++) {
993 jlong arr_elem = java_elems[i];
994 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
995 FREE((void*)arr_elem);
996 ret->data[i] = arr_elem_conv;
998 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1002 static jclass LDKEvent_FundingGenerationReady_class = NULL;
1003 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
1004 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
1005 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
1006 static jclass LDKEvent_PaymentReceived_class = NULL;
1007 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
1008 static jclass LDKEvent_PaymentSent_class = NULL;
1009 static jmethodID LDKEvent_PaymentSent_meth = NULL;
1010 static jclass LDKEvent_PaymentFailed_class = NULL;
1011 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
1012 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
1013 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
1014 static jclass LDKEvent_SpendableOutputs_class = NULL;
1015 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
1016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
1017 LDKEvent_FundingGenerationReady_class =
1018 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
1019 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
1020 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
1021 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
1022 LDKEvent_FundingBroadcastSafe_class =
1023 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
1024 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
1025 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
1026 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
1027 LDKEvent_PaymentReceived_class =
1028 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
1029 CHECK(LDKEvent_PaymentReceived_class != NULL);
1030 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
1031 CHECK(LDKEvent_PaymentReceived_meth != NULL);
1032 LDKEvent_PaymentSent_class =
1033 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
1034 CHECK(LDKEvent_PaymentSent_class != NULL);
1035 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
1036 CHECK(LDKEvent_PaymentSent_meth != NULL);
1037 LDKEvent_PaymentFailed_class =
1038 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
1039 CHECK(LDKEvent_PaymentFailed_class != NULL);
1040 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
1041 CHECK(LDKEvent_PaymentFailed_meth != NULL);
1042 LDKEvent_PendingHTLCsForwardable_class =
1043 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
1044 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
1045 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
1046 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
1047 LDKEvent_SpendableOutputs_class =
1048 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
1049 CHECK(LDKEvent_SpendableOutputs_class != NULL);
1050 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
1051 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
1053 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1054 LDKEvent *obj = (LDKEvent*)ptr;
1056 case LDKEvent_FundingGenerationReady: {
1057 jbyteArray temporary_channel_id_arr = (*_env)->NewByteArray(_env, 32);
1058 (*_env)->SetByteArrayRegion(_env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
1059 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1060 jbyteArray output_script_arr = (*_env)->NewByteArray(_env, output_script_var.datalen);
1061 (*_env)->SetByteArrayRegion(_env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
1062 return (*_env)->NewObject(_env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, obj->funding_generation_ready.channel_value_satoshis, output_script_arr, obj->funding_generation_ready.user_channel_id);
1064 case LDKEvent_FundingBroadcastSafe: {
1065 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1066 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1067 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1068 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1069 return (*_env)->NewObject(_env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
1071 case LDKEvent_PaymentReceived: {
1072 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
1073 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
1074 jbyteArray payment_secret_arr = (*_env)->NewByteArray(_env, 32);
1075 (*_env)->SetByteArrayRegion(_env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
1076 return (*_env)->NewObject(_env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
1078 case LDKEvent_PaymentSent: {
1079 jbyteArray payment_preimage_arr = (*_env)->NewByteArray(_env, 32);
1080 (*_env)->SetByteArrayRegion(_env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
1081 return (*_env)->NewObject(_env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
1083 case LDKEvent_PaymentFailed: {
1084 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
1085 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
1086 return (*_env)->NewObject(_env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
1088 case LDKEvent_PendingHTLCsForwardable: {
1089 return (*_env)->NewObject(_env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
1091 case LDKEvent_SpendableOutputs: {
1092 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1093 jlongArray outputs_arr = (*_env)->NewLongArray(_env, outputs_var.datalen);
1094 jlong *outputs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, outputs_arr, NULL);
1095 for (size_t b = 0; b < outputs_var.datalen; b++) {
1096 long arr_conv_27_ref = (long)&outputs_var.data[b];
1097 outputs_arr_ptr[b] = arr_conv_27_ref;
1099 (*_env)->ReleasePrimitiveArrayCritical(_env, outputs_arr, outputs_arr_ptr, 0);
1100 return (*_env)->NewObject(_env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
1105 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1106 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1107 static jclass LDKErrorAction_IgnoreError_class = NULL;
1108 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1109 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1110 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
1112 LDKErrorAction_DisconnectPeer_class =
1113 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1114 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1115 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1116 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1117 LDKErrorAction_IgnoreError_class =
1118 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1119 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1120 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1121 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1122 LDKErrorAction_SendErrorMessage_class =
1123 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1124 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1125 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1126 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1128 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1129 LDKErrorAction *obj = (LDKErrorAction*)ptr;
1131 case LDKErrorAction_DisconnectPeer: {
1132 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1133 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1134 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1135 long msg_ref = (long)msg_var.inner & ~1;
1136 return (*_env)->NewObject(_env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1138 case LDKErrorAction_IgnoreError: {
1139 return (*_env)->NewObject(_env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1141 case LDKErrorAction_SendErrorMessage: {
1142 LDKErrorMessage msg_var = obj->send_error_message.msg;
1143 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1144 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1145 long msg_ref = (long)msg_var.inner & ~1;
1146 return (*_env)->NewObject(_env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1151 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1152 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1153 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1154 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1155 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1156 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
1158 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1159 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1160 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1161 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1162 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1163 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1164 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1165 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1166 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1167 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1168 LDKHTLCFailChannelUpdate_NodeFailure_class =
1169 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1170 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1171 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1172 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1174 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1175 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
1177 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1178 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1179 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1180 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1181 long msg_ref = (long)msg_var.inner & ~1;
1182 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1184 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1185 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1187 case LDKHTLCFailChannelUpdate_NodeFailure: {
1188 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1189 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1190 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1195 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1196 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1197 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1198 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1199 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1200 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1201 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1202 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1203 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1204 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1205 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1206 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1207 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1208 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1209 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1210 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1211 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1212 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1213 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1214 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1215 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1216 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1217 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1218 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1219 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1220 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1221 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1222 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1223 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1224 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1225 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1226 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1228 LDKMessageSendEvent_SendAcceptChannel_class =
1229 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1230 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1231 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1232 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1233 LDKMessageSendEvent_SendOpenChannel_class =
1234 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1235 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1236 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1237 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1238 LDKMessageSendEvent_SendFundingCreated_class =
1239 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1240 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1241 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1242 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1243 LDKMessageSendEvent_SendFundingSigned_class =
1244 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1245 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1246 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1247 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1248 LDKMessageSendEvent_SendFundingLocked_class =
1249 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1250 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1251 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1252 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1253 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1254 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1255 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1256 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1257 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1258 LDKMessageSendEvent_UpdateHTLCs_class =
1259 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1260 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1261 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1262 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1263 LDKMessageSendEvent_SendRevokeAndACK_class =
1264 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1265 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1266 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1267 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1268 LDKMessageSendEvent_SendClosingSigned_class =
1269 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1270 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1271 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1272 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1273 LDKMessageSendEvent_SendShutdown_class =
1274 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1275 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1276 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1277 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1278 LDKMessageSendEvent_SendChannelReestablish_class =
1279 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1280 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1281 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1282 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1283 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1284 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1285 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1286 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1287 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1288 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1289 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1290 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1291 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1292 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1293 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1294 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1295 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1296 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1297 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1298 LDKMessageSendEvent_HandleError_class =
1299 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1300 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1301 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1302 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1303 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1304 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1305 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1306 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1307 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1309 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1310 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1312 case LDKMessageSendEvent_SendAcceptChannel: {
1313 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1314 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1315 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1316 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1317 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1318 long msg_ref = (long)msg_var.inner & ~1;
1319 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1321 case LDKMessageSendEvent_SendOpenChannel: {
1322 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1323 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1324 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1325 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1326 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1327 long msg_ref = (long)msg_var.inner & ~1;
1328 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1330 case LDKMessageSendEvent_SendFundingCreated: {
1331 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1332 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1333 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1334 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1335 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1336 long msg_ref = (long)msg_var.inner & ~1;
1337 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1339 case LDKMessageSendEvent_SendFundingSigned: {
1340 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1341 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1342 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1343 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1344 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1345 long msg_ref = (long)msg_var.inner & ~1;
1346 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1348 case LDKMessageSendEvent_SendFundingLocked: {
1349 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1350 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1351 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1352 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1353 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1354 long msg_ref = (long)msg_var.inner & ~1;
1355 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1357 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1358 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1359 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1360 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1361 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1362 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1363 long msg_ref = (long)msg_var.inner & ~1;
1364 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1366 case LDKMessageSendEvent_UpdateHTLCs: {
1367 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1368 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1369 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1370 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1371 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1372 long updates_ref = (long)updates_var.inner & ~1;
1373 return (*_env)->NewObject(_env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1375 case LDKMessageSendEvent_SendRevokeAndACK: {
1376 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1377 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1378 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1379 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1380 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1381 long msg_ref = (long)msg_var.inner & ~1;
1382 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1384 case LDKMessageSendEvent_SendClosingSigned: {
1385 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1386 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1387 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1388 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1389 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1390 long msg_ref = (long)msg_var.inner & ~1;
1391 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1393 case LDKMessageSendEvent_SendShutdown: {
1394 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1395 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1396 LDKShutdown msg_var = obj->send_shutdown.msg;
1397 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1398 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1399 long msg_ref = (long)msg_var.inner & ~1;
1400 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1402 case LDKMessageSendEvent_SendChannelReestablish: {
1403 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1404 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1405 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1406 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1407 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1408 long msg_ref = (long)msg_var.inner & ~1;
1409 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1411 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1412 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1413 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1414 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1415 long msg_ref = (long)msg_var.inner & ~1;
1416 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1417 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1418 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1419 long update_msg_ref = (long)update_msg_var.inner & ~1;
1420 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1422 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1423 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1424 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1425 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1426 long msg_ref = (long)msg_var.inner & ~1;
1427 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1429 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1430 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1431 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1432 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1433 long msg_ref = (long)msg_var.inner & ~1;
1434 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1436 case LDKMessageSendEvent_HandleError: {
1437 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1438 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1439 long action_ref = (long)&obj->handle_error.action;
1440 return (*_env)->NewObject(_env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1442 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1443 long update_ref = (long)&obj->payment_failure_network_update.update;
1444 return (*_env)->NewObject(_env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1449 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1450 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1451 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1453 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1454 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1455 ret->datalen = (*env)->GetArrayLength(env, elems);
1456 if (ret->datalen == 0) {
1459 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1460 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1461 for (size_t i = 0; i < ret->datalen; i++) {
1462 jlong arr_elem = java_elems[i];
1463 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1464 FREE((void*)arr_elem);
1465 ret->data[i] = arr_elem_conv;
1467 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1471 typedef struct LDKMessageSendEventsProvider_JCalls {
1472 atomic_size_t refcnt;
1475 jmethodID get_and_clear_pending_msg_events_meth;
1476 } LDKMessageSendEventsProvider_JCalls;
1477 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1478 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1480 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1481 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1483 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1484 LDKCVec_MessageSendEventZ arg_constr;
1485 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
1486 if (arg_constr.datalen > 0)
1487 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
1489 arg_constr.data = NULL;
1490 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
1491 for (size_t s = 0; s < arg_constr.datalen; s++) {
1492 long arr_conv_18 = arg_vals[s];
1493 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
1494 FREE((void*)arr_conv_18);
1495 arg_constr.data[s] = arr_conv_18_conv;
1497 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
1500 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1501 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1502 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1504 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1505 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1509 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1510 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1511 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1512 return (void*) this_arg;
1514 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1515 jclass c = (*env)->GetObjectClass(env, o);
1517 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1518 atomic_init(&calls->refcnt, 1);
1519 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1520 calls->o = (*env)->NewWeakGlobalRef(env, o);
1521 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
1522 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
1524 LDKMessageSendEventsProvider ret = {
1525 .this_arg = (void*) calls,
1526 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1527 .free = LDKMessageSendEventsProvider_JCalls_free,
1531 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1532 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1533 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1534 return (long)res_ptr;
1536 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1537 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1541 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1542 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1543 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1544 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1545 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1546 for (size_t s = 0; s < ret_var.datalen; s++) {
1547 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
1548 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
1549 long arr_conv_18_ref = (long)arr_conv_18_copy;
1550 ret_arr_ptr[s] = arr_conv_18_ref;
1552 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1553 CVec_MessageSendEventZ_free(ret_var);
1557 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1558 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1559 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1561 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1562 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1563 ret->datalen = (*env)->GetArrayLength(env, elems);
1564 if (ret->datalen == 0) {
1567 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1568 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1569 for (size_t i = 0; i < ret->datalen; i++) {
1570 jlong arr_elem = java_elems[i];
1571 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1572 FREE((void*)arr_elem);
1573 ret->data[i] = arr_elem_conv;
1575 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1579 typedef struct LDKEventsProvider_JCalls {
1580 atomic_size_t refcnt;
1583 jmethodID get_and_clear_pending_events_meth;
1584 } LDKEventsProvider_JCalls;
1585 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1586 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1588 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1589 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1591 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_events_meth);
1592 LDKCVec_EventZ arg_constr;
1593 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
1594 if (arg_constr.datalen > 0)
1595 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
1597 arg_constr.data = NULL;
1598 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
1599 for (size_t h = 0; h < arg_constr.datalen; h++) {
1600 long arr_conv_7 = arg_vals[h];
1601 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
1602 FREE((void*)arr_conv_7);
1603 arg_constr.data[h] = arr_conv_7_conv;
1605 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
1608 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1609 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1610 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1612 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1613 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1617 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1618 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1619 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1620 return (void*) this_arg;
1622 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1623 jclass c = (*env)->GetObjectClass(env, o);
1625 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1626 atomic_init(&calls->refcnt, 1);
1627 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1628 calls->o = (*env)->NewWeakGlobalRef(env, o);
1629 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
1630 CHECK(calls->get_and_clear_pending_events_meth != NULL);
1632 LDKEventsProvider ret = {
1633 .this_arg = (void*) calls,
1634 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1635 .free = LDKEventsProvider_JCalls_free,
1639 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1640 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1641 *res_ptr = LDKEventsProvider_init(env, _a, o);
1642 return (long)res_ptr;
1644 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1645 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1649 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1650 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1651 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1652 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1653 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1654 for (size_t h = 0; h < ret_var.datalen; h++) {
1655 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
1656 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
1657 long arr_conv_7_ref = (long)arr_conv_7_copy;
1658 ret_arr_ptr[h] = arr_conv_7_ref;
1660 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1661 CVec_EventZ_free(ret_var);
1665 typedef struct LDKLogger_JCalls {
1666 atomic_size_t refcnt;
1671 void log_jcall(const void* this_arg, const char *record) {
1672 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1674 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1675 jstring record_conv = (*_env)->NewStringUTF(_env, record);
1676 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1678 return (*_env)->CallVoidMethod(_env, obj, j_calls->log_meth, record_conv);
1680 static void LDKLogger_JCalls_free(void* this_arg) {
1681 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1682 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1684 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1685 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1689 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1690 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1691 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1692 return (void*) this_arg;
1694 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1695 jclass c = (*env)->GetObjectClass(env, o);
1697 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1698 atomic_init(&calls->refcnt, 1);
1699 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1700 calls->o = (*env)->NewWeakGlobalRef(env, o);
1701 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1702 CHECK(calls->log_meth != NULL);
1705 .this_arg = (void*) calls,
1707 .free = LDKLogger_JCalls_free,
1711 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1712 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1713 *res_ptr = LDKLogger_init(env, _a, o);
1714 return (long)res_ptr;
1716 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1717 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1722 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1724 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1725 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1726 CHECK(val->result_ok);
1727 long res_ref = (long)&(*val->contents.result);
1730 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1731 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1732 CHECK(!val->result_ok);
1733 jclass err_conv = LDKAccessError_to_java(_env, (*val->contents.err));
1736 typedef struct LDKAccess_JCalls {
1737 atomic_size_t refcnt;
1740 jmethodID get_utxo_meth;
1742 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1743 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1745 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1746 jbyteArray genesis_hash_arr = (*_env)->NewByteArray(_env, 32);
1747 (*_env)->SetByteArrayRegion(_env, genesis_hash_arr, 0, 32, *genesis_hash);
1748 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1750 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1751 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)ret;
1755 static void LDKAccess_JCalls_free(void* this_arg) {
1756 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1757 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1759 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1760 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1764 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1765 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1766 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1767 return (void*) this_arg;
1769 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1770 jclass c = (*env)->GetObjectClass(env, o);
1772 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1773 atomic_init(&calls->refcnt, 1);
1774 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1775 calls->o = (*env)->NewWeakGlobalRef(env, o);
1776 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1777 CHECK(calls->get_utxo_meth != NULL);
1780 .this_arg = (void*) calls,
1781 .get_utxo = get_utxo_jcall,
1782 .free = LDKAccess_JCalls_free,
1786 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1787 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1788 *res_ptr = LDKAccess_init(env, _a, o);
1789 return (long)res_ptr;
1791 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1792 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1796 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray genesis_hash, jlong short_channel_id) {
1797 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1798 unsigned char genesis_hash_arr[32];
1799 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
1800 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1801 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1802 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1803 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1804 return (long)ret_conv;
1807 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1808 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1809 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1810 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1811 for (size_t i = 0; i < vec->datalen; i++) {
1812 CHECK((((long)vec->data[i].inner) & 1) == 0);
1813 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1815 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1818 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1819 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1820 ret->datalen = (*env)->GetArrayLength(env, elems);
1821 if (ret->datalen == 0) {
1824 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1825 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1826 for (size_t i = 0; i < ret->datalen; i++) {
1827 jlong arr_elem = java_elems[i];
1828 LDKHTLCOutputInCommitment arr_elem_conv;
1829 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1830 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1831 if (arr_elem_conv.inner != NULL)
1832 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1833 ret->data[i] = arr_elem_conv;
1835 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1839 typedef struct LDKChannelKeys_JCalls {
1840 atomic_size_t refcnt;
1843 jmethodID get_per_commitment_point_meth;
1844 jmethodID release_commitment_secret_meth;
1845 jmethodID key_derivation_params_meth;
1846 jmethodID sign_counterparty_commitment_meth;
1847 jmethodID sign_holder_commitment_meth;
1848 jmethodID sign_holder_commitment_htlc_transactions_meth;
1849 jmethodID sign_justice_transaction_meth;
1850 jmethodID sign_counterparty_htlc_transaction_meth;
1851 jmethodID sign_closing_transaction_meth;
1852 jmethodID sign_channel_announcement_meth;
1853 jmethodID on_accept_meth;
1854 } LDKChannelKeys_JCalls;
1855 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1856 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1858 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1859 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1861 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_per_commitment_point_meth, idx);
1862 LDKPublicKey arg_ref;
1863 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
1864 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
1867 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1868 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1870 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1871 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1873 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_commitment_secret_meth, idx);
1874 LDKThirtyTwoBytes arg_ref;
1875 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
1876 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
1879 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1880 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1882 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1883 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1885 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*_env)->CallLongMethod(_env, obj, j_calls->key_derivation_params_meth);
1886 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)ret;
1890 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, uint32_t feerate_per_kw, LDKTransaction commitment_tx, const LDKPreCalculatedTxCreationKeys *keys, LDKCVec_HTLCOutputInCommitmentZ htlcs) {
1891 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1893 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1894 LDKTransaction commitment_tx_var = commitment_tx;
1895 jbyteArray commitment_tx_arr = (*_env)->NewByteArray(_env, commitment_tx_var.datalen);
1896 (*_env)->SetByteArrayRegion(_env, commitment_tx_arr, 0, commitment_tx_var.datalen, commitment_tx_var.data);
1897 Transaction_free(commitment_tx_var);
1898 LDKPreCalculatedTxCreationKeys keys_var = *keys;
1899 if (keys->inner != NULL)
1900 keys_var = PreCalculatedTxCreationKeys_clone(keys);
1901 CHECK((((long)keys_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1902 CHECK((((long)&keys_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1903 long keys_ref = (long)keys_var.inner & ~1;
1904 LDKCVec_HTLCOutputInCommitmentZ htlcs_var = htlcs;
1905 jlongArray htlcs_arr = (*_env)->NewLongArray(_env, htlcs_var.datalen);
1906 jlong *htlcs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, htlcs_arr, NULL);
1907 for (size_t y = 0; y < htlcs_var.datalen; y++) {
1908 LDKHTLCOutputInCommitment arr_conv_24_var = htlcs_var.data[y];
1909 CHECK((((long)arr_conv_24_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1910 CHECK((((long)&arr_conv_24_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1911 long arr_conv_24_ref = (long)arr_conv_24_var.inner;
1912 if (arr_conv_24_var.is_owned) {
1913 arr_conv_24_ref |= 1;
1915 htlcs_arr_ptr[y] = arr_conv_24_ref;
1917 (*_env)->ReleasePrimitiveArrayCritical(_env, htlcs_arr, htlcs_arr_ptr, 0);
1918 FREE(htlcs_var.data);
1919 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1921 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_counterparty_commitment_meth, feerate_per_kw, commitment_tx_arr, keys_ref, htlcs_arr);
1922 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret;
1926 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1927 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1929 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1930 LDKHolderCommitmentTransaction holder_commitment_tx_var = *holder_commitment_tx;
1931 if (holder_commitment_tx->inner != NULL)
1932 holder_commitment_tx_var = HolderCommitmentTransaction_clone(holder_commitment_tx);
1933 CHECK((((long)holder_commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1934 CHECK((((long)&holder_commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1935 long holder_commitment_tx_ref = (long)holder_commitment_tx_var.inner & ~1;
1936 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1938 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx_ref);
1939 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1943 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1944 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1946 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1947 LDKHolderCommitmentTransaction holder_commitment_tx_var = *holder_commitment_tx;
1948 if (holder_commitment_tx->inner != NULL)
1949 holder_commitment_tx_var = HolderCommitmentTransaction_clone(holder_commitment_tx);
1950 CHECK((((long)holder_commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1951 CHECK((((long)&holder_commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1952 long holder_commitment_tx_ref = (long)holder_commitment_tx_var.inner & ~1;
1953 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1955 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx_ref);
1956 LDKCResult_CVec_SignatureZNoneZ ret_conv = *(LDKCResult_CVec_SignatureZNoneZ*)ret;
1960 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) {
1961 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1963 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1964 LDKTransaction justice_tx_var = justice_tx;
1965 jbyteArray justice_tx_arr = (*_env)->NewByteArray(_env, justice_tx_var.datalen);
1966 (*_env)->SetByteArrayRegion(_env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
1967 Transaction_free(justice_tx_var);
1968 jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32);
1969 (*_env)->SetByteArrayRegion(_env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1970 LDKHTLCOutputInCommitment htlc_var = *htlc;
1971 if (htlc->inner != NULL)
1972 htlc_var = HTLCOutputInCommitment_clone(htlc);
1973 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1974 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1975 long htlc_ref = (long)htlc_var.inner & ~1;
1976 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1978 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_justice_transaction_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
1979 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1983 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) {
1984 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1986 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1987 LDKTransaction htlc_tx_var = htlc_tx;
1988 jbyteArray htlc_tx_arr = (*_env)->NewByteArray(_env, htlc_tx_var.datalen);
1989 (*_env)->SetByteArrayRegion(_env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
1990 Transaction_free(htlc_tx_var);
1991 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
1992 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1993 LDKHTLCOutputInCommitment htlc_var = *htlc;
1994 if (htlc->inner != NULL)
1995 htlc_var = HTLCOutputInCommitment_clone(htlc);
1996 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1997 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1998 long htlc_ref = (long)htlc_var.inner & ~1;
1999 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2001 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
2002 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
2006 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
2007 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2009 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2010 LDKTransaction closing_tx_var = closing_tx;
2011 jbyteArray closing_tx_arr = (*_env)->NewByteArray(_env, closing_tx_var.datalen);
2012 (*_env)->SetByteArrayRegion(_env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2013 Transaction_free(closing_tx_var);
2014 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2016 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2017 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
2021 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
2022 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2024 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2025 LDKUnsignedChannelAnnouncement msg_var = *msg;
2026 if (msg->inner != NULL)
2027 msg_var = UnsignedChannelAnnouncement_clone(msg);
2028 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2029 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2030 long msg_ref = (long)msg_var.inner & ~1;
2031 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2033 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2034 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
2038 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
2039 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2041 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2042 LDKChannelPublicKeys channel_points_var = *channel_points;
2043 if (channel_points->inner != NULL)
2044 channel_points_var = ChannelPublicKeys_clone(channel_points);
2045 CHECK((((long)channel_points_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2046 CHECK((((long)&channel_points_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2047 long channel_points_ref = (long)channel_points_var.inner & ~1;
2048 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2050 return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, channel_points_ref, counterparty_selected_contest_delay, holder_selected_contest_delay);
2052 static void LDKChannelKeys_JCalls_free(void* this_arg) {
2053 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2054 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2056 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2057 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2061 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
2062 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2063 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2064 return (void*) this_arg;
2066 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
2067 jclass c = (*env)->GetObjectClass(env, o);
2069 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
2070 atomic_init(&calls->refcnt, 1);
2071 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2072 calls->o = (*env)->NewWeakGlobalRef(env, o);
2073 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2074 CHECK(calls->get_per_commitment_point_meth != NULL);
2075 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2076 CHECK(calls->release_commitment_secret_meth != NULL);
2077 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
2078 CHECK(calls->key_derivation_params_meth != NULL);
2079 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(I[BJ[J)J");
2080 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2081 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
2082 CHECK(calls->sign_holder_commitment_meth != NULL);
2083 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
2084 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
2085 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "([BJJ[BJ)J");
2086 CHECK(calls->sign_justice_transaction_meth != NULL);
2087 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2088 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2089 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2090 CHECK(calls->sign_closing_transaction_meth != NULL);
2091 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2092 CHECK(calls->sign_channel_announcement_meth != NULL);
2093 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
2094 CHECK(calls->on_accept_meth != NULL);
2096 LDKChannelPublicKeys pubkeys_conv;
2097 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2098 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2099 if (pubkeys_conv.inner != NULL)
2100 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2102 LDKChannelKeys ret = {
2103 .this_arg = (void*) calls,
2104 .get_per_commitment_point = get_per_commitment_point_jcall,
2105 .release_commitment_secret = release_commitment_secret_jcall,
2106 .key_derivation_params = key_derivation_params_jcall,
2107 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
2108 .sign_holder_commitment = sign_holder_commitment_jcall,
2109 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
2110 .sign_justice_transaction = sign_justice_transaction_jcall,
2111 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
2112 .sign_closing_transaction = sign_closing_transaction_jcall,
2113 .sign_channel_announcement = sign_channel_announcement_jcall,
2114 .on_accept = on_accept_jcall,
2115 .clone = LDKChannelKeys_JCalls_clone,
2116 .free = LDKChannelKeys_JCalls_free,
2117 .pubkeys = pubkeys_conv,
2118 .set_pubkeys = NULL,
2122 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
2123 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2124 *res_ptr = LDKChannelKeys_init(env, _a, o, pubkeys);
2125 return (long)res_ptr;
2127 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2128 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
2132 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2133 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2134 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2135 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2139 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2140 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2141 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2142 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2146 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
2147 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2148 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2149 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
2150 return (long)ret_ref;
2153 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jint feerate_per_kw, jbyteArray commitment_tx, jlong keys, jlongArray htlcs) {
2154 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2155 LDKTransaction commitment_tx_ref;
2156 commitment_tx_ref.datalen = (*_env)->GetArrayLength (_env, commitment_tx);
2157 commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
2158 (*_env)->GetByteArrayRegion(_env, commitment_tx, 0, commitment_tx_ref.datalen, commitment_tx_ref.data);
2159 commitment_tx_ref.data_is_owned = true;
2160 LDKPreCalculatedTxCreationKeys keys_conv;
2161 keys_conv.inner = (void*)(keys & (~1));
2162 keys_conv.is_owned = false;
2163 LDKCVec_HTLCOutputInCommitmentZ htlcs_constr;
2164 htlcs_constr.datalen = (*_env)->GetArrayLength (_env, htlcs);
2165 if (htlcs_constr.datalen > 0)
2166 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
2168 htlcs_constr.data = NULL;
2169 long* htlcs_vals = (*_env)->GetLongArrayElements (_env, htlcs, NULL);
2170 for (size_t y = 0; y < htlcs_constr.datalen; y++) {
2171 long arr_conv_24 = htlcs_vals[y];
2172 LDKHTLCOutputInCommitment arr_conv_24_conv;
2173 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
2174 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
2175 if (arr_conv_24_conv.inner != NULL)
2176 arr_conv_24_conv = HTLCOutputInCommitment_clone(&arr_conv_24_conv);
2177 htlcs_constr.data[y] = arr_conv_24_conv;
2179 (*_env)->ReleaseLongArrayElements (_env, htlcs, htlcs_vals, 0);
2180 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2181 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_ref, &keys_conv, htlcs_constr);
2182 return (long)ret_conv;
2185 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
2186 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2187 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2188 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2189 holder_commitment_tx_conv.is_owned = false;
2190 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2191 *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2192 return (long)ret_conv;
2195 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) {
2196 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2197 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2198 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2199 holder_commitment_tx_conv.is_owned = false;
2200 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
2201 *ret_conv = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2202 return (long)ret_conv;
2205 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1justice_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray justice_tx, jlong input, jlong amount, jbyteArray per_commitment_key, jlong htlc) {
2206 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2207 LDKTransaction justice_tx_ref;
2208 justice_tx_ref.datalen = (*_env)->GetArrayLength (_env, justice_tx);
2209 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2210 (*_env)->GetByteArrayRegion(_env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2211 justice_tx_ref.data_is_owned = true;
2212 unsigned char per_commitment_key_arr[32];
2213 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
2214 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
2215 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2216 LDKHTLCOutputInCommitment htlc_conv;
2217 htlc_conv.inner = (void*)(htlc & (~1));
2218 htlc_conv.is_owned = false;
2219 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2220 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
2221 return (long)ret_conv;
2224 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1htlc_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray htlc_tx, jlong input, jlong amount, jbyteArray per_commitment_point, jlong htlc) {
2225 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2226 LDKTransaction htlc_tx_ref;
2227 htlc_tx_ref.datalen = (*_env)->GetArrayLength (_env, htlc_tx);
2228 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2229 (*_env)->GetByteArrayRegion(_env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2230 htlc_tx_ref.data_is_owned = true;
2231 LDKPublicKey per_commitment_point_ref;
2232 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
2233 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2234 LDKHTLCOutputInCommitment htlc_conv;
2235 htlc_conv.inner = (void*)(htlc & (~1));
2236 htlc_conv.is_owned = false;
2237 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2238 *ret_conv = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, amount, per_commitment_point_ref, &htlc_conv);
2239 return (long)ret_conv;
2242 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray closing_tx) {
2243 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2244 LDKTransaction closing_tx_ref;
2245 closing_tx_ref.datalen = (*_env)->GetArrayLength (_env, closing_tx);
2246 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2247 (*_env)->GetByteArrayRegion(_env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2248 closing_tx_ref.data_is_owned = true;
2249 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2250 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2251 return (long)ret_conv;
2254 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
2255 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2256 LDKUnsignedChannelAnnouncement msg_conv;
2257 msg_conv.inner = (void*)(msg & (~1));
2258 msg_conv.is_owned = false;
2259 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2260 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2261 return (long)ret_conv;
2264 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) {
2265 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2266 LDKChannelPublicKeys channel_points_conv;
2267 channel_points_conv.inner = (void*)(channel_points & (~1));
2268 channel_points_conv.is_owned = false;
2269 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2272 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
2273 if (this_arg->set_pubkeys != NULL)
2274 this_arg->set_pubkeys(this_arg);
2275 return this_arg->pubkeys;
2277 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
2278 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2279 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
2280 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2281 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2282 long ret_ref = (long)ret_var.inner;
2283 if (ret_var.is_owned) {
2289 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2290 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2291 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2292 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2293 for (size_t i = 0; i < vec->datalen; i++) {
2294 CHECK((((long)vec->data[i].inner) & 1) == 0);
2295 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2297 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2300 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2301 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2302 ret->datalen = (*env)->GetArrayLength(env, elems);
2303 if (ret->datalen == 0) {
2306 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2307 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2308 for (size_t i = 0; i < ret->datalen; i++) {
2309 jlong arr_elem = java_elems[i];
2310 LDKMonitorEvent arr_elem_conv;
2311 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2312 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2313 if (arr_elem_conv.inner != NULL)
2314 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
2315 ret->data[i] = arr_elem_conv;
2317 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2321 typedef struct LDKWatch_JCalls {
2322 atomic_size_t refcnt;
2325 jmethodID watch_channel_meth;
2326 jmethodID update_channel_meth;
2327 jmethodID release_pending_monitor_events_meth;
2329 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
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 LDKChannelMonitor monitor_var = monitor;
2341 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2342 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2343 long monitor_ref = (long)monitor_var.inner;
2344 if (monitor_var.is_owned) {
2347 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2349 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2350 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2354 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
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 LDKOutPoint funding_txo_var = funding_txo;
2359 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2360 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2361 long funding_txo_ref = (long)funding_txo_var.inner;
2362 if (funding_txo_var.is_owned) {
2363 funding_txo_ref |= 1;
2365 LDKChannelMonitorUpdate update_var = update;
2366 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2367 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2368 long update_ref = (long)update_var.inner;
2369 if (update_var.is_owned) {
2372 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2374 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2375 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2379 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2380 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2382 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2383 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2385 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_pending_monitor_events_meth);
2386 LDKCVec_MonitorEventZ arg_constr;
2387 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
2388 if (arg_constr.datalen > 0)
2389 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2391 arg_constr.data = NULL;
2392 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
2393 for (size_t o = 0; o < arg_constr.datalen; o++) {
2394 long arr_conv_14 = arg_vals[o];
2395 LDKMonitorEvent arr_conv_14_conv;
2396 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2397 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2398 if (arr_conv_14_conv.inner != NULL)
2399 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2400 arg_constr.data[o] = arr_conv_14_conv;
2402 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
2405 static void LDKWatch_JCalls_free(void* this_arg) {
2406 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2407 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2409 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2410 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2414 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2415 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2416 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2417 return (void*) this_arg;
2419 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2420 jclass c = (*env)->GetObjectClass(env, o);
2422 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2423 atomic_init(&calls->refcnt, 1);
2424 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2425 calls->o = (*env)->NewWeakGlobalRef(env, o);
2426 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2427 CHECK(calls->watch_channel_meth != NULL);
2428 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2429 CHECK(calls->update_channel_meth != NULL);
2430 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2431 CHECK(calls->release_pending_monitor_events_meth != NULL);
2434 .this_arg = (void*) calls,
2435 .watch_channel = watch_channel_jcall,
2436 .update_channel = update_channel_jcall,
2437 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2438 .free = LDKWatch_JCalls_free,
2442 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2443 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2444 *res_ptr = LDKWatch_init(env, _a, o);
2445 return (long)res_ptr;
2447 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2448 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2453 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2454 LDKOutPoint funding_txo_conv;
2455 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2456 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2457 if (funding_txo_conv.inner != NULL)
2458 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2459 LDKChannelMonitor monitor_conv;
2460 monitor_conv.inner = (void*)(monitor & (~1));
2461 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2462 // Warning: we may need a move here but can't clone!
2463 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2464 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2465 return (long)ret_conv;
2468 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2469 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2470 LDKOutPoint funding_txo_conv;
2471 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2472 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2473 if (funding_txo_conv.inner != NULL)
2474 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2475 LDKChannelMonitorUpdate update_conv;
2476 update_conv.inner = (void*)(update & (~1));
2477 update_conv.is_owned = (update & 1) || (update == 0);
2478 if (update_conv.inner != NULL)
2479 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2480 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2481 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2482 return (long)ret_conv;
2485 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2486 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2487 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2488 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
2489 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
2490 for (size_t o = 0; o < ret_var.datalen; o++) {
2491 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2492 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2493 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2494 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2495 if (arr_conv_14_var.is_owned) {
2496 arr_conv_14_ref |= 1;
2498 ret_arr_ptr[o] = arr_conv_14_ref;
2500 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
2505 typedef struct LDKFilter_JCalls {
2506 atomic_size_t refcnt;
2509 jmethodID register_tx_meth;
2510 jmethodID register_output_meth;
2512 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2513 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2515 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2516 jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
2517 (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
2518 LDKu8slice script_pubkey_var = script_pubkey;
2519 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2520 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2521 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2523 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2525 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2526 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2528 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2529 LDKOutPoint outpoint_var = *outpoint;
2530 if (outpoint->inner != NULL)
2531 outpoint_var = OutPoint_clone(outpoint);
2532 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2533 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2534 long outpoint_ref = (long)outpoint_var.inner & ~1;
2535 LDKu8slice script_pubkey_var = script_pubkey;
2536 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2537 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2538 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2540 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
2542 static void LDKFilter_JCalls_free(void* this_arg) {
2543 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2544 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2546 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2547 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2551 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2552 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2553 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2554 return (void*) this_arg;
2556 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2557 jclass c = (*env)->GetObjectClass(env, o);
2559 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2560 atomic_init(&calls->refcnt, 1);
2561 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2562 calls->o = (*env)->NewWeakGlobalRef(env, o);
2563 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2564 CHECK(calls->register_tx_meth != NULL);
2565 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2566 CHECK(calls->register_output_meth != NULL);
2569 .this_arg = (void*) calls,
2570 .register_tx = register_tx_jcall,
2571 .register_output = register_output_jcall,
2572 .free = LDKFilter_JCalls_free,
2576 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2577 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2578 *res_ptr = LDKFilter_init(env, _a, o);
2579 return (long)res_ptr;
2581 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2582 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2587 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2588 unsigned char txid_arr[32];
2589 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2590 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2591 unsigned char (*txid_ref)[32] = &txid_arr;
2592 LDKu8slice script_pubkey_ref;
2593 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2594 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2595 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2596 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2600 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2601 LDKOutPoint outpoint_conv;
2602 outpoint_conv.inner = (void*)(outpoint & (~1));
2603 outpoint_conv.is_owned = false;
2604 LDKu8slice script_pubkey_ref;
2605 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2606 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2607 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2608 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2611 typedef struct LDKBroadcasterInterface_JCalls {
2612 atomic_size_t refcnt;
2615 jmethodID broadcast_transaction_meth;
2616 } LDKBroadcasterInterface_JCalls;
2617 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2618 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2620 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2621 LDKTransaction tx_var = tx;
2622 jbyteArray tx_arr = (*_env)->NewByteArray(_env, tx_var.datalen);
2623 (*_env)->SetByteArrayRegion(_env, tx_arr, 0, tx_var.datalen, tx_var.data);
2624 Transaction_free(tx_var);
2625 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2627 return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_arr);
2629 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2630 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2631 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2633 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2634 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2638 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2639 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2640 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2641 return (void*) this_arg;
2643 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2644 jclass c = (*env)->GetObjectClass(env, o);
2646 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2647 atomic_init(&calls->refcnt, 1);
2648 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2649 calls->o = (*env)->NewWeakGlobalRef(env, o);
2650 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
2651 CHECK(calls->broadcast_transaction_meth != NULL);
2653 LDKBroadcasterInterface ret = {
2654 .this_arg = (void*) calls,
2655 .broadcast_transaction = broadcast_transaction_jcall,
2656 .free = LDKBroadcasterInterface_JCalls_free,
2660 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2661 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2662 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2663 return (long)res_ptr;
2665 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2666 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray tx) {
2671 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2672 LDKTransaction tx_ref;
2673 tx_ref.datalen = (*_env)->GetArrayLength (_env, tx);
2674 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2675 (*_env)->GetByteArrayRegion(_env, tx, 0, tx_ref.datalen, tx_ref.data);
2676 tx_ref.data_is_owned = true;
2677 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2680 typedef struct LDKFeeEstimator_JCalls {
2681 atomic_size_t refcnt;
2684 jmethodID get_est_sat_per_1000_weight_meth;
2685 } LDKFeeEstimator_JCalls;
2686 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2687 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2689 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2690 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target);
2691 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2693 return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2695 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2696 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2697 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2699 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2700 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2704 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2705 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2706 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2707 return (void*) this_arg;
2709 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2710 jclass c = (*env)->GetObjectClass(env, o);
2712 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2713 atomic_init(&calls->refcnt, 1);
2714 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2715 calls->o = (*env)->NewWeakGlobalRef(env, o);
2716 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2717 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2719 LDKFeeEstimator ret = {
2720 .this_arg = (void*) calls,
2721 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2722 .free = LDKFeeEstimator_JCalls_free,
2726 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2727 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2728 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2729 return (long)res_ptr;
2731 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2732 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2736 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) {
2737 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2738 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2739 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2743 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2744 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2745 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2747 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2748 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2749 ret->datalen = (*env)->GetArrayLength(env, elems);
2750 if (ret->datalen == 0) {
2753 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2754 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2755 for (size_t i = 0; i < ret->datalen; i++) {
2756 jlong arr_elem = java_elems[i];
2757 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2758 FREE((void*)arr_elem);
2759 ret->data[i] = arr_elem_conv;
2761 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2765 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2766 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2767 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2769 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2770 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2771 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2773 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2774 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2775 ret->datalen = (*env)->GetArrayLength(env, elems);
2776 if (ret->datalen == 0) {
2779 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2780 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2781 for (size_t i = 0; i < ret->datalen; i++) {
2782 jlong arr_elem = java_elems[i];
2783 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2784 FREE((void*)arr_elem);
2785 ret->data[i] = arr_elem_conv;
2787 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2791 typedef struct LDKKeysInterface_JCalls {
2792 atomic_size_t refcnt;
2795 jmethodID get_node_secret_meth;
2796 jmethodID get_destination_script_meth;
2797 jmethodID get_shutdown_pubkey_meth;
2798 jmethodID get_channel_keys_meth;
2799 jmethodID get_secure_random_bytes_meth;
2800 } LDKKeysInterface_JCalls;
2801 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2802 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2804 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2805 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2807 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth);
2808 LDKSecretKey arg_ref;
2809 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2810 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
2813 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2814 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2816 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2817 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2819 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_destination_script_meth);
2820 LDKCVec_u8Z arg_ref;
2821 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
2822 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
2823 (*_env)->GetByteArrayRegion(_env, arg, 0, arg_ref.datalen, arg_ref.data);
2826 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2827 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2829 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2830 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2832 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_shutdown_pubkey_meth);
2833 LDKPublicKey arg_ref;
2834 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
2835 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
2838 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
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 LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2845 LDKChannelKeys ret_conv = *(LDKChannelKeys*)ret;
2846 if (ret_conv.free == LDKChannelKeys_JCalls_free) {
2847 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2848 LDKChannelKeys_JCalls_clone(ret_conv.this_arg);
2852 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2853 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2855 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2856 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2858 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth);
2859 LDKThirtyTwoBytes arg_ref;
2860 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2861 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
2864 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2865 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2866 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2868 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2869 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2873 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2874 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2875 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2876 return (void*) this_arg;
2878 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2879 jclass c = (*env)->GetObjectClass(env, o);
2881 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2882 atomic_init(&calls->refcnt, 1);
2883 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2884 calls->o = (*env)->NewWeakGlobalRef(env, o);
2885 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2886 CHECK(calls->get_node_secret_meth != NULL);
2887 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2888 CHECK(calls->get_destination_script_meth != NULL);
2889 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2890 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2891 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2892 CHECK(calls->get_channel_keys_meth != NULL);
2893 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2894 CHECK(calls->get_secure_random_bytes_meth != NULL);
2896 LDKKeysInterface ret = {
2897 .this_arg = (void*) calls,
2898 .get_node_secret = get_node_secret_jcall,
2899 .get_destination_script = get_destination_script_jcall,
2900 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2901 .get_channel_keys = get_channel_keys_jcall,
2902 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2903 .free = LDKKeysInterface_JCalls_free,
2907 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2908 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2909 *res_ptr = LDKKeysInterface_init(env, _a, o);
2910 return (long)res_ptr;
2912 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2913 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2917 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2918 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2919 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2920 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2924 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2925 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2926 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2927 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2928 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2929 CVec_u8Z_free(arg_var);
2933 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2934 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2935 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2936 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2940 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) {
2941 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2942 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2943 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2947 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2948 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2949 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2950 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2954 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2955 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2956 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2957 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2958 for (size_t i = 0; i < vec->datalen; i++) {
2959 CHECK((((long)vec->data[i].inner) & 1) == 0);
2960 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2962 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2965 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2966 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2967 ret->datalen = (*env)->GetArrayLength(env, elems);
2968 if (ret->datalen == 0) {
2971 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2972 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2973 for (size_t i = 0; i < ret->datalen; i++) {
2974 jlong arr_elem = java_elems[i];
2975 LDKChannelDetails arr_elem_conv;
2976 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2977 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2978 if (arr_elem_conv.inner != NULL)
2979 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2980 ret->data[i] = arr_elem_conv;
2982 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2986 static jclass LDKNetAddress_IPv4_class = NULL;
2987 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2988 static jclass LDKNetAddress_IPv6_class = NULL;
2989 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2990 static jclass LDKNetAddress_OnionV2_class = NULL;
2991 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2992 static jclass LDKNetAddress_OnionV3_class = NULL;
2993 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2995 LDKNetAddress_IPv4_class =
2996 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2997 CHECK(LDKNetAddress_IPv4_class != NULL);
2998 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2999 CHECK(LDKNetAddress_IPv4_meth != NULL);
3000 LDKNetAddress_IPv6_class =
3001 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3002 CHECK(LDKNetAddress_IPv6_class != NULL);
3003 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3004 CHECK(LDKNetAddress_IPv6_meth != NULL);
3005 LDKNetAddress_OnionV2_class =
3006 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3007 CHECK(LDKNetAddress_OnionV2_class != NULL);
3008 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3009 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3010 LDKNetAddress_OnionV3_class =
3011 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3012 CHECK(LDKNetAddress_OnionV3_class != NULL);
3013 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3014 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3016 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
3017 LDKNetAddress *obj = (LDKNetAddress*)ptr;
3019 case LDKNetAddress_IPv4: {
3020 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 4);
3021 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3022 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3024 case LDKNetAddress_IPv6: {
3025 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 16);
3026 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3027 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3029 case LDKNetAddress_OnionV2: {
3030 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 10);
3031 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3032 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3034 case LDKNetAddress_OnionV3: {
3035 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
3036 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3037 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);
3042 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3043 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
3044 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
3046 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
3047 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
3048 ret->datalen = (*env)->GetArrayLength(env, elems);
3049 if (ret->datalen == 0) {
3052 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
3053 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3054 for (size_t i = 0; i < ret->datalen; i++) {
3055 jlong arr_elem = java_elems[i];
3056 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
3057 FREE((void*)arr_elem);
3058 ret->data[i] = arr_elem_conv;
3060 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3064 typedef struct LDKChannelMessageHandler_JCalls {
3065 atomic_size_t refcnt;
3068 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
3069 jmethodID handle_open_channel_meth;
3070 jmethodID handle_accept_channel_meth;
3071 jmethodID handle_funding_created_meth;
3072 jmethodID handle_funding_signed_meth;
3073 jmethodID handle_funding_locked_meth;
3074 jmethodID handle_shutdown_meth;
3075 jmethodID handle_closing_signed_meth;
3076 jmethodID handle_update_add_htlc_meth;
3077 jmethodID handle_update_fulfill_htlc_meth;
3078 jmethodID handle_update_fail_htlc_meth;
3079 jmethodID handle_update_fail_malformed_htlc_meth;
3080 jmethodID handle_commitment_signed_meth;
3081 jmethodID handle_revoke_and_ack_meth;
3082 jmethodID handle_update_fee_meth;
3083 jmethodID handle_announcement_signatures_meth;
3084 jmethodID peer_disconnected_meth;
3085 jmethodID peer_connected_meth;
3086 jmethodID handle_channel_reestablish_meth;
3087 jmethodID handle_error_meth;
3088 } LDKChannelMessageHandler_JCalls;
3089 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
3090 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3092 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3093 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3094 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3095 LDKInitFeatures their_features_var = their_features;
3096 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3097 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3098 long their_features_ref = (long)their_features_var.inner;
3099 if (their_features_var.is_owned) {
3100 their_features_ref |= 1;
3102 LDKOpenChannel msg_var = *msg;
3103 if (msg->inner != NULL)
3104 msg_var = OpenChannel_clone(msg);
3105 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3106 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3107 long msg_ref = (long)msg_var.inner & ~1;
3108 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3110 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
3112 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
3113 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3115 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3116 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3117 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3118 LDKInitFeatures their_features_var = their_features;
3119 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3120 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3121 long their_features_ref = (long)their_features_var.inner;
3122 if (their_features_var.is_owned) {
3123 their_features_ref |= 1;
3125 LDKAcceptChannel msg_var = *msg;
3126 if (msg->inner != NULL)
3127 msg_var = AcceptChannel_clone(msg);
3128 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3129 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3130 long msg_ref = (long)msg_var.inner & ~1;
3131 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3133 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
3135 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
3136 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3138 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3139 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3140 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3141 LDKFundingCreated msg_var = *msg;
3142 if (msg->inner != NULL)
3143 msg_var = FundingCreated_clone(msg);
3144 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3145 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3146 long msg_ref = (long)msg_var.inner & ~1;
3147 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3149 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
3151 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
3152 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3154 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3155 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3156 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3157 LDKFundingSigned msg_var = *msg;
3158 if (msg->inner != NULL)
3159 msg_var = FundingSigned_clone(msg);
3160 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3161 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3162 long msg_ref = (long)msg_var.inner & ~1;
3163 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3165 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
3167 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
3168 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3170 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3171 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3172 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3173 LDKFundingLocked msg_var = *msg;
3174 if (msg->inner != NULL)
3175 msg_var = FundingLocked_clone(msg);
3176 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3177 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3178 long msg_ref = (long)msg_var.inner & ~1;
3179 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3181 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
3183 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
3184 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3186 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3187 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3188 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3189 LDKShutdown msg_var = *msg;
3190 if (msg->inner != NULL)
3191 msg_var = Shutdown_clone(msg);
3192 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3193 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3194 long msg_ref = (long)msg_var.inner & ~1;
3195 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3197 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
3199 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
3200 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3202 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3203 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3204 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3205 LDKClosingSigned msg_var = *msg;
3206 if (msg->inner != NULL)
3207 msg_var = ClosingSigned_clone(msg);
3208 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3209 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3210 long msg_ref = (long)msg_var.inner & ~1;
3211 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3213 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
3215 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
3216 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3218 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3219 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3220 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3221 LDKUpdateAddHTLC msg_var = *msg;
3222 if (msg->inner != NULL)
3223 msg_var = UpdateAddHTLC_clone(msg);
3224 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3225 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3226 long msg_ref = (long)msg_var.inner & ~1;
3227 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3229 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
3231 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
3232 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3234 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3235 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3236 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3237 LDKUpdateFulfillHTLC msg_var = *msg;
3238 if (msg->inner != NULL)
3239 msg_var = UpdateFulfillHTLC_clone(msg);
3240 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3241 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3242 long msg_ref = (long)msg_var.inner & ~1;
3243 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3245 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
3247 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
3248 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3250 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3251 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3252 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3253 LDKUpdateFailHTLC msg_var = *msg;
3254 if (msg->inner != NULL)
3255 msg_var = UpdateFailHTLC_clone(msg);
3256 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3257 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3258 long msg_ref = (long)msg_var.inner & ~1;
3259 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3261 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
3263 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
3264 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3266 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3267 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3268 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3269 LDKUpdateFailMalformedHTLC msg_var = *msg;
3270 if (msg->inner != NULL)
3271 msg_var = UpdateFailMalformedHTLC_clone(msg);
3272 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3273 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3274 long msg_ref = (long)msg_var.inner & ~1;
3275 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3277 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
3279 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
3280 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3282 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3283 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3284 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3285 LDKCommitmentSigned msg_var = *msg;
3286 if (msg->inner != NULL)
3287 msg_var = CommitmentSigned_clone(msg);
3288 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3289 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3290 long msg_ref = (long)msg_var.inner & ~1;
3291 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3293 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
3295 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
3296 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3298 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3299 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3300 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3301 LDKRevokeAndACK msg_var = *msg;
3302 if (msg->inner != NULL)
3303 msg_var = RevokeAndACK_clone(msg);
3304 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3305 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3306 long msg_ref = (long)msg_var.inner & ~1;
3307 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3309 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
3311 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
3312 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3314 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3315 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3316 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3317 LDKUpdateFee msg_var = *msg;
3318 if (msg->inner != NULL)
3319 msg_var = UpdateFee_clone(msg);
3320 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3321 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3322 long msg_ref = (long)msg_var.inner & ~1;
3323 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3325 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
3327 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
3328 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3330 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3331 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3332 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3333 LDKAnnouncementSignatures msg_var = *msg;
3334 if (msg->inner != NULL)
3335 msg_var = AnnouncementSignatures_clone(msg);
3336 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3337 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3338 long msg_ref = (long)msg_var.inner & ~1;
3339 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3341 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
3343 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3344 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3346 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3347 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3348 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3349 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3351 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
3353 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
3354 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3356 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3357 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3358 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3359 LDKInit msg_var = *msg;
3360 if (msg->inner != NULL)
3361 msg_var = Init_clone(msg);
3362 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3363 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3364 long msg_ref = (long)msg_var.inner & ~1;
3365 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3367 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
3369 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3370 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3372 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3373 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3374 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3375 LDKChannelReestablish msg_var = *msg;
3376 if (msg->inner != NULL)
3377 msg_var = ChannelReestablish_clone(msg);
3378 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3379 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3380 long msg_ref = (long)msg_var.inner & ~1;
3381 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3383 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
3385 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
3386 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3388 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3389 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3390 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3391 LDKErrorMessage msg_var = *msg;
3392 if (msg->inner != NULL)
3393 msg_var = ErrorMessage_clone(msg);
3394 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3395 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3396 long msg_ref = (long)msg_var.inner & ~1;
3397 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3399 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
3401 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3402 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3403 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3405 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3406 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3410 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3411 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3412 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3413 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3414 return (void*) this_arg;
3416 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3417 jclass c = (*env)->GetObjectClass(env, o);
3419 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3420 atomic_init(&calls->refcnt, 1);
3421 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3422 calls->o = (*env)->NewWeakGlobalRef(env, o);
3423 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3424 CHECK(calls->handle_open_channel_meth != NULL);
3425 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3426 CHECK(calls->handle_accept_channel_meth != NULL);
3427 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3428 CHECK(calls->handle_funding_created_meth != NULL);
3429 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3430 CHECK(calls->handle_funding_signed_meth != NULL);
3431 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3432 CHECK(calls->handle_funding_locked_meth != NULL);
3433 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3434 CHECK(calls->handle_shutdown_meth != NULL);
3435 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3436 CHECK(calls->handle_closing_signed_meth != NULL);
3437 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3438 CHECK(calls->handle_update_add_htlc_meth != NULL);
3439 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3440 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3441 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3442 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3443 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3444 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3445 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3446 CHECK(calls->handle_commitment_signed_meth != NULL);
3447 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3448 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3449 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3450 CHECK(calls->handle_update_fee_meth != NULL);
3451 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3452 CHECK(calls->handle_announcement_signatures_meth != NULL);
3453 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3454 CHECK(calls->peer_disconnected_meth != NULL);
3455 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3456 CHECK(calls->peer_connected_meth != NULL);
3457 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3458 CHECK(calls->handle_channel_reestablish_meth != NULL);
3459 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3460 CHECK(calls->handle_error_meth != NULL);
3462 LDKChannelMessageHandler ret = {
3463 .this_arg = (void*) calls,
3464 .handle_open_channel = handle_open_channel_jcall,
3465 .handle_accept_channel = handle_accept_channel_jcall,
3466 .handle_funding_created = handle_funding_created_jcall,
3467 .handle_funding_signed = handle_funding_signed_jcall,
3468 .handle_funding_locked = handle_funding_locked_jcall,
3469 .handle_shutdown = handle_shutdown_jcall,
3470 .handle_closing_signed = handle_closing_signed_jcall,
3471 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3472 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3473 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3474 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3475 .handle_commitment_signed = handle_commitment_signed_jcall,
3476 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3477 .handle_update_fee = handle_update_fee_jcall,
3478 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3479 .peer_disconnected = peer_disconnected_jcall,
3480 .peer_connected = peer_connected_jcall,
3481 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3482 .handle_error = handle_error_jcall,
3483 .free = LDKChannelMessageHandler_JCalls_free,
3484 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3486 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3489 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3490 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3491 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3492 return (long)res_ptr;
3494 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3495 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3499 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) {
3500 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3501 LDKPublicKey their_node_id_ref;
3502 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3503 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3504 LDKInitFeatures their_features_conv;
3505 their_features_conv.inner = (void*)(their_features & (~1));
3506 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3507 // Warning: we may need a move here but can't clone!
3508 LDKOpenChannel msg_conv;
3509 msg_conv.inner = (void*)(msg & (~1));
3510 msg_conv.is_owned = false;
3511 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3514 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) {
3515 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3516 LDKPublicKey their_node_id_ref;
3517 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3518 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3519 LDKInitFeatures their_features_conv;
3520 their_features_conv.inner = (void*)(their_features & (~1));
3521 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3522 // Warning: we may need a move here but can't clone!
3523 LDKAcceptChannel msg_conv;
3524 msg_conv.inner = (void*)(msg & (~1));
3525 msg_conv.is_owned = false;
3526 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3529 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) {
3530 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3531 LDKPublicKey their_node_id_ref;
3532 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3533 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3534 LDKFundingCreated msg_conv;
3535 msg_conv.inner = (void*)(msg & (~1));
3536 msg_conv.is_owned = false;
3537 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3540 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) {
3541 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3542 LDKPublicKey their_node_id_ref;
3543 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3544 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3545 LDKFundingSigned msg_conv;
3546 msg_conv.inner = (void*)(msg & (~1));
3547 msg_conv.is_owned = false;
3548 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3551 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) {
3552 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3553 LDKPublicKey their_node_id_ref;
3554 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3555 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3556 LDKFundingLocked msg_conv;
3557 msg_conv.inner = (void*)(msg & (~1));
3558 msg_conv.is_owned = false;
3559 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3563 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3564 LDKPublicKey their_node_id_ref;
3565 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3566 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3567 LDKShutdown msg_conv;
3568 msg_conv.inner = (void*)(msg & (~1));
3569 msg_conv.is_owned = false;
3570 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3573 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) {
3574 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3575 LDKPublicKey their_node_id_ref;
3576 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3577 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3578 LDKClosingSigned msg_conv;
3579 msg_conv.inner = (void*)(msg & (~1));
3580 msg_conv.is_owned = false;
3581 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3584 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) {
3585 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3586 LDKPublicKey their_node_id_ref;
3587 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3588 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3589 LDKUpdateAddHTLC msg_conv;
3590 msg_conv.inner = (void*)(msg & (~1));
3591 msg_conv.is_owned = false;
3592 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3595 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) {
3596 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3597 LDKPublicKey their_node_id_ref;
3598 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3599 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3600 LDKUpdateFulfillHTLC msg_conv;
3601 msg_conv.inner = (void*)(msg & (~1));
3602 msg_conv.is_owned = false;
3603 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3606 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) {
3607 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3608 LDKPublicKey their_node_id_ref;
3609 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3610 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3611 LDKUpdateFailHTLC msg_conv;
3612 msg_conv.inner = (void*)(msg & (~1));
3613 msg_conv.is_owned = false;
3614 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3617 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) {
3618 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3619 LDKPublicKey their_node_id_ref;
3620 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3621 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3622 LDKUpdateFailMalformedHTLC msg_conv;
3623 msg_conv.inner = (void*)(msg & (~1));
3624 msg_conv.is_owned = false;
3625 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3628 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) {
3629 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3630 LDKPublicKey their_node_id_ref;
3631 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3632 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3633 LDKCommitmentSigned msg_conv;
3634 msg_conv.inner = (void*)(msg & (~1));
3635 msg_conv.is_owned = false;
3636 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3639 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) {
3640 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3641 LDKPublicKey their_node_id_ref;
3642 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3643 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3644 LDKRevokeAndACK msg_conv;
3645 msg_conv.inner = (void*)(msg & (~1));
3646 msg_conv.is_owned = false;
3647 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3650 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) {
3651 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3652 LDKPublicKey their_node_id_ref;
3653 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3654 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3655 LDKUpdateFee msg_conv;
3656 msg_conv.inner = (void*)(msg & (~1));
3657 msg_conv.is_owned = false;
3658 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3661 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) {
3662 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3663 LDKPublicKey their_node_id_ref;
3664 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3665 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3666 LDKAnnouncementSignatures msg_conv;
3667 msg_conv.inner = (void*)(msg & (~1));
3668 msg_conv.is_owned = false;
3669 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3672 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) {
3673 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3674 LDKPublicKey their_node_id_ref;
3675 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3676 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3677 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3681 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3682 LDKPublicKey their_node_id_ref;
3683 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3684 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3686 msg_conv.inner = (void*)(msg & (~1));
3687 msg_conv.is_owned = false;
3688 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3691 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) {
3692 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3693 LDKPublicKey their_node_id_ref;
3694 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3695 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3696 LDKChannelReestablish msg_conv;
3697 msg_conv.inner = (void*)(msg & (~1));
3698 msg_conv.is_owned = false;
3699 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3703 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3704 LDKPublicKey their_node_id_ref;
3705 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3706 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3707 LDKErrorMessage msg_conv;
3708 msg_conv.inner = (void*)(msg & (~1));
3709 msg_conv.is_owned = false;
3710 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3713 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3714 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3715 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3716 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3717 for (size_t i = 0; i < vec->datalen; i++) {
3718 CHECK((((long)vec->data[i].inner) & 1) == 0);
3719 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3721 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3724 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3725 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3726 ret->datalen = (*env)->GetArrayLength(env, elems);
3727 if (ret->datalen == 0) {
3730 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3731 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3732 for (size_t i = 0; i < ret->datalen; i++) {
3733 jlong arr_elem = java_elems[i];
3734 LDKChannelMonitor arr_elem_conv;
3735 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3736 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3737 // Warning: we may need a move here but can't clone!
3738 ret->data[i] = arr_elem_conv;
3740 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3744 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3745 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3746 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3748 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3749 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3750 ret->datalen = (*env)->GetArrayLength(env, elems);
3751 if (ret->datalen == 0) {
3754 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3755 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3756 for (size_t i = 0; i < ret->datalen; i++) {
3757 ret->data[i] = java_elems[i];
3759 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3763 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3764 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3765 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3766 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3767 for (size_t i = 0; i < vec->datalen; i++) {
3768 CHECK((((long)vec->data[i].inner) & 1) == 0);
3769 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3771 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3774 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3775 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3776 ret->datalen = (*env)->GetArrayLength(env, elems);
3777 if (ret->datalen == 0) {
3780 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3781 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3782 for (size_t i = 0; i < ret->datalen; i++) {
3783 jlong arr_elem = java_elems[i];
3784 LDKUpdateAddHTLC arr_elem_conv;
3785 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3786 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3787 if (arr_elem_conv.inner != NULL)
3788 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3789 ret->data[i] = arr_elem_conv;
3791 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3795 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3796 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3797 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3798 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3799 for (size_t i = 0; i < vec->datalen; i++) {
3800 CHECK((((long)vec->data[i].inner) & 1) == 0);
3801 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3803 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3806 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3807 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3808 ret->datalen = (*env)->GetArrayLength(env, elems);
3809 if (ret->datalen == 0) {
3812 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3813 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3814 for (size_t i = 0; i < ret->datalen; i++) {
3815 jlong arr_elem = java_elems[i];
3816 LDKUpdateFulfillHTLC arr_elem_conv;
3817 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3818 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3819 if (arr_elem_conv.inner != NULL)
3820 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3821 ret->data[i] = arr_elem_conv;
3823 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3827 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3828 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3829 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3830 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3831 for (size_t i = 0; i < vec->datalen; i++) {
3832 CHECK((((long)vec->data[i].inner) & 1) == 0);
3833 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3835 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3838 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3839 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3840 ret->datalen = (*env)->GetArrayLength(env, elems);
3841 if (ret->datalen == 0) {
3844 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3845 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3846 for (size_t i = 0; i < ret->datalen; i++) {
3847 jlong arr_elem = java_elems[i];
3848 LDKUpdateFailHTLC arr_elem_conv;
3849 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3850 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3851 if (arr_elem_conv.inner != NULL)
3852 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3853 ret->data[i] = arr_elem_conv;
3855 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3859 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3860 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3861 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3862 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3863 for (size_t i = 0; i < vec->datalen; i++) {
3864 CHECK((((long)vec->data[i].inner) & 1) == 0);
3865 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3867 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3870 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3871 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3872 ret->datalen = (*env)->GetArrayLength(env, elems);
3873 if (ret->datalen == 0) {
3876 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3877 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3878 for (size_t i = 0; i < ret->datalen; i++) {
3879 jlong arr_elem = java_elems[i];
3880 LDKUpdateFailMalformedHTLC arr_elem_conv;
3881 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3882 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3883 if (arr_elem_conv.inner != NULL)
3884 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3885 ret->data[i] = arr_elem_conv;
3887 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3891 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3892 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3894 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3895 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3896 CHECK(val->result_ok);
3897 return *val->contents.result;
3899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3900 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3901 CHECK(!val->result_ok);
3902 LDKLightningError err_var = (*val->contents.err);
3903 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3904 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3905 long err_ref = (long)err_var.inner & ~1;
3908 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3909 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3910 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3912 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3913 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3914 ret->datalen = (*env)->GetArrayLength(env, elems);
3915 if (ret->datalen == 0) {
3918 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3919 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3920 for (size_t i = 0; i < ret->datalen; i++) {
3921 jlong arr_elem = java_elems[i];
3922 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3923 FREE((void*)arr_elem);
3924 ret->data[i] = arr_elem_conv;
3926 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3930 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3931 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3932 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3933 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3934 for (size_t i = 0; i < vec->datalen; i++) {
3935 CHECK((((long)vec->data[i].inner) & 1) == 0);
3936 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3938 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3941 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3942 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3943 ret->datalen = (*env)->GetArrayLength(env, elems);
3944 if (ret->datalen == 0) {
3947 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3948 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3949 for (size_t i = 0; i < ret->datalen; i++) {
3950 jlong arr_elem = java_elems[i];
3951 LDKNodeAnnouncement arr_elem_conv;
3952 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3953 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3954 if (arr_elem_conv.inner != NULL)
3955 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3956 ret->data[i] = arr_elem_conv;
3958 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3962 typedef struct LDKRoutingMessageHandler_JCalls {
3963 atomic_size_t refcnt;
3966 jmethodID handle_node_announcement_meth;
3967 jmethodID handle_channel_announcement_meth;
3968 jmethodID handle_channel_update_meth;
3969 jmethodID handle_htlc_fail_channel_update_meth;
3970 jmethodID get_next_channel_announcements_meth;
3971 jmethodID get_next_node_announcements_meth;
3972 jmethodID should_request_full_sync_meth;
3973 } LDKRoutingMessageHandler_JCalls;
3974 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3975 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3977 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3978 LDKNodeAnnouncement msg_var = *msg;
3979 if (msg->inner != NULL)
3980 msg_var = NodeAnnouncement_clone(msg);
3981 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3982 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3983 long msg_ref = (long)msg_var.inner & ~1;
3984 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3986 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, msg_ref);
3987 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
3991 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3992 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3994 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3995 LDKChannelAnnouncement msg_var = *msg;
3996 if (msg->inner != NULL)
3997 msg_var = ChannelAnnouncement_clone(msg);
3998 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3999 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4000 long msg_ref = (long)msg_var.inner & ~1;
4001 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4003 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
4004 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4008 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
4009 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4011 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4012 LDKChannelUpdate msg_var = *msg;
4013 if (msg->inner != NULL)
4014 msg_var = ChannelUpdate_clone(msg);
4015 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4016 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4017 long msg_ref = (long)msg_var.inner & ~1;
4018 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4020 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, msg_ref);
4021 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4025 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
4026 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4028 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4029 long ret_update = (long)update;
4030 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4032 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
4034 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
4035 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4037 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4038 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4040 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
4041 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4042 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4043 if (arg_constr.datalen > 0)
4044 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4046 arg_constr.data = NULL;
4047 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4048 for (size_t l = 0; l < arg_constr.datalen; l++) {
4049 long arr_conv_63 = arg_vals[l];
4050 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4051 FREE((void*)arr_conv_63);
4052 arg_constr.data[l] = arr_conv_63_conv;
4054 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4057 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
4058 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4060 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4061 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
4062 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
4063 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4065 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
4066 LDKCVec_NodeAnnouncementZ arg_constr;
4067 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4068 if (arg_constr.datalen > 0)
4069 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4071 arg_constr.data = NULL;
4072 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4073 for (size_t s = 0; s < arg_constr.datalen; s++) {
4074 long arr_conv_18 = arg_vals[s];
4075 LDKNodeAnnouncement arr_conv_18_conv;
4076 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4077 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4078 if (arr_conv_18_conv.inner != NULL)
4079 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
4080 arg_constr.data[s] = arr_conv_18_conv;
4082 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4085 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
4086 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4088 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4089 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
4090 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form);
4091 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4093 return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
4095 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4096 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4097 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4099 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4100 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4104 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
4105 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4106 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4107 return (void*) this_arg;
4109 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
4110 jclass c = (*env)->GetObjectClass(env, o);
4112 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
4113 atomic_init(&calls->refcnt, 1);
4114 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4115 calls->o = (*env)->NewWeakGlobalRef(env, o);
4116 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
4117 CHECK(calls->handle_node_announcement_meth != NULL);
4118 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
4119 CHECK(calls->handle_channel_announcement_meth != NULL);
4120 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
4121 CHECK(calls->handle_channel_update_meth != NULL);
4122 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
4123 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
4124 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
4125 CHECK(calls->get_next_channel_announcements_meth != NULL);
4126 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
4127 CHECK(calls->get_next_node_announcements_meth != NULL);
4128 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
4129 CHECK(calls->should_request_full_sync_meth != NULL);
4131 LDKRoutingMessageHandler ret = {
4132 .this_arg = (void*) calls,
4133 .handle_node_announcement = handle_node_announcement_jcall,
4134 .handle_channel_announcement = handle_channel_announcement_jcall,
4135 .handle_channel_update = handle_channel_update_jcall,
4136 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
4137 .get_next_channel_announcements = get_next_channel_announcements_jcall,
4138 .get_next_node_announcements = get_next_node_announcements_jcall,
4139 .should_request_full_sync = should_request_full_sync_jcall,
4140 .free = LDKRoutingMessageHandler_JCalls_free,
4144 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
4145 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
4146 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
4147 return (long)res_ptr;
4149 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4150 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
4154 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4155 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4156 LDKNodeAnnouncement msg_conv;
4157 msg_conv.inner = (void*)(msg & (~1));
4158 msg_conv.is_owned = false;
4159 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4160 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
4161 return (long)ret_conv;
4164 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4165 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4166 LDKChannelAnnouncement msg_conv;
4167 msg_conv.inner = (void*)(msg & (~1));
4168 msg_conv.is_owned = false;
4169 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4170 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4171 return (long)ret_conv;
4174 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4175 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4176 LDKChannelUpdate msg_conv;
4177 msg_conv.inner = (void*)(msg & (~1));
4178 msg_conv.is_owned = false;
4179 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4180 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
4181 return (long)ret_conv;
4184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
4185 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4186 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
4187 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
4190 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) {
4191 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4192 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
4193 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
4194 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
4195 for (size_t l = 0; l < ret_var.datalen; l++) {
4196 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4197 *arr_conv_63_ref = ret_var.data[l];
4198 ret_arr_ptr[l] = (long)arr_conv_63_ref;
4200 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4201 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(ret_var);
4205 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) {
4206 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4207 LDKPublicKey starting_point_ref;
4208 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
4209 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
4210 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
4211 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
4212 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
4213 for (size_t s = 0; s < ret_var.datalen; s++) {
4214 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
4215 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4216 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4217 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
4218 if (arr_conv_18_var.is_owned) {
4219 arr_conv_18_ref |= 1;
4221 ret_arr_ptr[s] = arr_conv_18_ref;
4223 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4228 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
4229 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4230 LDKPublicKey node_id_ref;
4231 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
4232 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
4233 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
4237 typedef struct LDKSocketDescriptor_JCalls {
4238 atomic_size_t refcnt;
4241 jmethodID send_data_meth;
4242 jmethodID disconnect_socket_meth;
4244 jmethodID hash_meth;
4245 } LDKSocketDescriptor_JCalls;
4246 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
4247 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4249 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4250 LDKu8slice data_var = data;
4251 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
4252 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
4253 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4255 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
4257 void disconnect_socket_jcall(void* this_arg) {
4258 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4260 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4261 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4263 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
4265 bool eq_jcall(const void* this_arg, const void *other_arg) {
4266 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4268 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4269 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4271 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, other_arg);
4273 uint64_t hash_jcall(const void* this_arg) {
4274 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4276 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4277 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4279 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
4281 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
4282 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4283 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4285 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4286 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4290 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
4291 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4292 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4293 return (void*) this_arg;
4295 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
4296 jclass c = (*env)->GetObjectClass(env, o);
4298 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
4299 atomic_init(&calls->refcnt, 1);
4300 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4301 calls->o = (*env)->NewWeakGlobalRef(env, o);
4302 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
4303 CHECK(calls->send_data_meth != NULL);
4304 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
4305 CHECK(calls->disconnect_socket_meth != NULL);
4306 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
4307 CHECK(calls->eq_meth != NULL);
4308 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
4309 CHECK(calls->hash_meth != NULL);
4311 LDKSocketDescriptor ret = {
4312 .this_arg = (void*) calls,
4313 .send_data = send_data_jcall,
4314 .disconnect_socket = disconnect_socket_jcall,
4317 .clone = LDKSocketDescriptor_JCalls_clone,
4318 .free = LDKSocketDescriptor_JCalls_free,
4322 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
4323 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4324 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
4325 return (long)res_ptr;
4327 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4328 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
4332 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
4333 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4334 LDKu8slice data_ref;
4335 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
4336 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
4337 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4338 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
4342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
4343 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4344 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4347 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
4348 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4349 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4353 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4354 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
4355 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
4357 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4358 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4360 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4361 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4362 CHECK(val->result_ok);
4363 LDKCVecTempl_u8 res_var = (*val->contents.result);
4364 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
4365 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
4368 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4369 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4370 CHECK(!val->result_ok);
4371 LDKPeerHandleError err_var = (*val->contents.err);
4372 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4373 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4374 long err_ref = (long)err_var.inner & ~1;
4377 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4378 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4381 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4382 CHECK(val->result_ok);
4383 return *val->contents.result;
4385 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4386 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4387 CHECK(!val->result_ok);
4388 LDKPeerHandleError err_var = (*val->contents.err);
4389 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4390 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4391 long err_ref = (long)err_var.inner & ~1;
4394 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4395 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
4397 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4398 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4399 CHECK(val->result_ok);
4400 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
4401 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
4404 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4405 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4406 CHECK(!val->result_ok);
4407 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4410 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4411 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
4413 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4414 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4415 CHECK(val->result_ok);
4416 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
4417 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
4420 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4421 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4422 CHECK(!val->result_ok);
4423 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4427 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
4429 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4430 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4431 CHECK(val->result_ok);
4432 LDKTxCreationKeys res_var = (*val->contents.result);
4433 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4434 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4435 long res_ref = (long)res_var.inner & ~1;
4438 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4439 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4440 CHECK(!val->result_ok);
4441 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4444 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4445 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4446 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4448 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4449 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4450 ret->datalen = (*env)->GetArrayLength(env, elems);
4451 if (ret->datalen == 0) {
4454 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4455 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4456 for (size_t i = 0; i < ret->datalen; i++) {
4457 jlong arr_elem = java_elems[i];
4458 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4459 FREE((void*)arr_elem);
4460 ret->data[i] = arr_elem_conv;
4462 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4466 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4467 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4468 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4469 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4470 for (size_t i = 0; i < vec->datalen; i++) {
4471 CHECK((((long)vec->data[i].inner) & 1) == 0);
4472 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4474 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4477 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4478 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4479 ret->datalen = (*env)->GetArrayLength(env, elems);
4480 if (ret->datalen == 0) {
4483 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4484 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4485 for (size_t i = 0; i < ret->datalen; i++) {
4486 jlong arr_elem = java_elems[i];
4487 LDKRouteHop arr_elem_conv;
4488 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4489 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4490 if (arr_elem_conv.inner != NULL)
4491 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4492 ret->data[i] = arr_elem_conv;
4494 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4498 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4499 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4500 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4502 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4503 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4505 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4506 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4507 CHECK(val->result_ok);
4508 LDKRoute res_var = (*val->contents.result);
4509 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4510 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4511 long res_ref = (long)res_var.inner & ~1;
4514 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4515 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4516 CHECK(!val->result_ok);
4517 LDKLightningError err_var = (*val->contents.err);
4518 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4519 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4520 long err_ref = (long)err_var.inner & ~1;
4523 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4524 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4525 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4526 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4527 for (size_t i = 0; i < vec->datalen; i++) {
4528 CHECK((((long)vec->data[i].inner) & 1) == 0);
4529 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4531 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4534 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4535 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4536 ret->datalen = (*env)->GetArrayLength(env, elems);
4537 if (ret->datalen == 0) {
4540 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4541 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4542 for (size_t i = 0; i < ret->datalen; i++) {
4543 jlong arr_elem = java_elems[i];
4544 LDKRouteHint arr_elem_conv;
4545 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4546 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4547 if (arr_elem_conv.inner != NULL)
4548 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4549 ret->data[i] = arr_elem_conv;
4551 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4556 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4558 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4562 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4564 C2Tuple_OutPointScriptZ_free(arg_conv);
4567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4568 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4570 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4574 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4576 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4580 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4582 C2Tuple_u64u64Z_free(arg_conv);
4585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4586 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4588 C2Tuple_usizeTransactionZ_free(arg_conv);
4591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4592 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4594 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4598 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4600 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4603 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4604 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4606 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4607 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4608 return (long)ret_conv;
4611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4612 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4614 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray arg) {
4618 LDKCVec_SignatureZ arg_constr;
4619 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4620 if (arg_constr.datalen > 0)
4621 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4623 arg_constr.data = NULL;
4624 for (size_t i = 0; i < arg_constr.datalen; i++) {
4625 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4626 LDKSignature arr_conv_8_ref;
4627 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4628 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4629 arg_constr.data[i] = arr_conv_8_ref;
4631 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4632 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(arg_constr);
4633 return (long)ret_conv;
4636 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4637 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4639 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4640 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4641 return (long)ret_conv;
4644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4645 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4647 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4651 LDKCVec_u8Z arg_ref;
4652 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4653 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
4654 (*_env)->GetByteArrayRegion(_env, arg, 0, arg_ref.datalen, arg_ref.data);
4655 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4656 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4657 return (long)ret_conv;
4660 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4661 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4663 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4664 *ret_conv = CResult_NoneAPIErrorZ_err(arg_conv);
4665 return (long)ret_conv;
4668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4669 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4671 CResult_NoneAPIErrorZ_free(arg_conv);
4674 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4675 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4677 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4678 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4679 return (long)ret_conv;
4682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4683 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4685 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4688 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4689 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4691 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4692 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4693 return (long)ret_conv;
4696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4697 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4699 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4702 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4703 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4705 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4706 *ret_conv = CResult_NonePaymentSendFailureZ_err(arg_conv);
4707 return (long)ret_conv;
4710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4711 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4713 CResult_NonePaymentSendFailureZ_free(arg_conv);
4716 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4717 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4719 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4720 *ret_conv = CResult_NonePeerHandleErrorZ_err(arg_conv);
4721 return (long)ret_conv;
4724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4725 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4727 CResult_NonePeerHandleErrorZ_free(arg_conv);
4730 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4731 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4733 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4734 *ret_conv = CResult_PublicKeySecpErrorZ_err(arg_conv);
4735 return (long)ret_conv;
4738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4739 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4741 CResult_PublicKeySecpErrorZ_free(arg_conv);
4744 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4745 LDKPublicKey arg_ref;
4746 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4747 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4748 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4749 *ret_conv = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4750 return (long)ret_conv;
4753 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4754 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4756 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4757 *ret_conv = CResult_RouteLightningErrorZ_err(arg_conv);
4758 return (long)ret_conv;
4761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4762 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4764 CResult_RouteLightningErrorZ_free(arg_conv);
4767 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4768 LDKRoute arg_conv = *(LDKRoute*)arg;
4770 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4771 *ret_conv = CResult_RouteLightningErrorZ_ok(arg_conv);
4772 return (long)ret_conv;
4775 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4776 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4778 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4779 *ret_conv = CResult_SecretKeySecpErrorZ_err(arg_conv);
4780 return (long)ret_conv;
4783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4784 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4786 CResult_SecretKeySecpErrorZ_free(arg_conv);
4789 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4790 LDKSecretKey arg_ref;
4791 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4792 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4793 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4794 *ret_conv = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4795 return (long)ret_conv;
4798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4799 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4801 CResult_SignatureNoneZ_free(arg_conv);
4804 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4805 LDKSignature arg_ref;
4806 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4807 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4808 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4809 *ret_conv = CResult_SignatureNoneZ_ok(arg_ref);
4810 return (long)ret_conv;
4813 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4814 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4816 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4817 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4818 return (long)ret_conv;
4821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4822 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4824 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4827 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4828 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4830 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4831 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4832 return (long)ret_conv;
4835 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4836 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4838 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4839 *ret_conv = CResult_TxOutAccessErrorZ_err(arg_conv);
4840 return (long)ret_conv;
4843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4844 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4846 CResult_TxOutAccessErrorZ_free(arg_conv);
4849 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4850 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4852 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4853 *ret_conv = CResult_TxOutAccessErrorZ_ok(arg_conv);
4854 return (long)ret_conv;
4857 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4858 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4860 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4861 *ret_conv = CResult_boolLightningErrorZ_err(arg_conv);
4862 return (long)ret_conv;
4865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4866 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4868 CResult_boolLightningErrorZ_free(arg_conv);
4871 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4872 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4873 *ret_conv = CResult_boolLightningErrorZ_ok(arg);
4874 return (long)ret_conv;
4877 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4878 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4880 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4881 *ret_conv = CResult_boolPeerHandleErrorZ_err(arg_conv);
4882 return (long)ret_conv;
4885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4886 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4888 CResult_boolPeerHandleErrorZ_free(arg_conv);
4891 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4892 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4893 *ret_conv = CResult_boolPeerHandleErrorZ_ok(arg);
4894 return (long)ret_conv;
4897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4898 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_constr;
4899 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4900 if (arg_constr.datalen > 0)
4901 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
4903 arg_constr.data = NULL;
4904 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4905 for (size_t q = 0; q < arg_constr.datalen; q++) {
4906 long arr_conv_42 = arg_vals[q];
4907 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
4908 FREE((void*)arr_conv_42);
4909 arg_constr.data[q] = arr_conv_42_conv;
4911 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4912 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_constr);
4915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4916 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_constr;
4917 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4918 if (arg_constr.datalen > 0)
4919 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ Elements");
4921 arg_constr.data = NULL;
4922 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4923 for (size_t b = 0; b < arg_constr.datalen; b++) {
4924 long arr_conv_27 = arg_vals[b];
4925 LDKC2Tuple_TxidCVec_TxOutZZ arr_conv_27_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arr_conv_27;
4926 FREE((void*)arr_conv_27);
4927 arg_constr.data[b] = arr_conv_27_conv;
4929 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4930 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_constr);
4933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4934 LDKCVec_C2Tuple_usizeTransactionZZ arg_constr;
4935 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4936 if (arg_constr.datalen > 0)
4937 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
4939 arg_constr.data = NULL;
4940 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4941 for (size_t y = 0; y < arg_constr.datalen; y++) {
4942 long arr_conv_24 = arg_vals[y];
4943 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
4944 FREE((void*)arr_conv_24);
4945 arg_constr.data[y] = arr_conv_24_conv;
4947 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4948 CVec_C2Tuple_usizeTransactionZZ_free(arg_constr);
4951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4952 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4953 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4954 if (arg_constr.datalen > 0)
4955 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4957 arg_constr.data = NULL;
4958 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4959 for (size_t l = 0; l < arg_constr.datalen; l++) {
4960 long arr_conv_63 = arg_vals[l];
4961 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4962 FREE((void*)arr_conv_63);
4963 arg_constr.data[l] = arr_conv_63_conv;
4965 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4966 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_constr);
4969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4970 LDKCVec_CVec_RouteHopZZ arg_constr;
4971 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4972 if (arg_constr.datalen > 0)
4973 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
4975 arg_constr.data = NULL;
4976 for (size_t m = 0; m < arg_constr.datalen; m++) {
4977 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, arg, m);
4978 LDKCVec_RouteHopZ arr_conv_12_constr;
4979 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
4980 if (arr_conv_12_constr.datalen > 0)
4981 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4983 arr_conv_12_constr.data = NULL;
4984 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
4985 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
4986 long arr_conv_10 = arr_conv_12_vals[k];
4987 LDKRouteHop arr_conv_10_conv;
4988 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4989 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4990 arr_conv_12_constr.data[k] = arr_conv_10_conv;
4992 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
4993 arg_constr.data[m] = arr_conv_12_constr;
4995 CVec_CVec_RouteHopZZ_free(arg_constr);
4998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4999 LDKCVec_ChannelDetailsZ arg_constr;
5000 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5001 if (arg_constr.datalen > 0)
5002 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
5004 arg_constr.data = NULL;
5005 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5006 for (size_t q = 0; q < arg_constr.datalen; q++) {
5007 long arr_conv_16 = arg_vals[q];
5008 LDKChannelDetails arr_conv_16_conv;
5009 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5010 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5011 arg_constr.data[q] = arr_conv_16_conv;
5013 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5014 CVec_ChannelDetailsZ_free(arg_constr);
5017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5018 LDKCVec_ChannelMonitorZ arg_constr;
5019 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5020 if (arg_constr.datalen > 0)
5021 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
5023 arg_constr.data = NULL;
5024 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5025 for (size_t q = 0; q < arg_constr.datalen; q++) {
5026 long arr_conv_16 = arg_vals[q];
5027 LDKChannelMonitor arr_conv_16_conv;
5028 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5029 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5030 arg_constr.data[q] = arr_conv_16_conv;
5032 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5033 CVec_ChannelMonitorZ_free(arg_constr);
5036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5037 LDKCVec_EventZ arg_constr;
5038 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5039 if (arg_constr.datalen > 0)
5040 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
5042 arg_constr.data = NULL;
5043 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5044 for (size_t h = 0; h < arg_constr.datalen; h++) {
5045 long arr_conv_7 = arg_vals[h];
5046 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
5047 FREE((void*)arr_conv_7);
5048 arg_constr.data[h] = arr_conv_7_conv;
5050 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5051 CVec_EventZ_free(arg_constr);
5054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5055 LDKCVec_HTLCOutputInCommitmentZ arg_constr;
5056 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5057 if (arg_constr.datalen > 0)
5058 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
5060 arg_constr.data = NULL;
5061 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5062 for (size_t y = 0; y < arg_constr.datalen; y++) {
5063 long arr_conv_24 = arg_vals[y];
5064 LDKHTLCOutputInCommitment arr_conv_24_conv;
5065 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
5066 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
5067 arg_constr.data[y] = arr_conv_24_conv;
5069 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5070 CVec_HTLCOutputInCommitmentZ_free(arg_constr);
5073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5074 LDKCVec_MessageSendEventZ arg_constr;
5075 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5076 if (arg_constr.datalen > 0)
5077 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5079 arg_constr.data = NULL;
5080 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5081 for (size_t s = 0; s < arg_constr.datalen; s++) {
5082 long arr_conv_18 = arg_vals[s];
5083 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
5084 FREE((void*)arr_conv_18);
5085 arg_constr.data[s] = arr_conv_18_conv;
5087 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5088 CVec_MessageSendEventZ_free(arg_constr);
5091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5092 LDKCVec_MonitorEventZ arg_constr;
5093 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5094 if (arg_constr.datalen > 0)
5095 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5097 arg_constr.data = NULL;
5098 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5099 for (size_t o = 0; o < arg_constr.datalen; o++) {
5100 long arr_conv_14 = arg_vals[o];
5101 LDKMonitorEvent arr_conv_14_conv;
5102 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
5103 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
5104 arg_constr.data[o] = arr_conv_14_conv;
5106 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5107 CVec_MonitorEventZ_free(arg_constr);
5110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5111 LDKCVec_NetAddressZ arg_constr;
5112 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5113 if (arg_constr.datalen > 0)
5114 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
5116 arg_constr.data = NULL;
5117 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5118 for (size_t m = 0; m < arg_constr.datalen; m++) {
5119 long arr_conv_12 = arg_vals[m];
5120 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
5121 FREE((void*)arr_conv_12);
5122 arg_constr.data[m] = arr_conv_12_conv;
5124 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5125 CVec_NetAddressZ_free(arg_constr);
5128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5129 LDKCVec_NodeAnnouncementZ arg_constr;
5130 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5131 if (arg_constr.datalen > 0)
5132 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5134 arg_constr.data = NULL;
5135 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5136 for (size_t s = 0; s < arg_constr.datalen; s++) {
5137 long arr_conv_18 = arg_vals[s];
5138 LDKNodeAnnouncement arr_conv_18_conv;
5139 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
5140 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
5141 arg_constr.data[s] = arr_conv_18_conv;
5143 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5144 CVec_NodeAnnouncementZ_free(arg_constr);
5147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5148 LDKCVec_PublicKeyZ arg_constr;
5149 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5150 if (arg_constr.datalen > 0)
5151 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
5153 arg_constr.data = NULL;
5154 for (size_t i = 0; i < arg_constr.datalen; i++) {
5155 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5156 LDKPublicKey arr_conv_8_ref;
5157 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
5158 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
5159 arg_constr.data[i] = arr_conv_8_ref;
5161 CVec_PublicKeyZ_free(arg_constr);
5164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5165 LDKCVec_RouteHintZ arg_constr;
5166 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5167 if (arg_constr.datalen > 0)
5168 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
5170 arg_constr.data = NULL;
5171 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5172 for (size_t l = 0; l < arg_constr.datalen; l++) {
5173 long arr_conv_11 = arg_vals[l];
5174 LDKRouteHint arr_conv_11_conv;
5175 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
5176 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
5177 arg_constr.data[l] = arr_conv_11_conv;
5179 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5180 CVec_RouteHintZ_free(arg_constr);
5183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5184 LDKCVec_RouteHopZ arg_constr;
5185 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5186 if (arg_constr.datalen > 0)
5187 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
5189 arg_constr.data = NULL;
5190 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5191 for (size_t k = 0; k < arg_constr.datalen; k++) {
5192 long arr_conv_10 = arg_vals[k];
5193 LDKRouteHop arr_conv_10_conv;
5194 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
5195 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
5196 arg_constr.data[k] = arr_conv_10_conv;
5198 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5199 CVec_RouteHopZ_free(arg_constr);
5202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5203 LDKCVec_SignatureZ arg_constr;
5204 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5205 if (arg_constr.datalen > 0)
5206 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5208 arg_constr.data = NULL;
5209 for (size_t i = 0; i < arg_constr.datalen; i++) {
5210 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5211 LDKSignature arr_conv_8_ref;
5212 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5213 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5214 arg_constr.data[i] = arr_conv_8_ref;
5216 CVec_SignatureZ_free(arg_constr);
5219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5220 LDKCVec_SpendableOutputDescriptorZ arg_constr;
5221 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5222 if (arg_constr.datalen > 0)
5223 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
5225 arg_constr.data = NULL;
5226 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5227 for (size_t b = 0; b < arg_constr.datalen; b++) {
5228 long arr_conv_27 = arg_vals[b];
5229 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
5230 FREE((void*)arr_conv_27);
5231 arg_constr.data[b] = arr_conv_27_conv;
5233 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5234 CVec_SpendableOutputDescriptorZ_free(arg_constr);
5237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5238 LDKCVec_TransactionZ arg_constr;
5239 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5240 if (arg_constr.datalen > 0)
5241 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5243 arg_constr.data = NULL;
5244 for (size_t i = 0; i < arg_constr.datalen; i++) {
5245 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5246 LDKTransaction arr_conv_8_ref;
5247 arr_conv_8_ref.datalen = (*_env)->GetArrayLength (_env, arr_conv_8);
5248 arr_conv_8_ref.data = MALLOC(arr_conv_8_ref.datalen, "LDKTransaction Bytes");
5249 (*_env)->GetByteArrayRegion(_env, arr_conv_8, 0, arr_conv_8_ref.datalen, arr_conv_8_ref.data);
5250 arr_conv_8_ref.data_is_owned = true;
5251 arg_constr.data[i] = arr_conv_8_ref;
5253 CVec_TransactionZ_free(arg_constr);
5256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5257 LDKCVec_TxOutZ arg_constr;
5258 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5259 if (arg_constr.datalen > 0)
5260 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5262 arg_constr.data = NULL;
5263 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5264 for (size_t h = 0; h < arg_constr.datalen; h++) {
5265 long arr_conv_7 = arg_vals[h];
5266 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5267 FREE((void*)arr_conv_7);
5268 arg_constr.data[h] = arr_conv_7_conv;
5270 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5271 CVec_TxOutZ_free(arg_constr);
5274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5275 LDKCVec_UpdateAddHTLCZ arg_constr;
5276 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5277 if (arg_constr.datalen > 0)
5278 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
5280 arg_constr.data = NULL;
5281 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5282 for (size_t p = 0; p < arg_constr.datalen; p++) {
5283 long arr_conv_15 = arg_vals[p];
5284 LDKUpdateAddHTLC arr_conv_15_conv;
5285 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
5286 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
5287 arg_constr.data[p] = arr_conv_15_conv;
5289 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5290 CVec_UpdateAddHTLCZ_free(arg_constr);
5293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5294 LDKCVec_UpdateFailHTLCZ arg_constr;
5295 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5296 if (arg_constr.datalen > 0)
5297 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
5299 arg_constr.data = NULL;
5300 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5301 for (size_t q = 0; q < arg_constr.datalen; q++) {
5302 long arr_conv_16 = arg_vals[q];
5303 LDKUpdateFailHTLC arr_conv_16_conv;
5304 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5305 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5306 arg_constr.data[q] = arr_conv_16_conv;
5308 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5309 CVec_UpdateFailHTLCZ_free(arg_constr);
5312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5313 LDKCVec_UpdateFailMalformedHTLCZ arg_constr;
5314 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5315 if (arg_constr.datalen > 0)
5316 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
5318 arg_constr.data = NULL;
5319 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5320 for (size_t z = 0; z < arg_constr.datalen; z++) {
5321 long arr_conv_25 = arg_vals[z];
5322 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
5323 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
5324 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
5325 arg_constr.data[z] = arr_conv_25_conv;
5327 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5328 CVec_UpdateFailMalformedHTLCZ_free(arg_constr);
5331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5332 LDKCVec_UpdateFulfillHTLCZ arg_constr;
5333 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5334 if (arg_constr.datalen > 0)
5335 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
5337 arg_constr.data = NULL;
5338 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5339 for (size_t t = 0; t < arg_constr.datalen; t++) {
5340 long arr_conv_19 = arg_vals[t];
5341 LDKUpdateFulfillHTLC arr_conv_19_conv;
5342 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5343 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5344 arg_constr.data[t] = arr_conv_19_conv;
5346 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5347 CVec_UpdateFulfillHTLCZ_free(arg_constr);
5350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5351 LDKCVec_u64Z arg_constr;
5352 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5353 if (arg_constr.datalen > 0)
5354 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
5356 arg_constr.data = NULL;
5357 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5358 for (size_t g = 0; g < arg_constr.datalen; g++) {
5359 long arr_conv_6 = arg_vals[g];
5360 arg_constr.data[g] = arr_conv_6;
5362 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5363 CVec_u64Z_free(arg_constr);
5366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
5367 LDKCVec_u8Z arg_ref;
5368 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
5369 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
5370 (*_env)->GetByteArrayRegion(_env, arg, 0, arg_ref.datalen, arg_ref.data);
5371 CVec_u8Z_free(arg_ref);
5374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jbyteArray _res) {
5375 LDKTransaction _res_ref;
5376 _res_ref.datalen = (*_env)->GetArrayLength (_env, _res);
5377 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5378 (*_env)->GetByteArrayRegion(_env, _res, 0, _res_ref.datalen, _res_ref.data);
5379 _res_ref.data_is_owned = true;
5380 Transaction_free(_res_ref);
5383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5384 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5386 TxOut_free(_res_conv);
5389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5390 LDKTransaction b_ref;
5391 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5392 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
5393 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
5394 b_ref.data_is_owned = true;
5395 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5396 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
5397 return (long)ret_ref;
5400 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5401 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5402 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
5403 return (long)ret_conv;
5406 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5407 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5408 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
5409 return (long)ret_conv;
5412 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5414 a_conv.inner = (void*)(a & (~1));
5415 a_conv.is_owned = (a & 1) || (a == 0);
5416 if (a_conv.inner != NULL)
5417 a_conv = OutPoint_clone(&a_conv);
5419 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5420 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
5421 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
5422 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5423 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5424 return (long)ret_ref;
5427 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5428 LDKThirtyTwoBytes a_ref;
5429 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5430 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5431 LDKCVec_TxOutZ b_constr;
5432 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5433 if (b_constr.datalen > 0)
5434 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5436 b_constr.data = NULL;
5437 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5438 for (size_t h = 0; h < b_constr.datalen; h++) {
5439 long arr_conv_7 = b_vals[h];
5440 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5441 FREE((void*)arr_conv_7);
5442 b_constr.data[h] = arr_conv_7_conv;
5444 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5445 LDKC2Tuple_TxidCVec_TxOutZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
5446 *ret_ref = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_constr);
5447 return (long)ret_ref;
5450 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5451 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5452 *ret_ref = C2Tuple_u64u64Z_new(a, b);
5453 return (long)ret_ref;
5456 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5458 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5459 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5460 LDKCVec_SignatureZ b_constr;
5461 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5462 if (b_constr.datalen > 0)
5463 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5465 b_constr.data = NULL;
5466 for (size_t i = 0; i < b_constr.datalen; i++) {
5467 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5468 LDKSignature arr_conv_8_ref;
5469 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5470 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5471 b_constr.data[i] = arr_conv_8_ref;
5473 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5474 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5475 return (long)ret_ref;
5478 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
5479 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5480 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5481 return (long)ret_conv;
5484 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
5485 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5486 *ret_conv = CResult_SignatureNoneZ_err();
5487 return (long)ret_conv;
5490 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
5491 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5492 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5493 return (long)ret_conv;
5496 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
5497 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5498 *ret_conv = CResult_NoneAPIErrorZ_ok();
5499 return (long)ret_conv;
5502 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
5503 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5504 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
5505 return (long)ret_conv;
5508 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
5509 LDKChannelAnnouncement a_conv;
5510 a_conv.inner = (void*)(a & (~1));
5511 a_conv.is_owned = (a & 1) || (a == 0);
5512 if (a_conv.inner != NULL)
5513 a_conv = ChannelAnnouncement_clone(&a_conv);
5514 LDKChannelUpdate b_conv;
5515 b_conv.inner = (void*)(b & (~1));
5516 b_conv.is_owned = (b & 1) || (b == 0);
5517 if (b_conv.inner != NULL)
5518 b_conv = ChannelUpdate_clone(&b_conv);
5519 LDKChannelUpdate c_conv;
5520 c_conv.inner = (void*)(c & (~1));
5521 c_conv.is_owned = (c & 1) || (c == 0);
5522 if (c_conv.inner != NULL)
5523 c_conv = ChannelUpdate_clone(&c_conv);
5524 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5525 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5526 return (long)ret_ref;
5529 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
5530 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5531 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5532 return (long)ret_conv;
5535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5536 LDKHTLCOutputInCommitment a_conv;
5537 a_conv.inner = (void*)(a & (~1));
5538 a_conv.is_owned = (a & 1) || (a == 0);
5539 if (a_conv.inner != NULL)
5540 a_conv = HTLCOutputInCommitment_clone(&a_conv);
5542 CHECK((*_env)->GetArrayLength (_env, b) == 64);
5543 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
5544 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
5545 *ret_ref = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
5546 return (long)ret_ref;
5549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5550 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
5551 FREE((void*)this_ptr);
5552 Event_free(this_ptr_conv);
5555 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5556 LDKEvent* orig_conv = (LDKEvent*)orig;
5557 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
5558 *ret_copy = Event_clone(orig_conv);
5559 long ret_ref = (long)ret_copy;
5563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5564 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
5565 FREE((void*)this_ptr);
5566 MessageSendEvent_free(this_ptr_conv);
5569 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5570 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
5571 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5572 *ret_copy = MessageSendEvent_clone(orig_conv);
5573 long ret_ref = (long)ret_copy;
5577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5578 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
5579 FREE((void*)this_ptr);
5580 MessageSendEventsProvider_free(this_ptr_conv);
5583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5584 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
5585 FREE((void*)this_ptr);
5586 EventsProvider_free(this_ptr_conv);
5589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5590 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
5591 FREE((void*)this_ptr);
5592 APIError_free(this_ptr_conv);
5595 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5596 LDKAPIError* orig_conv = (LDKAPIError*)orig;
5597 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5598 *ret_copy = APIError_clone(orig_conv);
5599 long ret_ref = (long)ret_copy;
5603 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5604 LDKLevel* orig_conv = (LDKLevel*)orig;
5605 jclass ret_conv = LDKLevel_to_java(_env, Level_clone(orig_conv));
5609 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
5610 jclass ret_conv = LDKLevel_to_java(_env, Level_max());
5614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5615 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
5616 FREE((void*)this_ptr);
5617 Logger_free(this_ptr_conv);
5620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5621 LDKChannelHandshakeConfig this_ptr_conv;
5622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5623 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5624 ChannelHandshakeConfig_free(this_ptr_conv);
5627 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5628 LDKChannelHandshakeConfig orig_conv;
5629 orig_conv.inner = (void*)(orig & (~1));
5630 orig_conv.is_owned = false;
5631 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
5632 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5633 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5634 long ret_ref = (long)ret_var.inner;
5635 if (ret_var.is_owned) {
5641 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5642 LDKChannelHandshakeConfig this_ptr_conv;
5643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5644 this_ptr_conv.is_owned = false;
5645 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
5649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5650 LDKChannelHandshakeConfig this_ptr_conv;
5651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5652 this_ptr_conv.is_owned = false;
5653 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
5656 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5657 LDKChannelHandshakeConfig this_ptr_conv;
5658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5659 this_ptr_conv.is_owned = false;
5660 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
5664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5665 LDKChannelHandshakeConfig this_ptr_conv;
5666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5667 this_ptr_conv.is_owned = false;
5668 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
5671 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5672 LDKChannelHandshakeConfig this_ptr_conv;
5673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5674 this_ptr_conv.is_owned = false;
5675 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
5679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5680 LDKChannelHandshakeConfig this_ptr_conv;
5681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5682 this_ptr_conv.is_owned = false;
5683 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
5686 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) {
5687 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
5688 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5689 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5690 long ret_ref = (long)ret_var.inner;
5691 if (ret_var.is_owned) {
5697 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
5698 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
5699 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5700 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5701 long ret_ref = (long)ret_var.inner;
5702 if (ret_var.is_owned) {
5708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5709 LDKChannelHandshakeLimits this_ptr_conv;
5710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5711 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5712 ChannelHandshakeLimits_free(this_ptr_conv);
5715 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5716 LDKChannelHandshakeLimits orig_conv;
5717 orig_conv.inner = (void*)(orig & (~1));
5718 orig_conv.is_owned = false;
5719 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
5720 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5721 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5722 long ret_ref = (long)ret_var.inner;
5723 if (ret_var.is_owned) {
5729 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5730 LDKChannelHandshakeLimits this_ptr_conv;
5731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5732 this_ptr_conv.is_owned = false;
5733 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
5737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5738 LDKChannelHandshakeLimits this_ptr_conv;
5739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5740 this_ptr_conv.is_owned = false;
5741 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
5744 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5745 LDKChannelHandshakeLimits this_ptr_conv;
5746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5747 this_ptr_conv.is_owned = false;
5748 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
5752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5753 LDKChannelHandshakeLimits this_ptr_conv;
5754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5755 this_ptr_conv.is_owned = false;
5756 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
5759 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5760 LDKChannelHandshakeLimits this_ptr_conv;
5761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5762 this_ptr_conv.is_owned = false;
5763 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
5767 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) {
5768 LDKChannelHandshakeLimits this_ptr_conv;
5769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5770 this_ptr_conv.is_owned = false;
5771 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
5774 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5775 LDKChannelHandshakeLimits this_ptr_conv;
5776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5777 this_ptr_conv.is_owned = false;
5778 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
5782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5783 LDKChannelHandshakeLimits this_ptr_conv;
5784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5785 this_ptr_conv.is_owned = false;
5786 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
5789 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
5790 LDKChannelHandshakeLimits this_ptr_conv;
5791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5792 this_ptr_conv.is_owned = false;
5793 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
5797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5798 LDKChannelHandshakeLimits this_ptr_conv;
5799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5800 this_ptr_conv.is_owned = false;
5801 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
5804 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5805 LDKChannelHandshakeLimits this_ptr_conv;
5806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5807 this_ptr_conv.is_owned = false;
5808 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
5812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5813 LDKChannelHandshakeLimits this_ptr_conv;
5814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5815 this_ptr_conv.is_owned = false;
5816 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
5819 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5820 LDKChannelHandshakeLimits this_ptr_conv;
5821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5822 this_ptr_conv.is_owned = false;
5823 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
5827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5828 LDKChannelHandshakeLimits this_ptr_conv;
5829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5830 this_ptr_conv.is_owned = false;
5831 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
5834 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5835 LDKChannelHandshakeLimits this_ptr_conv;
5836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5837 this_ptr_conv.is_owned = false;
5838 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
5842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5843 LDKChannelHandshakeLimits this_ptr_conv;
5844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5845 this_ptr_conv.is_owned = false;
5846 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
5850 LDKChannelHandshakeLimits this_ptr_conv;
5851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5852 this_ptr_conv.is_owned = false;
5853 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5858 LDKChannelHandshakeLimits this_ptr_conv;
5859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5860 this_ptr_conv.is_owned = false;
5861 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5864 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5865 LDKChannelHandshakeLimits this_ptr_conv;
5866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5867 this_ptr_conv.is_owned = false;
5868 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5873 LDKChannelHandshakeLimits this_ptr_conv;
5874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5875 this_ptr_conv.is_owned = false;
5876 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5879 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) {
5880 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);
5881 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5882 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5883 long ret_ref = (long)ret_var.inner;
5884 if (ret_var.is_owned) {
5890 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5891 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
5892 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5893 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5894 long ret_ref = (long)ret_var.inner;
5895 if (ret_var.is_owned) {
5901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5902 LDKChannelConfig this_ptr_conv;
5903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5905 ChannelConfig_free(this_ptr_conv);
5908 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5909 LDKChannelConfig orig_conv;
5910 orig_conv.inner = (void*)(orig & (~1));
5911 orig_conv.is_owned = false;
5912 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
5913 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5914 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5915 long ret_ref = (long)ret_var.inner;
5916 if (ret_var.is_owned) {
5922 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
5923 LDKChannelConfig this_ptr_conv;
5924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5925 this_ptr_conv.is_owned = false;
5926 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
5930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5931 LDKChannelConfig this_ptr_conv;
5932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5933 this_ptr_conv.is_owned = false;
5934 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
5937 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
5938 LDKChannelConfig this_ptr_conv;
5939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5940 this_ptr_conv.is_owned = false;
5941 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
5945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5946 LDKChannelConfig this_ptr_conv;
5947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5948 this_ptr_conv.is_owned = false;
5949 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5953 LDKChannelConfig this_ptr_conv;
5954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5955 this_ptr_conv.is_owned = false;
5956 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5961 LDKChannelConfig this_ptr_conv;
5962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5963 this_ptr_conv.is_owned = false;
5964 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5967 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) {
5968 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5969 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5970 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5971 long ret_ref = (long)ret_var.inner;
5972 if (ret_var.is_owned) {
5978 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
5979 LDKChannelConfig ret_var = ChannelConfig_default();
5980 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5981 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5982 long ret_ref = (long)ret_var.inner;
5983 if (ret_var.is_owned) {
5989 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
5990 LDKChannelConfig obj_conv;
5991 obj_conv.inner = (void*)(obj & (~1));
5992 obj_conv.is_owned = false;
5993 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
5994 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5995 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5996 CVec_u8Z_free(arg_var);
6000 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6002 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6003 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6004 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
6005 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6006 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6007 long ret_ref = (long)ret_var.inner;
6008 if (ret_var.is_owned) {
6011 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6016 LDKUserConfig this_ptr_conv;
6017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6018 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6019 UserConfig_free(this_ptr_conv);
6022 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6023 LDKUserConfig orig_conv;
6024 orig_conv.inner = (void*)(orig & (~1));
6025 orig_conv.is_owned = false;
6026 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
6027 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6028 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6029 long ret_ref = (long)ret_var.inner;
6030 if (ret_var.is_owned) {
6036 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
6037 LDKUserConfig this_ptr_conv;
6038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6039 this_ptr_conv.is_owned = false;
6040 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
6041 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6042 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6043 long ret_ref = (long)ret_var.inner;
6044 if (ret_var.is_owned) {
6050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6051 LDKUserConfig this_ptr_conv;
6052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6053 this_ptr_conv.is_owned = false;
6054 LDKChannelHandshakeConfig val_conv;
6055 val_conv.inner = (void*)(val & (~1));
6056 val_conv.is_owned = (val & 1) || (val == 0);
6057 if (val_conv.inner != NULL)
6058 val_conv = ChannelHandshakeConfig_clone(&val_conv);
6059 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
6062 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
6063 LDKUserConfig this_ptr_conv;
6064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6065 this_ptr_conv.is_owned = false;
6066 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
6067 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6068 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6069 long ret_ref = (long)ret_var.inner;
6070 if (ret_var.is_owned) {
6076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6077 LDKUserConfig this_ptr_conv;
6078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6079 this_ptr_conv.is_owned = false;
6080 LDKChannelHandshakeLimits val_conv;
6081 val_conv.inner = (void*)(val & (~1));
6082 val_conv.is_owned = (val & 1) || (val == 0);
6083 if (val_conv.inner != NULL)
6084 val_conv = ChannelHandshakeLimits_clone(&val_conv);
6085 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
6088 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
6089 LDKUserConfig this_ptr_conv;
6090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6091 this_ptr_conv.is_owned = false;
6092 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
6093 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6094 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6095 long ret_ref = (long)ret_var.inner;
6096 if (ret_var.is_owned) {
6102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6103 LDKUserConfig this_ptr_conv;
6104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6105 this_ptr_conv.is_owned = false;
6106 LDKChannelConfig val_conv;
6107 val_conv.inner = (void*)(val & (~1));
6108 val_conv.is_owned = (val & 1) || (val == 0);
6109 if (val_conv.inner != NULL)
6110 val_conv = ChannelConfig_clone(&val_conv);
6111 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
6114 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) {
6115 LDKChannelHandshakeConfig own_channel_config_arg_conv;
6116 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
6117 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
6118 if (own_channel_config_arg_conv.inner != NULL)
6119 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
6120 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
6121 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
6122 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
6123 if (peer_channel_config_limits_arg_conv.inner != NULL)
6124 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
6125 LDKChannelConfig channel_options_arg_conv;
6126 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
6127 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
6128 if (channel_options_arg_conv.inner != NULL)
6129 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
6130 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
6131 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6132 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6133 long ret_ref = (long)ret_var.inner;
6134 if (ret_var.is_owned) {
6140 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
6141 LDKUserConfig ret_var = UserConfig_default();
6142 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6143 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6144 long ret_ref = (long)ret_var.inner;
6145 if (ret_var.is_owned) {
6151 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6152 LDKAccessError* orig_conv = (LDKAccessError*)orig;
6153 jclass ret_conv = LDKAccessError_to_java(_env, AccessError_clone(orig_conv));
6157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6158 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
6159 FREE((void*)this_ptr);
6160 Access_free(this_ptr_conv);
6163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6164 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
6165 FREE((void*)this_ptr);
6166 Watch_free(this_ptr_conv);
6169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6170 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
6171 FREE((void*)this_ptr);
6172 Filter_free(this_ptr_conv);
6175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6176 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
6177 FREE((void*)this_ptr);
6178 BroadcasterInterface_free(this_ptr_conv);
6181 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6182 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
6183 jclass ret_conv = LDKConfirmationTarget_to_java(_env, ConfirmationTarget_clone(orig_conv));
6187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6188 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
6189 FREE((void*)this_ptr);
6190 FeeEstimator_free(this_ptr_conv);
6193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6194 LDKChainMonitor this_ptr_conv;
6195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6196 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6197 ChainMonitor_free(this_ptr_conv);
6200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
6201 LDKChainMonitor this_arg_conv;
6202 this_arg_conv.inner = (void*)(this_arg & (~1));
6203 this_arg_conv.is_owned = false;
6204 unsigned char header_arr[80];
6205 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6206 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6207 unsigned char (*header_ref)[80] = &header_arr;
6208 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6209 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6210 if (txdata_constr.datalen > 0)
6211 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6213 txdata_constr.data = NULL;
6214 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6215 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6216 long arr_conv_24 = txdata_vals[y];
6217 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
6218 FREE((void*)arr_conv_24);
6219 txdata_constr.data[y] = arr_conv_24_conv;
6221 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6222 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
6226 LDKChainMonitor this_arg_conv;
6227 this_arg_conv.inner = (void*)(this_arg & (~1));
6228 this_arg_conv.is_owned = false;
6229 unsigned char header_arr[80];
6230 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6231 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6232 unsigned char (*header_ref)[80] = &header_arr;
6233 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
6236 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
6237 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
6238 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6239 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6240 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6241 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6243 LDKLogger logger_conv = *(LDKLogger*)logger;
6244 if (logger_conv.free == LDKLogger_JCalls_free) {
6245 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6246 LDKLogger_JCalls_clone(logger_conv.this_arg);
6248 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
6249 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
6250 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6251 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
6253 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
6254 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6255 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6256 long ret_ref = (long)ret_var.inner;
6257 if (ret_var.is_owned) {
6263 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
6264 LDKChainMonitor this_arg_conv;
6265 this_arg_conv.inner = (void*)(this_arg & (~1));
6266 this_arg_conv.is_owned = false;
6267 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
6268 *ret = ChainMonitor_as_Watch(&this_arg_conv);
6272 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6273 LDKChainMonitor this_arg_conv;
6274 this_arg_conv.inner = (void*)(this_arg & (~1));
6275 this_arg_conv.is_owned = false;
6276 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6277 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
6281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6282 LDKChannelMonitorUpdate this_ptr_conv;
6283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6284 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6285 ChannelMonitorUpdate_free(this_ptr_conv);
6288 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6289 LDKChannelMonitorUpdate orig_conv;
6290 orig_conv.inner = (void*)(orig & (~1));
6291 orig_conv.is_owned = false;
6292 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
6293 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6294 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6295 long ret_ref = (long)ret_var.inner;
6296 if (ret_var.is_owned) {
6302 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6303 LDKChannelMonitorUpdate this_ptr_conv;
6304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6305 this_ptr_conv.is_owned = false;
6306 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
6310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6311 LDKChannelMonitorUpdate this_ptr_conv;
6312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6313 this_ptr_conv.is_owned = false;
6314 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
6317 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6318 LDKChannelMonitorUpdate obj_conv;
6319 obj_conv.inner = (void*)(obj & (~1));
6320 obj_conv.is_owned = false;
6321 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
6322 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6323 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6324 CVec_u8Z_free(arg_var);
6328 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6330 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6331 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6332 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_read(ser_ref);
6333 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6334 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6335 long ret_ref = (long)ret_var.inner;
6336 if (ret_var.is_owned) {
6339 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6343 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6344 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
6345 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(_env, ChannelMonitorUpdateErr_clone(orig_conv));
6349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6350 LDKMonitorUpdateError this_ptr_conv;
6351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6352 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6353 MonitorUpdateError_free(this_ptr_conv);
6356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6357 LDKMonitorEvent this_ptr_conv;
6358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6359 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6360 MonitorEvent_free(this_ptr_conv);
6363 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6364 LDKMonitorEvent orig_conv;
6365 orig_conv.inner = (void*)(orig & (~1));
6366 orig_conv.is_owned = false;
6367 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
6368 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6369 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6370 long ret_ref = (long)ret_var.inner;
6371 if (ret_var.is_owned) {
6377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6378 LDKHTLCUpdate this_ptr_conv;
6379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6380 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6381 HTLCUpdate_free(this_ptr_conv);
6384 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6385 LDKHTLCUpdate orig_conv;
6386 orig_conv.inner = (void*)(orig & (~1));
6387 orig_conv.is_owned = false;
6388 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
6389 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6390 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6391 long ret_ref = (long)ret_var.inner;
6392 if (ret_var.is_owned) {
6398 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6399 LDKHTLCUpdate obj_conv;
6400 obj_conv.inner = (void*)(obj & (~1));
6401 obj_conv.is_owned = false;
6402 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
6403 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6404 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6405 CVec_u8Z_free(arg_var);
6409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6411 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6412 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6413 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
6414 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6415 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6416 long ret_ref = (long)ret_var.inner;
6417 if (ret_var.is_owned) {
6420 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6425 LDKChannelMonitor this_ptr_conv;
6426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6427 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6428 ChannelMonitor_free(this_ptr_conv);
6431 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
6432 LDKChannelMonitor this_arg_conv;
6433 this_arg_conv.inner = (void*)(this_arg & (~1));
6434 this_arg_conv.is_owned = false;
6435 LDKChannelMonitorUpdate updates_conv;
6436 updates_conv.inner = (void*)(updates & (~1));
6437 updates_conv.is_owned = (updates & 1) || (updates == 0);
6438 if (updates_conv.inner != NULL)
6439 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
6440 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
6441 LDKLogger* logger_conv = (LDKLogger*)logger;
6442 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6443 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
6444 return (long)ret_conv;
6447 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6448 LDKChannelMonitor this_arg_conv;
6449 this_arg_conv.inner = (void*)(this_arg & (~1));
6450 this_arg_conv.is_owned = false;
6451 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
6455 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
6456 LDKChannelMonitor this_arg_conv;
6457 this_arg_conv.inner = (void*)(this_arg & (~1));
6458 this_arg_conv.is_owned = false;
6459 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6460 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
6461 return (long)ret_ref;
6464 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6465 LDKChannelMonitor this_arg_conv;
6466 this_arg_conv.inner = (void*)(this_arg & (~1));
6467 this_arg_conv.is_owned = false;
6468 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
6469 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6470 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6471 for (size_t o = 0; o < ret_var.datalen; o++) {
6472 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
6473 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6474 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6475 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
6476 if (arr_conv_14_var.is_owned) {
6477 arr_conv_14_ref |= 1;
6479 ret_arr_ptr[o] = arr_conv_14_ref;
6481 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6486 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6487 LDKChannelMonitor this_arg_conv;
6488 this_arg_conv.inner = (void*)(this_arg & (~1));
6489 this_arg_conv.is_owned = false;
6490 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
6491 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6492 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6493 for (size_t h = 0; h < ret_var.datalen; h++) {
6494 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6495 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
6496 long arr_conv_7_ref = (long)arr_conv_7_copy;
6497 ret_arr_ptr[h] = arr_conv_7_ref;
6499 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6500 CVec_EventZ_free(ret_var);
6504 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
6505 LDKChannelMonitor this_arg_conv;
6506 this_arg_conv.inner = (void*)(this_arg & (~1));
6507 this_arg_conv.is_owned = false;
6508 LDKLogger* logger_conv = (LDKLogger*)logger;
6509 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
6510 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, arr_of_B_clz, NULL);
6511 for (size_t i = 0; i < ret_var.datalen; i++) {
6512 LDKTransaction arr_conv_8_var = ret_var.data[i];
6513 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, arr_conv_8_var.datalen);
6514 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, arr_conv_8_var.datalen, arr_conv_8_var.data);
6515 Transaction_free(arr_conv_8_var);
6516 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
6518 CVec_TransactionZ_free(ret_var);
6522 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) {
6523 LDKChannelMonitor this_arg_conv;
6524 this_arg_conv.inner = (void*)(this_arg & (~1));
6525 this_arg_conv.is_owned = false;
6526 unsigned char header_arr[80];
6527 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6528 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6529 unsigned char (*header_ref)[80] = &header_arr;
6530 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6531 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6532 if (txdata_constr.datalen > 0)
6533 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6535 txdata_constr.data = NULL;
6536 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6537 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6538 long arr_conv_24 = txdata_vals[y];
6539 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
6540 FREE((void*)arr_conv_24);
6541 txdata_constr.data[y] = arr_conv_24_conv;
6543 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6544 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6545 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6546 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6547 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6549 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6550 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6551 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6552 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6554 LDKLogger logger_conv = *(LDKLogger*)logger;
6555 if (logger_conv.free == LDKLogger_JCalls_free) {
6556 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6557 LDKLogger_JCalls_clone(logger_conv.this_arg);
6559 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6560 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6561 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6562 for (size_t b = 0; b < ret_var.datalen; b++) {
6563 LDKC2Tuple_TxidCVec_TxOutZZ* arr_conv_27_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
6564 *arr_conv_27_ref = ret_var.data[b];
6565 ret_arr_ptr[b] = (long)arr_conv_27_ref;
6567 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6568 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(ret_var);
6572 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) {
6573 LDKChannelMonitor this_arg_conv;
6574 this_arg_conv.inner = (void*)(this_arg & (~1));
6575 this_arg_conv.is_owned = false;
6576 unsigned char header_arr[80];
6577 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6578 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6579 unsigned char (*header_ref)[80] = &header_arr;
6580 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6581 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6582 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6583 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6585 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6586 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6587 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6588 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6590 LDKLogger logger_conv = *(LDKLogger*)logger;
6591 if (logger_conv.free == LDKLogger_JCalls_free) {
6592 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6593 LDKLogger_JCalls_clone(logger_conv.this_arg);
6595 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6599 LDKOutPoint this_ptr_conv;
6600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6601 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6602 OutPoint_free(this_ptr_conv);
6605 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6606 LDKOutPoint orig_conv;
6607 orig_conv.inner = (void*)(orig & (~1));
6608 orig_conv.is_owned = false;
6609 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
6610 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6611 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6612 long ret_ref = (long)ret_var.inner;
6613 if (ret_var.is_owned) {
6619 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6620 LDKOutPoint this_ptr_conv;
6621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6622 this_ptr_conv.is_owned = false;
6623 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6624 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
6628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6629 LDKOutPoint this_ptr_conv;
6630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6631 this_ptr_conv.is_owned = false;
6632 LDKThirtyTwoBytes val_ref;
6633 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6634 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6635 OutPoint_set_txid(&this_ptr_conv, val_ref);
6638 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6639 LDKOutPoint this_ptr_conv;
6640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6641 this_ptr_conv.is_owned = false;
6642 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
6646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6647 LDKOutPoint this_ptr_conv;
6648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6649 this_ptr_conv.is_owned = false;
6650 OutPoint_set_index(&this_ptr_conv, val);
6653 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
6654 LDKThirtyTwoBytes txid_arg_ref;
6655 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
6656 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
6657 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
6658 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6659 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6660 long ret_ref = (long)ret_var.inner;
6661 if (ret_var.is_owned) {
6667 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6668 LDKOutPoint this_arg_conv;
6669 this_arg_conv.inner = (void*)(this_arg & (~1));
6670 this_arg_conv.is_owned = false;
6671 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
6672 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
6676 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
6677 LDKOutPoint obj_conv;
6678 obj_conv.inner = (void*)(obj & (~1));
6679 obj_conv.is_owned = false;
6680 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
6681 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6682 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6683 CVec_u8Z_free(arg_var);
6687 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6689 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6690 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6691 LDKOutPoint ret_var = OutPoint_read(ser_ref);
6692 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6693 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6694 long ret_ref = (long)ret_var.inner;
6695 if (ret_var.is_owned) {
6698 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6703 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
6704 FREE((void*)this_ptr);
6705 SpendableOutputDescriptor_free(this_ptr_conv);
6708 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6709 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
6710 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
6711 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
6712 long ret_ref = (long)ret_copy;
6716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6717 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
6718 FREE((void*)this_ptr);
6719 ChannelKeys_free(this_ptr_conv);
6722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6723 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
6724 FREE((void*)this_ptr);
6725 KeysInterface_free(this_ptr_conv);
6728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6729 LDKInMemoryChannelKeys this_ptr_conv;
6730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6731 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6732 InMemoryChannelKeys_free(this_ptr_conv);
6735 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6736 LDKInMemoryChannelKeys orig_conv;
6737 orig_conv.inner = (void*)(orig & (~1));
6738 orig_conv.is_owned = false;
6739 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
6740 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6741 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6742 long ret_ref = (long)ret_var.inner;
6743 if (ret_var.is_owned) {
6749 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6750 LDKInMemoryChannelKeys this_ptr_conv;
6751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6752 this_ptr_conv.is_owned = false;
6753 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6754 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
6758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6759 LDKInMemoryChannelKeys this_ptr_conv;
6760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6761 this_ptr_conv.is_owned = false;
6762 LDKSecretKey val_ref;
6763 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6764 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6765 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
6768 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6769 LDKInMemoryChannelKeys this_ptr_conv;
6770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6771 this_ptr_conv.is_owned = false;
6772 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6773 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
6777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6778 LDKInMemoryChannelKeys this_ptr_conv;
6779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6780 this_ptr_conv.is_owned = false;
6781 LDKSecretKey val_ref;
6782 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6783 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6784 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
6787 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6788 LDKInMemoryChannelKeys this_ptr_conv;
6789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6790 this_ptr_conv.is_owned = false;
6791 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6792 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
6796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6797 LDKInMemoryChannelKeys this_ptr_conv;
6798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6799 this_ptr_conv.is_owned = false;
6800 LDKSecretKey val_ref;
6801 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6802 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6803 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
6806 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6807 LDKInMemoryChannelKeys this_ptr_conv;
6808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6809 this_ptr_conv.is_owned = false;
6810 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6811 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
6815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6816 LDKInMemoryChannelKeys this_ptr_conv;
6817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6818 this_ptr_conv.is_owned = false;
6819 LDKSecretKey val_ref;
6820 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6821 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6822 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
6825 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6826 LDKInMemoryChannelKeys this_ptr_conv;
6827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6828 this_ptr_conv.is_owned = false;
6829 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6830 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
6834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6835 LDKInMemoryChannelKeys this_ptr_conv;
6836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6837 this_ptr_conv.is_owned = false;
6838 LDKSecretKey val_ref;
6839 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6840 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6841 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6844 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
6845 LDKInMemoryChannelKeys this_ptr_conv;
6846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6847 this_ptr_conv.is_owned = false;
6848 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6849 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
6853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6854 LDKInMemoryChannelKeys this_ptr_conv;
6855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6856 this_ptr_conv.is_owned = false;
6857 LDKThirtyTwoBytes val_ref;
6858 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6859 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6860 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6863 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) {
6864 LDKSecretKey funding_key_ref;
6865 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
6866 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
6867 LDKSecretKey revocation_base_key_ref;
6868 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
6869 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
6870 LDKSecretKey payment_key_ref;
6871 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
6872 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
6873 LDKSecretKey delayed_payment_base_key_ref;
6874 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
6875 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
6876 LDKSecretKey htlc_base_key_ref;
6877 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
6878 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
6879 LDKThirtyTwoBytes commitment_seed_ref;
6880 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
6881 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
6882 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
6883 FREE((void*)key_derivation_params);
6884 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);
6885 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6886 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6887 long ret_ref = (long)ret_var.inner;
6888 if (ret_var.is_owned) {
6894 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6895 LDKInMemoryChannelKeys this_arg_conv;
6896 this_arg_conv.inner = (void*)(this_arg & (~1));
6897 this_arg_conv.is_owned = false;
6898 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
6899 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6900 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6901 long ret_ref = (long)ret_var.inner;
6902 if (ret_var.is_owned) {
6908 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6909 LDKInMemoryChannelKeys this_arg_conv;
6910 this_arg_conv.inner = (void*)(this_arg & (~1));
6911 this_arg_conv.is_owned = false;
6912 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
6916 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6917 LDKInMemoryChannelKeys this_arg_conv;
6918 this_arg_conv.inner = (void*)(this_arg & (~1));
6919 this_arg_conv.is_owned = false;
6920 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
6924 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6925 LDKInMemoryChannelKeys this_arg_conv;
6926 this_arg_conv.inner = (void*)(this_arg & (~1));
6927 this_arg_conv.is_owned = false;
6928 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6929 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
6933 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
6934 LDKInMemoryChannelKeys obj_conv;
6935 obj_conv.inner = (void*)(obj & (~1));
6936 obj_conv.is_owned = false;
6937 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
6938 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6939 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6940 CVec_u8Z_free(arg_var);
6944 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6946 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6947 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6948 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_read(ser_ref);
6949 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6950 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6951 long ret_ref = (long)ret_var.inner;
6952 if (ret_var.is_owned) {
6955 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6960 LDKKeysManager this_ptr_conv;
6961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6962 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6963 KeysManager_free(this_ptr_conv);
6966 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) {
6967 unsigned char seed_arr[32];
6968 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
6969 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
6970 unsigned char (*seed_ref)[32] = &seed_arr;
6971 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6972 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
6973 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6974 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6975 long ret_ref = (long)ret_var.inner;
6976 if (ret_var.is_owned) {
6982 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) {
6983 LDKKeysManager this_arg_conv;
6984 this_arg_conv.inner = (void*)(this_arg & (~1));
6985 this_arg_conv.is_owned = false;
6986 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
6987 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6988 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6989 long ret_ref = (long)ret_var.inner;
6990 if (ret_var.is_owned) {
6996 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
6997 LDKKeysManager this_arg_conv;
6998 this_arg_conv.inner = (void*)(this_arg & (~1));
6999 this_arg_conv.is_owned = false;
7000 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
7001 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
7005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7006 LDKChannelManager this_ptr_conv;
7007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7008 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7009 ChannelManager_free(this_ptr_conv);
7012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7013 LDKChannelDetails this_ptr_conv;
7014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7015 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7016 ChannelDetails_free(this_ptr_conv);
7019 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7020 LDKChannelDetails orig_conv;
7021 orig_conv.inner = (void*)(orig & (~1));
7022 orig_conv.is_owned = false;
7023 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
7024 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7025 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7026 long ret_ref = (long)ret_var.inner;
7027 if (ret_var.is_owned) {
7033 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7034 LDKChannelDetails this_ptr_conv;
7035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7036 this_ptr_conv.is_owned = false;
7037 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7038 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
7042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7043 LDKChannelDetails this_ptr_conv;
7044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7045 this_ptr_conv.is_owned = false;
7046 LDKThirtyTwoBytes val_ref;
7047 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7048 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7049 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
7052 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7053 LDKChannelDetails this_ptr_conv;
7054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7055 this_ptr_conv.is_owned = false;
7056 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7057 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
7061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7062 LDKChannelDetails this_ptr_conv;
7063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7064 this_ptr_conv.is_owned = false;
7065 LDKPublicKey val_ref;
7066 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7067 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7068 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
7071 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
7072 LDKChannelDetails this_ptr_conv;
7073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7074 this_ptr_conv.is_owned = false;
7075 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
7076 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7077 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7078 long ret_ref = (long)ret_var.inner;
7079 if (ret_var.is_owned) {
7085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7086 LDKChannelDetails this_ptr_conv;
7087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7088 this_ptr_conv.is_owned = false;
7089 LDKInitFeatures val_conv;
7090 val_conv.inner = (void*)(val & (~1));
7091 val_conv.is_owned = (val & 1) || (val == 0);
7092 // Warning: we may need a move here but can't clone!
7093 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
7096 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7097 LDKChannelDetails this_ptr_conv;
7098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7099 this_ptr_conv.is_owned = false;
7100 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
7104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7105 LDKChannelDetails this_ptr_conv;
7106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7107 this_ptr_conv.is_owned = false;
7108 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
7111 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7112 LDKChannelDetails this_ptr_conv;
7113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7114 this_ptr_conv.is_owned = false;
7115 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
7119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7120 LDKChannelDetails this_ptr_conv;
7121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7122 this_ptr_conv.is_owned = false;
7123 ChannelDetails_set_user_id(&this_ptr_conv, val);
7126 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7127 LDKChannelDetails this_ptr_conv;
7128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7129 this_ptr_conv.is_owned = false;
7130 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
7134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7135 LDKChannelDetails this_ptr_conv;
7136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7137 this_ptr_conv.is_owned = false;
7138 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
7141 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7142 LDKChannelDetails this_ptr_conv;
7143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7144 this_ptr_conv.is_owned = false;
7145 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
7149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7150 LDKChannelDetails this_ptr_conv;
7151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7152 this_ptr_conv.is_owned = false;
7153 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
7156 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
7157 LDKChannelDetails this_ptr_conv;
7158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7159 this_ptr_conv.is_owned = false;
7160 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
7164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
7165 LDKChannelDetails this_ptr_conv;
7166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7167 this_ptr_conv.is_owned = false;
7168 ChannelDetails_set_is_live(&this_ptr_conv, val);
7171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7172 LDKPaymentSendFailure this_ptr_conv;
7173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7174 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7175 PaymentSendFailure_free(this_ptr_conv);
7178 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) {
7179 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
7180 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
7181 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
7182 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7183 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
7185 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7186 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7187 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7188 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7190 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7191 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7192 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7193 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7195 LDKLogger logger_conv = *(LDKLogger*)logger;
7196 if (logger_conv.free == LDKLogger_JCalls_free) {
7197 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7198 LDKLogger_JCalls_clone(logger_conv.this_arg);
7200 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7201 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7202 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7203 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7205 LDKUserConfig config_conv;
7206 config_conv.inner = (void*)(config & (~1));
7207 config_conv.is_owned = (config & 1) || (config == 0);
7208 if (config_conv.inner != NULL)
7209 config_conv = UserConfig_clone(&config_conv);
7210 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);
7211 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7212 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7213 long ret_ref = (long)ret_var.inner;
7214 if (ret_var.is_owned) {
7220 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) {
7221 LDKChannelManager this_arg_conv;
7222 this_arg_conv.inner = (void*)(this_arg & (~1));
7223 this_arg_conv.is_owned = false;
7224 LDKPublicKey their_network_key_ref;
7225 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
7226 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
7227 LDKUserConfig override_config_conv;
7228 override_config_conv.inner = (void*)(override_config & (~1));
7229 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
7230 if (override_config_conv.inner != NULL)
7231 override_config_conv = UserConfig_clone(&override_config_conv);
7232 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7233 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
7234 return (long)ret_conv;
7237 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7238 LDKChannelManager this_arg_conv;
7239 this_arg_conv.inner = (void*)(this_arg & (~1));
7240 this_arg_conv.is_owned = false;
7241 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
7242 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7243 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7244 for (size_t q = 0; q < ret_var.datalen; q++) {
7245 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7246 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7247 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7248 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7249 if (arr_conv_16_var.is_owned) {
7250 arr_conv_16_ref |= 1;
7252 ret_arr_ptr[q] = arr_conv_16_ref;
7254 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7259 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7260 LDKChannelManager this_arg_conv;
7261 this_arg_conv.inner = (void*)(this_arg & (~1));
7262 this_arg_conv.is_owned = false;
7263 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
7264 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7265 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7266 for (size_t q = 0; q < ret_var.datalen; q++) {
7267 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7268 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7269 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7270 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7271 if (arr_conv_16_var.is_owned) {
7272 arr_conv_16_ref |= 1;
7274 ret_arr_ptr[q] = arr_conv_16_ref;
7276 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7281 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7282 LDKChannelManager this_arg_conv;
7283 this_arg_conv.inner = (void*)(this_arg & (~1));
7284 this_arg_conv.is_owned = false;
7285 unsigned char channel_id_arr[32];
7286 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7287 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7288 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7289 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7290 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
7291 return (long)ret_conv;
7294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7295 LDKChannelManager this_arg_conv;
7296 this_arg_conv.inner = (void*)(this_arg & (~1));
7297 this_arg_conv.is_owned = false;
7298 unsigned char channel_id_arr[32];
7299 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7300 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7301 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7302 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
7305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7306 LDKChannelManager this_arg_conv;
7307 this_arg_conv.inner = (void*)(this_arg & (~1));
7308 this_arg_conv.is_owned = false;
7309 ChannelManager_force_close_all_channels(&this_arg_conv);
7312 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) {
7313 LDKChannelManager this_arg_conv;
7314 this_arg_conv.inner = (void*)(this_arg & (~1));
7315 this_arg_conv.is_owned = false;
7316 LDKRoute route_conv;
7317 route_conv.inner = (void*)(route & (~1));
7318 route_conv.is_owned = false;
7319 LDKThirtyTwoBytes payment_hash_ref;
7320 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7321 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
7322 LDKThirtyTwoBytes payment_secret_ref;
7323 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7324 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7325 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7326 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
7327 return (long)ret_conv;
7330 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) {
7331 LDKChannelManager this_arg_conv;
7332 this_arg_conv.inner = (void*)(this_arg & (~1));
7333 this_arg_conv.is_owned = false;
7334 unsigned char temporary_channel_id_arr[32];
7335 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
7336 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
7337 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
7338 LDKOutPoint funding_txo_conv;
7339 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7340 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
7341 if (funding_txo_conv.inner != NULL)
7342 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7343 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
7346 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) {
7347 LDKChannelManager this_arg_conv;
7348 this_arg_conv.inner = (void*)(this_arg & (~1));
7349 this_arg_conv.is_owned = false;
7350 LDKThreeBytes rgb_ref;
7351 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
7352 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
7353 LDKThirtyTwoBytes alias_ref;
7354 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
7355 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
7356 LDKCVec_NetAddressZ addresses_constr;
7357 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
7358 if (addresses_constr.datalen > 0)
7359 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7361 addresses_constr.data = NULL;
7362 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
7363 for (size_t m = 0; m < addresses_constr.datalen; m++) {
7364 long arr_conv_12 = addresses_vals[m];
7365 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
7366 FREE((void*)arr_conv_12);
7367 addresses_constr.data[m] = arr_conv_12_conv;
7369 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
7370 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
7373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
7374 LDKChannelManager this_arg_conv;
7375 this_arg_conv.inner = (void*)(this_arg & (~1));
7376 this_arg_conv.is_owned = false;
7377 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
7380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
7381 LDKChannelManager this_arg_conv;
7382 this_arg_conv.inner = (void*)(this_arg & (~1));
7383 this_arg_conv.is_owned = false;
7384 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
7387 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) {
7388 LDKChannelManager this_arg_conv;
7389 this_arg_conv.inner = (void*)(this_arg & (~1));
7390 this_arg_conv.is_owned = false;
7391 unsigned char payment_hash_arr[32];
7392 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7393 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
7394 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
7395 LDKThirtyTwoBytes payment_secret_ref;
7396 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7397 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7398 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
7402 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) {
7403 LDKChannelManager this_arg_conv;
7404 this_arg_conv.inner = (void*)(this_arg & (~1));
7405 this_arg_conv.is_owned = false;
7406 LDKThirtyTwoBytes payment_preimage_ref;
7407 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
7408 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
7409 LDKThirtyTwoBytes payment_secret_ref;
7410 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7411 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7412 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
7416 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
7417 LDKChannelManager this_arg_conv;
7418 this_arg_conv.inner = (void*)(this_arg & (~1));
7419 this_arg_conv.is_owned = false;
7420 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7421 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
7425 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) {
7426 LDKChannelManager this_arg_conv;
7427 this_arg_conv.inner = (void*)(this_arg & (~1));
7428 this_arg_conv.is_owned = false;
7429 LDKOutPoint funding_txo_conv;
7430 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7431 funding_txo_conv.is_owned = false;
7432 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
7435 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7436 LDKChannelManager this_arg_conv;
7437 this_arg_conv.inner = (void*)(this_arg & (~1));
7438 this_arg_conv.is_owned = false;
7439 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7440 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
7444 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7445 LDKChannelManager this_arg_conv;
7446 this_arg_conv.inner = (void*)(this_arg & (~1));
7447 this_arg_conv.is_owned = false;
7448 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7449 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
7453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
7454 LDKChannelManager this_arg_conv;
7455 this_arg_conv.inner = (void*)(this_arg & (~1));
7456 this_arg_conv.is_owned = false;
7457 unsigned char header_arr[80];
7458 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7459 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7460 unsigned char (*header_ref)[80] = &header_arr;
7461 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7462 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
7463 if (txdata_constr.datalen > 0)
7464 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7466 txdata_constr.data = NULL;
7467 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
7468 for (size_t y = 0; y < txdata_constr.datalen; y++) {
7469 long arr_conv_24 = txdata_vals[y];
7470 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
7471 FREE((void*)arr_conv_24);
7472 txdata_constr.data[y] = arr_conv_24_conv;
7474 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
7475 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
7478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
7479 LDKChannelManager this_arg_conv;
7480 this_arg_conv.inner = (void*)(this_arg & (~1));
7481 this_arg_conv.is_owned = false;
7482 unsigned char header_arr[80];
7483 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7484 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7485 unsigned char (*header_ref)[80] = &header_arr;
7486 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
7489 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
7490 LDKChannelManager this_arg_conv;
7491 this_arg_conv.inner = (void*)(this_arg & (~1));
7492 this_arg_conv.is_owned = false;
7493 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7494 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
7498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7499 LDKChannelManagerReadArgs this_ptr_conv;
7500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7501 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7502 ChannelManagerReadArgs_free(this_ptr_conv);
7505 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
7506 LDKChannelManagerReadArgs this_ptr_conv;
7507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7508 this_ptr_conv.is_owned = false;
7509 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
7513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7514 LDKChannelManagerReadArgs this_ptr_conv;
7515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7516 this_ptr_conv.is_owned = false;
7517 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
7518 if (val_conv.free == LDKKeysInterface_JCalls_free) {
7519 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7520 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
7522 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
7525 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
7526 LDKChannelManagerReadArgs this_ptr_conv;
7527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7528 this_ptr_conv.is_owned = false;
7529 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
7533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7534 LDKChannelManagerReadArgs this_ptr_conv;
7535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7536 this_ptr_conv.is_owned = false;
7537 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
7538 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
7539 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7540 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
7542 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
7545 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
7546 LDKChannelManagerReadArgs this_ptr_conv;
7547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7548 this_ptr_conv.is_owned = false;
7549 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
7553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7554 LDKChannelManagerReadArgs this_ptr_conv;
7555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7556 this_ptr_conv.is_owned = false;
7557 LDKWatch val_conv = *(LDKWatch*)val;
7558 if (val_conv.free == LDKWatch_JCalls_free) {
7559 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7560 LDKWatch_JCalls_clone(val_conv.this_arg);
7562 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
7565 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
7566 LDKChannelManagerReadArgs this_ptr_conv;
7567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7568 this_ptr_conv.is_owned = false;
7569 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
7573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7574 LDKChannelManagerReadArgs this_ptr_conv;
7575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7576 this_ptr_conv.is_owned = false;
7577 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
7578 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
7579 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7580 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
7582 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
7585 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
7586 LDKChannelManagerReadArgs this_ptr_conv;
7587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7588 this_ptr_conv.is_owned = false;
7589 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
7593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7594 LDKChannelManagerReadArgs this_ptr_conv;
7595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7596 this_ptr_conv.is_owned = false;
7597 LDKLogger val_conv = *(LDKLogger*)val;
7598 if (val_conv.free == LDKLogger_JCalls_free) {
7599 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7600 LDKLogger_JCalls_clone(val_conv.this_arg);
7602 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
7605 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
7606 LDKChannelManagerReadArgs this_ptr_conv;
7607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7608 this_ptr_conv.is_owned = false;
7609 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
7610 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7611 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7612 long ret_ref = (long)ret_var.inner;
7613 if (ret_var.is_owned) {
7619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7620 LDKChannelManagerReadArgs this_ptr_conv;
7621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7622 this_ptr_conv.is_owned = false;
7623 LDKUserConfig val_conv;
7624 val_conv.inner = (void*)(val & (~1));
7625 val_conv.is_owned = (val & 1) || (val == 0);
7626 if (val_conv.inner != NULL)
7627 val_conv = UserConfig_clone(&val_conv);
7628 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
7631 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) {
7632 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7633 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7634 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7635 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7637 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7638 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
7639 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7640 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
7642 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7643 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7644 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7645 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7647 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7648 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7649 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7650 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7652 LDKLogger logger_conv = *(LDKLogger*)logger;
7653 if (logger_conv.free == LDKLogger_JCalls_free) {
7654 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7655 LDKLogger_JCalls_clone(logger_conv.this_arg);
7657 LDKUserConfig default_config_conv;
7658 default_config_conv.inner = (void*)(default_config & (~1));
7659 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
7660 if (default_config_conv.inner != NULL)
7661 default_config_conv = UserConfig_clone(&default_config_conv);
7662 LDKCVec_ChannelMonitorZ channel_monitors_constr;
7663 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
7664 if (channel_monitors_constr.datalen > 0)
7665 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7667 channel_monitors_constr.data = NULL;
7668 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
7669 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
7670 long arr_conv_16 = channel_monitors_vals[q];
7671 LDKChannelMonitor arr_conv_16_conv;
7672 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7673 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7674 channel_monitors_constr.data[q] = arr_conv_16_conv;
7676 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
7677 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);
7678 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7679 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7680 long ret_ref = (long)ret_var.inner;
7681 if (ret_var.is_owned) {
7687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7688 LDKDecodeError this_ptr_conv;
7689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7690 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7691 DecodeError_free(this_ptr_conv);
7694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7695 LDKInit this_ptr_conv;
7696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7697 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7698 Init_free(this_ptr_conv);
7701 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7703 orig_conv.inner = (void*)(orig & (~1));
7704 orig_conv.is_owned = false;
7705 LDKInit ret_var = Init_clone(&orig_conv);
7706 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7707 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7708 long ret_ref = (long)ret_var.inner;
7709 if (ret_var.is_owned) {
7715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7716 LDKErrorMessage this_ptr_conv;
7717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7718 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7719 ErrorMessage_free(this_ptr_conv);
7722 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7723 LDKErrorMessage orig_conv;
7724 orig_conv.inner = (void*)(orig & (~1));
7725 orig_conv.is_owned = false;
7726 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
7727 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7728 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7729 long ret_ref = (long)ret_var.inner;
7730 if (ret_var.is_owned) {
7736 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7737 LDKErrorMessage this_ptr_conv;
7738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7739 this_ptr_conv.is_owned = false;
7740 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7741 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
7745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(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 = false;
7749 LDKThirtyTwoBytes val_ref;
7750 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7751 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7752 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
7755 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
7756 LDKErrorMessage this_ptr_conv;
7757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7758 this_ptr_conv.is_owned = false;
7759 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
7760 char* _buf = MALLOC(_str.len + 1, "str conv buf");
7761 memcpy(_buf, _str.chars, _str.len);
7763 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
7768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7769 LDKErrorMessage this_ptr_conv;
7770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7771 this_ptr_conv.is_owned = false;
7772 LDKCVec_u8Z val_ref;
7773 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7774 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
7775 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
7776 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7779 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
7780 LDKThirtyTwoBytes channel_id_arg_ref;
7781 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7782 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7783 LDKCVec_u8Z data_arg_ref;
7784 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
7785 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
7786 (*_env)->GetByteArrayRegion(_env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
7787 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7788 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7789 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7790 long ret_ref = (long)ret_var.inner;
7791 if (ret_var.is_owned) {
7797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7798 LDKPing this_ptr_conv;
7799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7800 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7801 Ping_free(this_ptr_conv);
7804 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7806 orig_conv.inner = (void*)(orig & (~1));
7807 orig_conv.is_owned = false;
7808 LDKPing ret_var = Ping_clone(&orig_conv);
7809 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7810 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7811 long ret_ref = (long)ret_var.inner;
7812 if (ret_var.is_owned) {
7818 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7819 LDKPing this_ptr_conv;
7820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7821 this_ptr_conv.is_owned = false;
7822 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7827 LDKPing this_ptr_conv;
7828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7829 this_ptr_conv.is_owned = false;
7830 Ping_set_ponglen(&this_ptr_conv, val);
7833 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7834 LDKPing this_ptr_conv;
7835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7836 this_ptr_conv.is_owned = false;
7837 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7842 LDKPing this_ptr_conv;
7843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7844 this_ptr_conv.is_owned = false;
7845 Ping_set_byteslen(&this_ptr_conv, val);
7848 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
7849 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
7850 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7851 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7852 long ret_ref = (long)ret_var.inner;
7853 if (ret_var.is_owned) {
7859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7860 LDKPong this_ptr_conv;
7861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7863 Pong_free(this_ptr_conv);
7866 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7868 orig_conv.inner = (void*)(orig & (~1));
7869 orig_conv.is_owned = false;
7870 LDKPong ret_var = Pong_clone(&orig_conv);
7871 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7872 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7873 long ret_ref = (long)ret_var.inner;
7874 if (ret_var.is_owned) {
7880 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7881 LDKPong this_ptr_conv;
7882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7883 this_ptr_conv.is_owned = false;
7884 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
7888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7889 LDKPong this_ptr_conv;
7890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7891 this_ptr_conv.is_owned = false;
7892 Pong_set_byteslen(&this_ptr_conv, val);
7895 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
7896 LDKPong ret_var = Pong_new(byteslen_arg);
7897 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7898 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7899 long ret_ref = (long)ret_var.inner;
7900 if (ret_var.is_owned) {
7906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7907 LDKOpenChannel this_ptr_conv;
7908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7909 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7910 OpenChannel_free(this_ptr_conv);
7913 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7914 LDKOpenChannel orig_conv;
7915 orig_conv.inner = (void*)(orig & (~1));
7916 orig_conv.is_owned = false;
7917 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
7918 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7919 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7920 long ret_ref = (long)ret_var.inner;
7921 if (ret_var.is_owned) {
7927 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7928 LDKOpenChannel this_ptr_conv;
7929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7930 this_ptr_conv.is_owned = false;
7931 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7932 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
7936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7937 LDKOpenChannel this_ptr_conv;
7938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7939 this_ptr_conv.is_owned = false;
7940 LDKThirtyTwoBytes val_ref;
7941 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7942 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7943 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
7946 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7947 LDKOpenChannel this_ptr_conv;
7948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7949 this_ptr_conv.is_owned = false;
7950 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7951 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
7955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7956 LDKOpenChannel this_ptr_conv;
7957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7958 this_ptr_conv.is_owned = false;
7959 LDKThirtyTwoBytes val_ref;
7960 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7961 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7962 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7965 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7966 LDKOpenChannel this_ptr_conv;
7967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7968 this_ptr_conv.is_owned = false;
7969 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
7973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7974 LDKOpenChannel this_ptr_conv;
7975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7976 this_ptr_conv.is_owned = false;
7977 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
7980 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7981 LDKOpenChannel this_ptr_conv;
7982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7983 this_ptr_conv.is_owned = false;
7984 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
7988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7989 LDKOpenChannel this_ptr_conv;
7990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7991 this_ptr_conv.is_owned = false;
7992 OpenChannel_set_push_msat(&this_ptr_conv, val);
7995 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7996 LDKOpenChannel this_ptr_conv;
7997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7998 this_ptr_conv.is_owned = false;
7999 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
8003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8004 LDKOpenChannel this_ptr_conv;
8005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8006 this_ptr_conv.is_owned = false;
8007 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8010 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8011 LDKOpenChannel this_ptr_conv;
8012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8013 this_ptr_conv.is_owned = false;
8014 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8018 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) {
8019 LDKOpenChannel this_ptr_conv;
8020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8021 this_ptr_conv.is_owned = false;
8022 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8025 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8026 LDKOpenChannel this_ptr_conv;
8027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8028 this_ptr_conv.is_owned = false;
8029 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8034 LDKOpenChannel this_ptr_conv;
8035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8036 this_ptr_conv.is_owned = false;
8037 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8040 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8041 LDKOpenChannel this_ptr_conv;
8042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8043 this_ptr_conv.is_owned = false;
8044 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
8048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8049 LDKOpenChannel this_ptr_conv;
8050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8051 this_ptr_conv.is_owned = false;
8052 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8055 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
8056 LDKOpenChannel this_ptr_conv;
8057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8058 this_ptr_conv.is_owned = false;
8059 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
8063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8064 LDKOpenChannel this_ptr_conv;
8065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8066 this_ptr_conv.is_owned = false;
8067 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
8070 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
8071 LDKOpenChannel this_ptr_conv;
8072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8073 this_ptr_conv.is_owned = false;
8074 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
8078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8079 LDKOpenChannel this_ptr_conv;
8080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8081 this_ptr_conv.is_owned = false;
8082 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
8085 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
8086 LDKOpenChannel this_ptr_conv;
8087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8088 this_ptr_conv.is_owned = false;
8089 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
8093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8094 LDKOpenChannel this_ptr_conv;
8095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8096 this_ptr_conv.is_owned = false;
8097 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8100 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8101 LDKOpenChannel this_ptr_conv;
8102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8103 this_ptr_conv.is_owned = false;
8104 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8105 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8110 LDKOpenChannel this_ptr_conv;
8111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8112 this_ptr_conv.is_owned = false;
8113 LDKPublicKey val_ref;
8114 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8115 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8116 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8119 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8120 LDKOpenChannel this_ptr_conv;
8121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8122 this_ptr_conv.is_owned = false;
8123 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8124 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8129 LDKOpenChannel this_ptr_conv;
8130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8131 this_ptr_conv.is_owned = false;
8132 LDKPublicKey val_ref;
8133 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8134 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8135 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8138 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8139 LDKOpenChannel this_ptr_conv;
8140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8141 this_ptr_conv.is_owned = false;
8142 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8143 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
8147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8148 LDKOpenChannel this_ptr_conv;
8149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8150 this_ptr_conv.is_owned = false;
8151 LDKPublicKey val_ref;
8152 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8153 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8154 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
8157 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8158 LDKOpenChannel this_ptr_conv;
8159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8160 this_ptr_conv.is_owned = false;
8161 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8162 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8167 LDKOpenChannel this_ptr_conv;
8168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8169 this_ptr_conv.is_owned = false;
8170 LDKPublicKey val_ref;
8171 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8172 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8173 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8176 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8177 LDKOpenChannel this_ptr_conv;
8178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8179 this_ptr_conv.is_owned = false;
8180 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8181 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8186 LDKOpenChannel this_ptr_conv;
8187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8188 this_ptr_conv.is_owned = false;
8189 LDKPublicKey val_ref;
8190 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8191 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8192 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8195 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8196 LDKOpenChannel this_ptr_conv;
8197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8198 this_ptr_conv.is_owned = false;
8199 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8200 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8205 LDKOpenChannel this_ptr_conv;
8206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8207 this_ptr_conv.is_owned = false;
8208 LDKPublicKey val_ref;
8209 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8210 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8211 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8214 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8215 LDKOpenChannel this_ptr_conv;
8216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8217 this_ptr_conv.is_owned = false;
8218 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
8222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8223 LDKOpenChannel this_ptr_conv;
8224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8225 this_ptr_conv.is_owned = false;
8226 OpenChannel_set_channel_flags(&this_ptr_conv, val);
8229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8230 LDKAcceptChannel this_ptr_conv;
8231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8232 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8233 AcceptChannel_free(this_ptr_conv);
8236 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8237 LDKAcceptChannel orig_conv;
8238 orig_conv.inner = (void*)(orig & (~1));
8239 orig_conv.is_owned = false;
8240 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
8241 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8242 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8243 long ret_ref = (long)ret_var.inner;
8244 if (ret_var.is_owned) {
8250 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8251 LDKAcceptChannel this_ptr_conv;
8252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8253 this_ptr_conv.is_owned = false;
8254 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8255 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
8259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8260 LDKAcceptChannel this_ptr_conv;
8261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8262 this_ptr_conv.is_owned = false;
8263 LDKThirtyTwoBytes val_ref;
8264 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8265 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8266 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8269 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8270 LDKAcceptChannel this_ptr_conv;
8271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8272 this_ptr_conv.is_owned = false;
8273 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
8277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8278 LDKAcceptChannel this_ptr_conv;
8279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8280 this_ptr_conv.is_owned = false;
8281 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8284 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8285 LDKAcceptChannel this_ptr_conv;
8286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8287 this_ptr_conv.is_owned = false;
8288 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8292 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) {
8293 LDKAcceptChannel this_ptr_conv;
8294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8295 this_ptr_conv.is_owned = false;
8296 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8299 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8300 LDKAcceptChannel this_ptr_conv;
8301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8302 this_ptr_conv.is_owned = false;
8303 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8308 LDKAcceptChannel this_ptr_conv;
8309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8310 this_ptr_conv.is_owned = false;
8311 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8314 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8315 LDKAcceptChannel this_ptr_conv;
8316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8317 this_ptr_conv.is_owned = false;
8318 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
8322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8323 LDKAcceptChannel this_ptr_conv;
8324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8325 this_ptr_conv.is_owned = false;
8326 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8329 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
8330 LDKAcceptChannel this_ptr_conv;
8331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8332 this_ptr_conv.is_owned = false;
8333 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
8337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8338 LDKAcceptChannel this_ptr_conv;
8339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8340 this_ptr_conv.is_owned = false;
8341 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
8344 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
8345 LDKAcceptChannel this_ptr_conv;
8346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8347 this_ptr_conv.is_owned = false;
8348 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
8352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8353 LDKAcceptChannel this_ptr_conv;
8354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8355 this_ptr_conv.is_owned = false;
8356 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
8359 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
8360 LDKAcceptChannel this_ptr_conv;
8361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8362 this_ptr_conv.is_owned = false;
8363 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
8367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8368 LDKAcceptChannel this_ptr_conv;
8369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8370 this_ptr_conv.is_owned = false;
8371 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8374 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8375 LDKAcceptChannel this_ptr_conv;
8376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8377 this_ptr_conv.is_owned = false;
8378 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8379 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8384 LDKAcceptChannel this_ptr_conv;
8385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8386 this_ptr_conv.is_owned = false;
8387 LDKPublicKey val_ref;
8388 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8389 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8390 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8393 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8394 LDKAcceptChannel this_ptr_conv;
8395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8396 this_ptr_conv.is_owned = false;
8397 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8398 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8403 LDKAcceptChannel this_ptr_conv;
8404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8405 this_ptr_conv.is_owned = false;
8406 LDKPublicKey val_ref;
8407 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8408 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8409 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8412 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8413 LDKAcceptChannel this_ptr_conv;
8414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8415 this_ptr_conv.is_owned = false;
8416 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8417 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
8421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8422 LDKAcceptChannel this_ptr_conv;
8423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8424 this_ptr_conv.is_owned = false;
8425 LDKPublicKey val_ref;
8426 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8427 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8428 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
8431 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8432 LDKAcceptChannel this_ptr_conv;
8433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8434 this_ptr_conv.is_owned = false;
8435 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8436 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8441 LDKAcceptChannel this_ptr_conv;
8442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8443 this_ptr_conv.is_owned = false;
8444 LDKPublicKey val_ref;
8445 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8446 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8447 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8450 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8451 LDKAcceptChannel this_ptr_conv;
8452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8453 this_ptr_conv.is_owned = false;
8454 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8455 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8460 LDKAcceptChannel this_ptr_conv;
8461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8462 this_ptr_conv.is_owned = false;
8463 LDKPublicKey val_ref;
8464 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8465 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8466 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8469 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8470 LDKAcceptChannel this_ptr_conv;
8471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8472 this_ptr_conv.is_owned = false;
8473 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8474 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8479 LDKAcceptChannel this_ptr_conv;
8480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8481 this_ptr_conv.is_owned = false;
8482 LDKPublicKey val_ref;
8483 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8484 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8485 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8489 LDKFundingCreated this_ptr_conv;
8490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8491 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8492 FundingCreated_free(this_ptr_conv);
8495 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8496 LDKFundingCreated orig_conv;
8497 orig_conv.inner = (void*)(orig & (~1));
8498 orig_conv.is_owned = false;
8499 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
8500 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8501 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8502 long ret_ref = (long)ret_var.inner;
8503 if (ret_var.is_owned) {
8509 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8510 LDKFundingCreated this_ptr_conv;
8511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8512 this_ptr_conv.is_owned = false;
8513 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8514 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
8518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8519 LDKFundingCreated this_ptr_conv;
8520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8521 this_ptr_conv.is_owned = false;
8522 LDKThirtyTwoBytes val_ref;
8523 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8524 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8525 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
8528 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
8529 LDKFundingCreated this_ptr_conv;
8530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8531 this_ptr_conv.is_owned = false;
8532 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8533 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
8537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8538 LDKFundingCreated this_ptr_conv;
8539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8540 this_ptr_conv.is_owned = false;
8541 LDKThirtyTwoBytes val_ref;
8542 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8543 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8544 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
8547 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
8548 LDKFundingCreated this_ptr_conv;
8549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8550 this_ptr_conv.is_owned = false;
8551 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
8555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8556 LDKFundingCreated this_ptr_conv;
8557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8558 this_ptr_conv.is_owned = false;
8559 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
8562 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8563 LDKFundingCreated this_ptr_conv;
8564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8565 this_ptr_conv.is_owned = false;
8566 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8567 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
8571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8572 LDKFundingCreated this_ptr_conv;
8573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8574 this_ptr_conv.is_owned = false;
8575 LDKSignature val_ref;
8576 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8577 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8578 FundingCreated_set_signature(&this_ptr_conv, val_ref);
8581 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) {
8582 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
8583 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
8584 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
8585 LDKThirtyTwoBytes funding_txid_arg_ref;
8586 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
8587 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
8588 LDKSignature signature_arg_ref;
8589 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8590 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8591 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
8592 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8593 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8594 long ret_ref = (long)ret_var.inner;
8595 if (ret_var.is_owned) {
8601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8602 LDKFundingSigned this_ptr_conv;
8603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8604 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8605 FundingSigned_free(this_ptr_conv);
8608 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8609 LDKFundingSigned orig_conv;
8610 orig_conv.inner = (void*)(orig & (~1));
8611 orig_conv.is_owned = false;
8612 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
8613 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8614 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8615 long ret_ref = (long)ret_var.inner;
8616 if (ret_var.is_owned) {
8622 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8623 LDKFundingSigned this_ptr_conv;
8624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8625 this_ptr_conv.is_owned = false;
8626 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8627 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
8631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8632 LDKFundingSigned this_ptr_conv;
8633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8634 this_ptr_conv.is_owned = false;
8635 LDKThirtyTwoBytes val_ref;
8636 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8637 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8638 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
8641 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8642 LDKFundingSigned this_ptr_conv;
8643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8644 this_ptr_conv.is_owned = false;
8645 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8646 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
8650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8651 LDKFundingSigned this_ptr_conv;
8652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8653 this_ptr_conv.is_owned = false;
8654 LDKSignature val_ref;
8655 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8656 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8657 FundingSigned_set_signature(&this_ptr_conv, val_ref);
8660 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
8661 LDKThirtyTwoBytes channel_id_arg_ref;
8662 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8663 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8664 LDKSignature signature_arg_ref;
8665 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8666 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8667 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
8668 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8669 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8670 long ret_ref = (long)ret_var.inner;
8671 if (ret_var.is_owned) {
8677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8678 LDKFundingLocked this_ptr_conv;
8679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8680 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8681 FundingLocked_free(this_ptr_conv);
8684 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8685 LDKFundingLocked orig_conv;
8686 orig_conv.inner = (void*)(orig & (~1));
8687 orig_conv.is_owned = false;
8688 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
8689 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8690 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8691 long ret_ref = (long)ret_var.inner;
8692 if (ret_var.is_owned) {
8698 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8699 LDKFundingLocked this_ptr_conv;
8700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8701 this_ptr_conv.is_owned = false;
8702 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8703 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
8707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8708 LDKFundingLocked this_ptr_conv;
8709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8710 this_ptr_conv.is_owned = false;
8711 LDKThirtyTwoBytes val_ref;
8712 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8713 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8714 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
8717 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8718 LDKFundingLocked this_ptr_conv;
8719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8720 this_ptr_conv.is_owned = false;
8721 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8722 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8727 LDKFundingLocked this_ptr_conv;
8728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8729 this_ptr_conv.is_owned = false;
8730 LDKPublicKey val_ref;
8731 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8732 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8733 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8736 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
8737 LDKThirtyTwoBytes channel_id_arg_ref;
8738 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8739 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8740 LDKPublicKey next_per_commitment_point_arg_ref;
8741 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8742 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8743 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
8744 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8745 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8746 long ret_ref = (long)ret_var.inner;
8747 if (ret_var.is_owned) {
8753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8754 LDKShutdown this_ptr_conv;
8755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8756 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8757 Shutdown_free(this_ptr_conv);
8760 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8761 LDKShutdown orig_conv;
8762 orig_conv.inner = (void*)(orig & (~1));
8763 orig_conv.is_owned = false;
8764 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
8765 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8766 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8767 long ret_ref = (long)ret_var.inner;
8768 if (ret_var.is_owned) {
8774 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8775 LDKShutdown this_ptr_conv;
8776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8777 this_ptr_conv.is_owned = false;
8778 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8779 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
8783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8784 LDKShutdown this_ptr_conv;
8785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8786 this_ptr_conv.is_owned = false;
8787 LDKThirtyTwoBytes val_ref;
8788 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8789 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8790 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8793 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8794 LDKShutdown this_ptr_conv;
8795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8796 this_ptr_conv.is_owned = false;
8797 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8798 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8799 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8804 LDKShutdown this_ptr_conv;
8805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8806 this_ptr_conv.is_owned = false;
8807 LDKCVec_u8Z val_ref;
8808 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
8809 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
8810 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
8811 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8814 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
8815 LDKThirtyTwoBytes channel_id_arg_ref;
8816 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8817 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8818 LDKCVec_u8Z scriptpubkey_arg_ref;
8819 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
8820 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
8821 (*_env)->GetByteArrayRegion(_env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
8822 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8823 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8824 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8825 long ret_ref = (long)ret_var.inner;
8826 if (ret_var.is_owned) {
8832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8833 LDKClosingSigned this_ptr_conv;
8834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8835 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8836 ClosingSigned_free(this_ptr_conv);
8839 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8840 LDKClosingSigned orig_conv;
8841 orig_conv.inner = (void*)(orig & (~1));
8842 orig_conv.is_owned = false;
8843 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
8844 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8845 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8846 long ret_ref = (long)ret_var.inner;
8847 if (ret_var.is_owned) {
8853 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8854 LDKClosingSigned this_ptr_conv;
8855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8856 this_ptr_conv.is_owned = false;
8857 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8858 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
8862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8863 LDKClosingSigned this_ptr_conv;
8864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8865 this_ptr_conv.is_owned = false;
8866 LDKThirtyTwoBytes val_ref;
8867 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8868 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8869 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
8872 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8873 LDKClosingSigned this_ptr_conv;
8874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8875 this_ptr_conv.is_owned = false;
8876 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
8880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8881 LDKClosingSigned this_ptr_conv;
8882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8883 this_ptr_conv.is_owned = false;
8884 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
8887 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8888 LDKClosingSigned this_ptr_conv;
8889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8890 this_ptr_conv.is_owned = false;
8891 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8892 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
8896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8897 LDKClosingSigned this_ptr_conv;
8898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8899 this_ptr_conv.is_owned = false;
8900 LDKSignature val_ref;
8901 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8902 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8903 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
8906 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) {
8907 LDKThirtyTwoBytes channel_id_arg_ref;
8908 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8909 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8910 LDKSignature signature_arg_ref;
8911 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8912 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8913 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
8914 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8915 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8916 long ret_ref = (long)ret_var.inner;
8917 if (ret_var.is_owned) {
8923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8924 LDKUpdateAddHTLC this_ptr_conv;
8925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8926 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8927 UpdateAddHTLC_free(this_ptr_conv);
8930 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8931 LDKUpdateAddHTLC orig_conv;
8932 orig_conv.inner = (void*)(orig & (~1));
8933 orig_conv.is_owned = false;
8934 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
8935 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8936 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8937 long ret_ref = (long)ret_var.inner;
8938 if (ret_var.is_owned) {
8944 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8945 LDKUpdateAddHTLC this_ptr_conv;
8946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8947 this_ptr_conv.is_owned = false;
8948 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8949 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
8953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8954 LDKUpdateAddHTLC this_ptr_conv;
8955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8956 this_ptr_conv.is_owned = false;
8957 LDKThirtyTwoBytes val_ref;
8958 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8959 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8960 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
8963 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8964 LDKUpdateAddHTLC this_ptr_conv;
8965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8966 this_ptr_conv.is_owned = false;
8967 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
8971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8972 LDKUpdateAddHTLC this_ptr_conv;
8973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8974 this_ptr_conv.is_owned = false;
8975 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
8978 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8979 LDKUpdateAddHTLC this_ptr_conv;
8980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8981 this_ptr_conv.is_owned = false;
8982 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
8986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8987 LDKUpdateAddHTLC this_ptr_conv;
8988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8989 this_ptr_conv.is_owned = false;
8990 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
8993 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8994 LDKUpdateAddHTLC this_ptr_conv;
8995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8996 this_ptr_conv.is_owned = false;
8997 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8998 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
9002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9003 LDKUpdateAddHTLC this_ptr_conv;
9004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9005 this_ptr_conv.is_owned = false;
9006 LDKThirtyTwoBytes val_ref;
9007 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9008 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9009 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
9012 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
9013 LDKUpdateAddHTLC this_ptr_conv;
9014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9015 this_ptr_conv.is_owned = false;
9016 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
9020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9021 LDKUpdateAddHTLC this_ptr_conv;
9022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9023 this_ptr_conv.is_owned = false;
9024 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
9027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9028 LDKUpdateFulfillHTLC this_ptr_conv;
9029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9030 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9031 UpdateFulfillHTLC_free(this_ptr_conv);
9034 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9035 LDKUpdateFulfillHTLC orig_conv;
9036 orig_conv.inner = (void*)(orig & (~1));
9037 orig_conv.is_owned = false;
9038 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
9039 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9040 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9041 long ret_ref = (long)ret_var.inner;
9042 if (ret_var.is_owned) {
9048 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9049 LDKUpdateFulfillHTLC this_ptr_conv;
9050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9051 this_ptr_conv.is_owned = false;
9052 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9053 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
9057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9058 LDKUpdateFulfillHTLC this_ptr_conv;
9059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9060 this_ptr_conv.is_owned = false;
9061 LDKThirtyTwoBytes val_ref;
9062 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9063 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9064 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
9067 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9068 LDKUpdateFulfillHTLC this_ptr_conv;
9069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9070 this_ptr_conv.is_owned = false;
9071 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
9075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9076 LDKUpdateFulfillHTLC this_ptr_conv;
9077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9078 this_ptr_conv.is_owned = false;
9079 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
9082 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
9083 LDKUpdateFulfillHTLC this_ptr_conv;
9084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9085 this_ptr_conv.is_owned = false;
9086 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9087 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
9091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9092 LDKUpdateFulfillHTLC this_ptr_conv;
9093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9094 this_ptr_conv.is_owned = false;
9095 LDKThirtyTwoBytes val_ref;
9096 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9097 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9098 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
9101 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) {
9102 LDKThirtyTwoBytes channel_id_arg_ref;
9103 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9104 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9105 LDKThirtyTwoBytes payment_preimage_arg_ref;
9106 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
9107 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
9108 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
9109 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9110 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9111 long ret_ref = (long)ret_var.inner;
9112 if (ret_var.is_owned) {
9118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9119 LDKUpdateFailHTLC this_ptr_conv;
9120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9121 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9122 UpdateFailHTLC_free(this_ptr_conv);
9125 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9126 LDKUpdateFailHTLC orig_conv;
9127 orig_conv.inner = (void*)(orig & (~1));
9128 orig_conv.is_owned = false;
9129 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
9130 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9131 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9132 long ret_ref = (long)ret_var.inner;
9133 if (ret_var.is_owned) {
9139 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9140 LDKUpdateFailHTLC this_ptr_conv;
9141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9142 this_ptr_conv.is_owned = false;
9143 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9144 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
9148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9149 LDKUpdateFailHTLC this_ptr_conv;
9150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9151 this_ptr_conv.is_owned = false;
9152 LDKThirtyTwoBytes val_ref;
9153 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9154 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9155 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
9158 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9159 LDKUpdateFailHTLC this_ptr_conv;
9160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9161 this_ptr_conv.is_owned = false;
9162 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
9166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9167 LDKUpdateFailHTLC this_ptr_conv;
9168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9169 this_ptr_conv.is_owned = false;
9170 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
9173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9174 LDKUpdateFailMalformedHTLC this_ptr_conv;
9175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9176 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9177 UpdateFailMalformedHTLC_free(this_ptr_conv);
9180 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9181 LDKUpdateFailMalformedHTLC orig_conv;
9182 orig_conv.inner = (void*)(orig & (~1));
9183 orig_conv.is_owned = false;
9184 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
9185 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9186 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9187 long ret_ref = (long)ret_var.inner;
9188 if (ret_var.is_owned) {
9194 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9195 LDKUpdateFailMalformedHTLC this_ptr_conv;
9196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9197 this_ptr_conv.is_owned = false;
9198 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9199 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
9203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9204 LDKUpdateFailMalformedHTLC this_ptr_conv;
9205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9206 this_ptr_conv.is_owned = false;
9207 LDKThirtyTwoBytes val_ref;
9208 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9209 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9210 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
9213 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9214 LDKUpdateFailMalformedHTLC this_ptr_conv;
9215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9216 this_ptr_conv.is_owned = false;
9217 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
9221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9222 LDKUpdateFailMalformedHTLC this_ptr_conv;
9223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9224 this_ptr_conv.is_owned = false;
9225 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
9228 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
9229 LDKUpdateFailMalformedHTLC this_ptr_conv;
9230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9231 this_ptr_conv.is_owned = false;
9232 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
9236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9237 LDKUpdateFailMalformedHTLC this_ptr_conv;
9238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9239 this_ptr_conv.is_owned = false;
9240 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
9243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9244 LDKCommitmentSigned this_ptr_conv;
9245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9246 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9247 CommitmentSigned_free(this_ptr_conv);
9250 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9251 LDKCommitmentSigned orig_conv;
9252 orig_conv.inner = (void*)(orig & (~1));
9253 orig_conv.is_owned = false;
9254 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
9255 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9256 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9257 long ret_ref = (long)ret_var.inner;
9258 if (ret_var.is_owned) {
9264 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9265 LDKCommitmentSigned this_ptr_conv;
9266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9267 this_ptr_conv.is_owned = false;
9268 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9269 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
9273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9274 LDKCommitmentSigned this_ptr_conv;
9275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9276 this_ptr_conv.is_owned = false;
9277 LDKThirtyTwoBytes val_ref;
9278 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9279 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9280 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
9283 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9284 LDKCommitmentSigned this_ptr_conv;
9285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9286 this_ptr_conv.is_owned = false;
9287 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9288 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
9292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9293 LDKCommitmentSigned this_ptr_conv;
9294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9295 this_ptr_conv.is_owned = false;
9296 LDKSignature val_ref;
9297 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9298 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9299 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
9302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
9303 LDKCommitmentSigned this_ptr_conv;
9304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9305 this_ptr_conv.is_owned = false;
9306 LDKCVec_SignatureZ val_constr;
9307 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9308 if (val_constr.datalen > 0)
9309 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9311 val_constr.data = NULL;
9312 for (size_t i = 0; i < val_constr.datalen; i++) {
9313 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, 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 val_constr.data[i] = arr_conv_8_ref;
9319 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
9322 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) {
9323 LDKThirtyTwoBytes channel_id_arg_ref;
9324 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9325 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9326 LDKSignature signature_arg_ref;
9327 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9328 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9329 LDKCVec_SignatureZ htlc_signatures_arg_constr;
9330 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
9331 if (htlc_signatures_arg_constr.datalen > 0)
9332 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9334 htlc_signatures_arg_constr.data = NULL;
9335 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
9336 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
9337 LDKSignature arr_conv_8_ref;
9338 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9339 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9340 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
9342 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
9343 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9344 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9345 long ret_ref = (long)ret_var.inner;
9346 if (ret_var.is_owned) {
9352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9353 LDKRevokeAndACK this_ptr_conv;
9354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9355 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9356 RevokeAndACK_free(this_ptr_conv);
9359 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9360 LDKRevokeAndACK orig_conv;
9361 orig_conv.inner = (void*)(orig & (~1));
9362 orig_conv.is_owned = false;
9363 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
9364 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9365 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9366 long ret_ref = (long)ret_var.inner;
9367 if (ret_var.is_owned) {
9373 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9374 LDKRevokeAndACK this_ptr_conv;
9375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9376 this_ptr_conv.is_owned = false;
9377 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9378 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
9382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9383 LDKRevokeAndACK this_ptr_conv;
9384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9385 this_ptr_conv.is_owned = false;
9386 LDKThirtyTwoBytes val_ref;
9387 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9388 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9389 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
9392 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9393 LDKRevokeAndACK this_ptr_conv;
9394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9395 this_ptr_conv.is_owned = false;
9396 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9397 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
9401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9402 LDKRevokeAndACK this_ptr_conv;
9403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9404 this_ptr_conv.is_owned = false;
9405 LDKThirtyTwoBytes val_ref;
9406 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9407 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9408 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
9411 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9412 LDKRevokeAndACK this_ptr_conv;
9413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9414 this_ptr_conv.is_owned = false;
9415 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9416 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
9420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9421 LDKRevokeAndACK this_ptr_conv;
9422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9423 this_ptr_conv.is_owned = false;
9424 LDKPublicKey val_ref;
9425 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9426 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9427 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
9430 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) {
9431 LDKThirtyTwoBytes channel_id_arg_ref;
9432 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9433 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9434 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
9435 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
9436 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
9437 LDKPublicKey next_per_commitment_point_arg_ref;
9438 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
9439 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
9440 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
9441 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9442 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9443 long ret_ref = (long)ret_var.inner;
9444 if (ret_var.is_owned) {
9450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9451 LDKUpdateFee this_ptr_conv;
9452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9453 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9454 UpdateFee_free(this_ptr_conv);
9457 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9458 LDKUpdateFee orig_conv;
9459 orig_conv.inner = (void*)(orig & (~1));
9460 orig_conv.is_owned = false;
9461 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
9462 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9463 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9464 long ret_ref = (long)ret_var.inner;
9465 if (ret_var.is_owned) {
9471 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9472 LDKUpdateFee this_ptr_conv;
9473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9474 this_ptr_conv.is_owned = false;
9475 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9476 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
9480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9481 LDKUpdateFee this_ptr_conv;
9482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9483 this_ptr_conv.is_owned = false;
9484 LDKThirtyTwoBytes val_ref;
9485 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9486 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9487 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
9490 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
9491 LDKUpdateFee this_ptr_conv;
9492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9493 this_ptr_conv.is_owned = false;
9494 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
9498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9499 LDKUpdateFee this_ptr_conv;
9500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9501 this_ptr_conv.is_owned = false;
9502 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
9505 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
9506 LDKThirtyTwoBytes channel_id_arg_ref;
9507 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9508 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9509 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
9510 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9511 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9512 long ret_ref = (long)ret_var.inner;
9513 if (ret_var.is_owned) {
9519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9520 LDKDataLossProtect this_ptr_conv;
9521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9523 DataLossProtect_free(this_ptr_conv);
9526 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9527 LDKDataLossProtect orig_conv;
9528 orig_conv.inner = (void*)(orig & (~1));
9529 orig_conv.is_owned = false;
9530 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
9531 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9532 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9533 long ret_ref = (long)ret_var.inner;
9534 if (ret_var.is_owned) {
9540 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9541 LDKDataLossProtect this_ptr_conv;
9542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9543 this_ptr_conv.is_owned = false;
9544 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9545 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
9549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9550 LDKDataLossProtect this_ptr_conv;
9551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9552 this_ptr_conv.is_owned = false;
9553 LDKThirtyTwoBytes val_ref;
9554 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9555 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9556 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
9559 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9560 LDKDataLossProtect this_ptr_conv;
9561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9562 this_ptr_conv.is_owned = false;
9563 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9564 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
9568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9569 LDKDataLossProtect this_ptr_conv;
9570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9571 this_ptr_conv.is_owned = false;
9572 LDKPublicKey val_ref;
9573 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9574 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9575 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
9578 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) {
9579 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
9580 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
9581 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
9582 LDKPublicKey my_current_per_commitment_point_arg_ref;
9583 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
9584 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
9585 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
9586 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9587 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9588 long ret_ref = (long)ret_var.inner;
9589 if (ret_var.is_owned) {
9595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9596 LDKChannelReestablish this_ptr_conv;
9597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9599 ChannelReestablish_free(this_ptr_conv);
9602 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9603 LDKChannelReestablish orig_conv;
9604 orig_conv.inner = (void*)(orig & (~1));
9605 orig_conv.is_owned = false;
9606 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
9607 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9608 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9609 long ret_ref = (long)ret_var.inner;
9610 if (ret_var.is_owned) {
9616 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9617 LDKChannelReestablish this_ptr_conv;
9618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9619 this_ptr_conv.is_owned = false;
9620 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9621 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
9625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9626 LDKChannelReestablish this_ptr_conv;
9627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9628 this_ptr_conv.is_owned = false;
9629 LDKThirtyTwoBytes val_ref;
9630 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9631 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9632 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
9635 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9636 LDKChannelReestablish this_ptr_conv;
9637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9638 this_ptr_conv.is_owned = false;
9639 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
9643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9644 LDKChannelReestablish this_ptr_conv;
9645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9646 this_ptr_conv.is_owned = false;
9647 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
9650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9651 LDKChannelReestablish this_ptr_conv;
9652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9653 this_ptr_conv.is_owned = false;
9654 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
9658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9659 LDKChannelReestablish this_ptr_conv;
9660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9661 this_ptr_conv.is_owned = false;
9662 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
9665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9666 LDKAnnouncementSignatures this_ptr_conv;
9667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9668 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9669 AnnouncementSignatures_free(this_ptr_conv);
9672 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9673 LDKAnnouncementSignatures orig_conv;
9674 orig_conv.inner = (void*)(orig & (~1));
9675 orig_conv.is_owned = false;
9676 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
9677 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9678 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9679 long ret_ref = (long)ret_var.inner;
9680 if (ret_var.is_owned) {
9686 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9687 LDKAnnouncementSignatures this_ptr_conv;
9688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9689 this_ptr_conv.is_owned = false;
9690 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9691 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
9695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9696 LDKAnnouncementSignatures this_ptr_conv;
9697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9698 this_ptr_conv.is_owned = false;
9699 LDKThirtyTwoBytes val_ref;
9700 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9701 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9702 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
9705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9706 LDKAnnouncementSignatures this_ptr_conv;
9707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9708 this_ptr_conv.is_owned = false;
9709 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
9713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9714 LDKAnnouncementSignatures this_ptr_conv;
9715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9716 this_ptr_conv.is_owned = false;
9717 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
9720 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9721 LDKAnnouncementSignatures this_ptr_conv;
9722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9723 this_ptr_conv.is_owned = false;
9724 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9725 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
9729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9730 LDKAnnouncementSignatures this_ptr_conv;
9731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9732 this_ptr_conv.is_owned = false;
9733 LDKSignature val_ref;
9734 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9735 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9736 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
9739 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9740 LDKAnnouncementSignatures this_ptr_conv;
9741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9742 this_ptr_conv.is_owned = false;
9743 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9744 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
9748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9749 LDKAnnouncementSignatures this_ptr_conv;
9750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9751 this_ptr_conv.is_owned = false;
9752 LDKSignature val_ref;
9753 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9754 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9755 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
9758 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) {
9759 LDKThirtyTwoBytes channel_id_arg_ref;
9760 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9761 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9762 LDKSignature node_signature_arg_ref;
9763 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
9764 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
9765 LDKSignature bitcoin_signature_arg_ref;
9766 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
9767 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
9768 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
9769 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9770 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9771 long ret_ref = (long)ret_var.inner;
9772 if (ret_var.is_owned) {
9778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9779 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
9780 FREE((void*)this_ptr);
9781 NetAddress_free(this_ptr_conv);
9784 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9785 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
9786 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9787 *ret_copy = NetAddress_clone(orig_conv);
9788 long ret_ref = (long)ret_copy;
9792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9793 LDKUnsignedNodeAnnouncement this_ptr_conv;
9794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9795 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9796 UnsignedNodeAnnouncement_free(this_ptr_conv);
9799 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9800 LDKUnsignedNodeAnnouncement orig_conv;
9801 orig_conv.inner = (void*)(orig & (~1));
9802 orig_conv.is_owned = false;
9803 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
9804 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9805 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9806 long ret_ref = (long)ret_var.inner;
9807 if (ret_var.is_owned) {
9813 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9814 LDKUnsignedNodeAnnouncement this_ptr_conv;
9815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9816 this_ptr_conv.is_owned = false;
9817 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9818 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9819 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9820 long ret_ref = (long)ret_var.inner;
9821 if (ret_var.is_owned) {
9827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9828 LDKUnsignedNodeAnnouncement this_ptr_conv;
9829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9830 this_ptr_conv.is_owned = false;
9831 LDKNodeFeatures val_conv;
9832 val_conv.inner = (void*)(val & (~1));
9833 val_conv.is_owned = (val & 1) || (val == 0);
9834 // Warning: we may need a move here but can't clone!
9835 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9838 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9839 LDKUnsignedNodeAnnouncement this_ptr_conv;
9840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9841 this_ptr_conv.is_owned = false;
9842 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9847 LDKUnsignedNodeAnnouncement this_ptr_conv;
9848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9849 this_ptr_conv.is_owned = false;
9850 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9853 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9854 LDKUnsignedNodeAnnouncement this_ptr_conv;
9855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9856 this_ptr_conv.is_owned = false;
9857 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9858 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
9862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9863 LDKUnsignedNodeAnnouncement this_ptr_conv;
9864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9865 this_ptr_conv.is_owned = false;
9866 LDKPublicKey val_ref;
9867 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9868 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9869 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
9872 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
9873 LDKUnsignedNodeAnnouncement this_ptr_conv;
9874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9875 this_ptr_conv.is_owned = false;
9876 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
9877 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
9881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9882 LDKUnsignedNodeAnnouncement this_ptr_conv;
9883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9884 this_ptr_conv.is_owned = false;
9885 LDKThreeBytes val_ref;
9886 CHECK((*_env)->GetArrayLength (_env, val) == 3);
9887 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
9888 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
9891 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
9892 LDKUnsignedNodeAnnouncement this_ptr_conv;
9893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9894 this_ptr_conv.is_owned = false;
9895 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9896 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
9900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9901 LDKUnsignedNodeAnnouncement this_ptr_conv;
9902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9903 this_ptr_conv.is_owned = false;
9904 LDKThirtyTwoBytes val_ref;
9905 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9906 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9907 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
9910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9911 LDKUnsignedNodeAnnouncement this_ptr_conv;
9912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9913 this_ptr_conv.is_owned = false;
9914 LDKCVec_NetAddressZ val_constr;
9915 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9916 if (val_constr.datalen > 0)
9917 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9919 val_constr.data = NULL;
9920 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9921 for (size_t m = 0; m < val_constr.datalen; m++) {
9922 long arr_conv_12 = val_vals[m];
9923 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9924 FREE((void*)arr_conv_12);
9925 val_constr.data[m] = arr_conv_12_conv;
9927 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9928 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
9931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9932 LDKNodeAnnouncement this_ptr_conv;
9933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9934 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9935 NodeAnnouncement_free(this_ptr_conv);
9938 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9939 LDKNodeAnnouncement orig_conv;
9940 orig_conv.inner = (void*)(orig & (~1));
9941 orig_conv.is_owned = false;
9942 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
9943 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9944 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9945 long ret_ref = (long)ret_var.inner;
9946 if (ret_var.is_owned) {
9952 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9953 LDKNodeAnnouncement this_ptr_conv;
9954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9955 this_ptr_conv.is_owned = false;
9956 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9957 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
9961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9962 LDKNodeAnnouncement this_ptr_conv;
9963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9964 this_ptr_conv.is_owned = false;
9965 LDKSignature val_ref;
9966 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9967 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9968 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
9971 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9972 LDKNodeAnnouncement this_ptr_conv;
9973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9974 this_ptr_conv.is_owned = false;
9975 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
9976 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9977 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9978 long ret_ref = (long)ret_var.inner;
9979 if (ret_var.is_owned) {
9985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9986 LDKNodeAnnouncement this_ptr_conv;
9987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9988 this_ptr_conv.is_owned = false;
9989 LDKUnsignedNodeAnnouncement val_conv;
9990 val_conv.inner = (void*)(val & (~1));
9991 val_conv.is_owned = (val & 1) || (val == 0);
9992 if (val_conv.inner != NULL)
9993 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
9994 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
9997 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9998 LDKSignature signature_arg_ref;
9999 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10000 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10001 LDKUnsignedNodeAnnouncement contents_arg_conv;
10002 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10003 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10004 if (contents_arg_conv.inner != NULL)
10005 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
10006 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
10007 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10008 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10009 long ret_ref = (long)ret_var.inner;
10010 if (ret_var.is_owned) {
10016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10017 LDKUnsignedChannelAnnouncement this_ptr_conv;
10018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10019 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10020 UnsignedChannelAnnouncement_free(this_ptr_conv);
10023 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10024 LDKUnsignedChannelAnnouncement orig_conv;
10025 orig_conv.inner = (void*)(orig & (~1));
10026 orig_conv.is_owned = false;
10027 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
10028 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10029 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10030 long ret_ref = (long)ret_var.inner;
10031 if (ret_var.is_owned) {
10037 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10038 LDKUnsignedChannelAnnouncement this_ptr_conv;
10039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10040 this_ptr_conv.is_owned = false;
10041 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
10042 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10043 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10044 long ret_ref = (long)ret_var.inner;
10045 if (ret_var.is_owned) {
10051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10052 LDKUnsignedChannelAnnouncement this_ptr_conv;
10053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10054 this_ptr_conv.is_owned = false;
10055 LDKChannelFeatures val_conv;
10056 val_conv.inner = (void*)(val & (~1));
10057 val_conv.is_owned = (val & 1) || (val == 0);
10058 // Warning: we may need a move here but can't clone!
10059 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
10062 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10063 LDKUnsignedChannelAnnouncement this_ptr_conv;
10064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10065 this_ptr_conv.is_owned = false;
10066 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10067 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
10071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10072 LDKUnsignedChannelAnnouncement this_ptr_conv;
10073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10074 this_ptr_conv.is_owned = false;
10075 LDKThirtyTwoBytes val_ref;
10076 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10077 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10078 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
10081 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10082 LDKUnsignedChannelAnnouncement this_ptr_conv;
10083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10084 this_ptr_conv.is_owned = false;
10085 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
10089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10090 LDKUnsignedChannelAnnouncement this_ptr_conv;
10091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10092 this_ptr_conv.is_owned = false;
10093 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
10096 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10097 LDKUnsignedChannelAnnouncement this_ptr_conv;
10098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10099 this_ptr_conv.is_owned = false;
10100 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10101 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
10105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10106 LDKUnsignedChannelAnnouncement this_ptr_conv;
10107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10108 this_ptr_conv.is_owned = false;
10109 LDKPublicKey val_ref;
10110 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10111 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10112 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
10115 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10116 LDKUnsignedChannelAnnouncement this_ptr_conv;
10117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10118 this_ptr_conv.is_owned = false;
10119 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10120 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
10124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10125 LDKUnsignedChannelAnnouncement this_ptr_conv;
10126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10127 this_ptr_conv.is_owned = false;
10128 LDKPublicKey val_ref;
10129 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10130 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10131 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
10134 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10135 LDKUnsignedChannelAnnouncement this_ptr_conv;
10136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10137 this_ptr_conv.is_owned = false;
10138 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10139 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
10143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10144 LDKUnsignedChannelAnnouncement this_ptr_conv;
10145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10146 this_ptr_conv.is_owned = false;
10147 LDKPublicKey val_ref;
10148 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10149 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10150 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
10153 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10154 LDKUnsignedChannelAnnouncement this_ptr_conv;
10155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10156 this_ptr_conv.is_owned = false;
10157 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10158 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
10162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10163 LDKUnsignedChannelAnnouncement this_ptr_conv;
10164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10165 this_ptr_conv.is_owned = false;
10166 LDKPublicKey val_ref;
10167 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10168 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10169 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
10172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10173 LDKChannelAnnouncement this_ptr_conv;
10174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10175 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10176 ChannelAnnouncement_free(this_ptr_conv);
10179 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10180 LDKChannelAnnouncement orig_conv;
10181 orig_conv.inner = (void*)(orig & (~1));
10182 orig_conv.is_owned = false;
10183 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
10184 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10185 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10186 long ret_ref = (long)ret_var.inner;
10187 if (ret_var.is_owned) {
10193 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10194 LDKChannelAnnouncement this_ptr_conv;
10195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10196 this_ptr_conv.is_owned = false;
10197 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10198 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
10202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10203 LDKChannelAnnouncement this_ptr_conv;
10204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10205 this_ptr_conv.is_owned = false;
10206 LDKSignature val_ref;
10207 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10208 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10209 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
10212 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10213 LDKChannelAnnouncement this_ptr_conv;
10214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10215 this_ptr_conv.is_owned = false;
10216 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10217 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
10221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10222 LDKChannelAnnouncement this_ptr_conv;
10223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10224 this_ptr_conv.is_owned = false;
10225 LDKSignature val_ref;
10226 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10227 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10228 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
10231 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10232 LDKChannelAnnouncement this_ptr_conv;
10233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10234 this_ptr_conv.is_owned = false;
10235 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10236 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
10240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10241 LDKChannelAnnouncement this_ptr_conv;
10242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10243 this_ptr_conv.is_owned = false;
10244 LDKSignature val_ref;
10245 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10246 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10247 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
10250 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10251 LDKChannelAnnouncement this_ptr_conv;
10252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10253 this_ptr_conv.is_owned = false;
10254 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10255 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
10259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10260 LDKChannelAnnouncement this_ptr_conv;
10261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10262 this_ptr_conv.is_owned = false;
10263 LDKSignature val_ref;
10264 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10265 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10266 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
10269 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10270 LDKChannelAnnouncement this_ptr_conv;
10271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10272 this_ptr_conv.is_owned = false;
10273 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
10274 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10275 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10276 long ret_ref = (long)ret_var.inner;
10277 if (ret_var.is_owned) {
10283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10284 LDKChannelAnnouncement this_ptr_conv;
10285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10286 this_ptr_conv.is_owned = false;
10287 LDKUnsignedChannelAnnouncement val_conv;
10288 val_conv.inner = (void*)(val & (~1));
10289 val_conv.is_owned = (val & 1) || (val == 0);
10290 if (val_conv.inner != NULL)
10291 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
10292 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
10295 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) {
10296 LDKSignature node_signature_1_arg_ref;
10297 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
10298 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
10299 LDKSignature node_signature_2_arg_ref;
10300 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
10301 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
10302 LDKSignature bitcoin_signature_1_arg_ref;
10303 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
10304 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
10305 LDKSignature bitcoin_signature_2_arg_ref;
10306 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
10307 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
10308 LDKUnsignedChannelAnnouncement contents_arg_conv;
10309 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10310 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10311 if (contents_arg_conv.inner != NULL)
10312 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
10313 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);
10314 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10315 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10316 long ret_ref = (long)ret_var.inner;
10317 if (ret_var.is_owned) {
10323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10324 LDKUnsignedChannelUpdate this_ptr_conv;
10325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10326 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10327 UnsignedChannelUpdate_free(this_ptr_conv);
10330 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10331 LDKUnsignedChannelUpdate orig_conv;
10332 orig_conv.inner = (void*)(orig & (~1));
10333 orig_conv.is_owned = false;
10334 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
10335 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10336 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10337 long ret_ref = (long)ret_var.inner;
10338 if (ret_var.is_owned) {
10344 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10345 LDKUnsignedChannelUpdate this_ptr_conv;
10346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10347 this_ptr_conv.is_owned = false;
10348 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10349 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
10353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10354 LDKUnsignedChannelUpdate this_ptr_conv;
10355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10356 this_ptr_conv.is_owned = false;
10357 LDKThirtyTwoBytes val_ref;
10358 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10359 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10360 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
10363 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10364 LDKUnsignedChannelUpdate this_ptr_conv;
10365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10366 this_ptr_conv.is_owned = false;
10367 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
10371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10372 LDKUnsignedChannelUpdate this_ptr_conv;
10373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10374 this_ptr_conv.is_owned = false;
10375 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
10378 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10379 LDKUnsignedChannelUpdate this_ptr_conv;
10380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10381 this_ptr_conv.is_owned = false;
10382 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
10386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10387 LDKUnsignedChannelUpdate this_ptr_conv;
10388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10389 this_ptr_conv.is_owned = false;
10390 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
10393 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
10394 LDKUnsignedChannelUpdate this_ptr_conv;
10395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10396 this_ptr_conv.is_owned = false;
10397 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
10401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
10402 LDKUnsignedChannelUpdate this_ptr_conv;
10403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10404 this_ptr_conv.is_owned = false;
10405 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
10408 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10409 LDKUnsignedChannelUpdate this_ptr_conv;
10410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10411 this_ptr_conv.is_owned = false;
10412 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
10416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10417 LDKUnsignedChannelUpdate this_ptr_conv;
10418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10419 this_ptr_conv.is_owned = false;
10420 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
10423 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10424 LDKUnsignedChannelUpdate this_ptr_conv;
10425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10426 this_ptr_conv.is_owned = false;
10427 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
10431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10432 LDKUnsignedChannelUpdate this_ptr_conv;
10433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10434 this_ptr_conv.is_owned = false;
10435 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
10438 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10439 LDKUnsignedChannelUpdate this_ptr_conv;
10440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10441 this_ptr_conv.is_owned = false;
10442 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
10446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10447 LDKUnsignedChannelUpdate this_ptr_conv;
10448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10449 this_ptr_conv.is_owned = false;
10450 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
10453 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
10454 LDKUnsignedChannelUpdate this_ptr_conv;
10455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10456 this_ptr_conv.is_owned = false;
10457 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
10461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10462 LDKUnsignedChannelUpdate this_ptr_conv;
10463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10464 this_ptr_conv.is_owned = false;
10465 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
10468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10469 LDKChannelUpdate this_ptr_conv;
10470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10471 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10472 ChannelUpdate_free(this_ptr_conv);
10475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10476 LDKChannelUpdate orig_conv;
10477 orig_conv.inner = (void*)(orig & (~1));
10478 orig_conv.is_owned = false;
10479 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
10480 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10481 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10482 long ret_ref = (long)ret_var.inner;
10483 if (ret_var.is_owned) {
10489 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10490 LDKChannelUpdate this_ptr_conv;
10491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10492 this_ptr_conv.is_owned = false;
10493 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10494 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
10498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10499 LDKChannelUpdate this_ptr_conv;
10500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10501 this_ptr_conv.is_owned = false;
10502 LDKSignature val_ref;
10503 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10504 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10505 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
10508 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10509 LDKChannelUpdate this_ptr_conv;
10510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10511 this_ptr_conv.is_owned = false;
10512 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
10513 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10514 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10515 long ret_ref = (long)ret_var.inner;
10516 if (ret_var.is_owned) {
10522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10523 LDKChannelUpdate this_ptr_conv;
10524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10525 this_ptr_conv.is_owned = false;
10526 LDKUnsignedChannelUpdate val_conv;
10527 val_conv.inner = (void*)(val & (~1));
10528 val_conv.is_owned = (val & 1) || (val == 0);
10529 if (val_conv.inner != NULL)
10530 val_conv = UnsignedChannelUpdate_clone(&val_conv);
10531 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
10534 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
10535 LDKSignature signature_arg_ref;
10536 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10537 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10538 LDKUnsignedChannelUpdate contents_arg_conv;
10539 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10540 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10541 if (contents_arg_conv.inner != NULL)
10542 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
10543 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
10544 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10545 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10546 long ret_ref = (long)ret_var.inner;
10547 if (ret_var.is_owned) {
10553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10554 LDKQueryChannelRange this_ptr_conv;
10555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10556 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10557 QueryChannelRange_free(this_ptr_conv);
10560 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10561 LDKQueryChannelRange orig_conv;
10562 orig_conv.inner = (void*)(orig & (~1));
10563 orig_conv.is_owned = false;
10564 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
10565 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10566 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10567 long ret_ref = (long)ret_var.inner;
10568 if (ret_var.is_owned) {
10574 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10575 LDKQueryChannelRange this_ptr_conv;
10576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10577 this_ptr_conv.is_owned = false;
10578 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10579 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
10583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10584 LDKQueryChannelRange this_ptr_conv;
10585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10586 this_ptr_conv.is_owned = false;
10587 LDKThirtyTwoBytes val_ref;
10588 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10589 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10590 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10593 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10594 LDKQueryChannelRange this_ptr_conv;
10595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10596 this_ptr_conv.is_owned = false;
10597 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
10601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10602 LDKQueryChannelRange this_ptr_conv;
10603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10604 this_ptr_conv.is_owned = false;
10605 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
10608 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10609 LDKQueryChannelRange this_ptr_conv;
10610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10611 this_ptr_conv.is_owned = false;
10612 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
10616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10617 LDKQueryChannelRange this_ptr_conv;
10618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10619 this_ptr_conv.is_owned = false;
10620 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10623 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) {
10624 LDKThirtyTwoBytes chain_hash_arg_ref;
10625 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10626 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10627 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
10628 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10629 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10630 long ret_ref = (long)ret_var.inner;
10631 if (ret_var.is_owned) {
10637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10638 LDKReplyChannelRange this_ptr_conv;
10639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10640 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10641 ReplyChannelRange_free(this_ptr_conv);
10644 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10645 LDKReplyChannelRange orig_conv;
10646 orig_conv.inner = (void*)(orig & (~1));
10647 orig_conv.is_owned = false;
10648 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
10649 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10650 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10651 long ret_ref = (long)ret_var.inner;
10652 if (ret_var.is_owned) {
10658 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10659 LDKReplyChannelRange this_ptr_conv;
10660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10661 this_ptr_conv.is_owned = false;
10662 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10663 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
10667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10668 LDKReplyChannelRange this_ptr_conv;
10669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10670 this_ptr_conv.is_owned = false;
10671 LDKThirtyTwoBytes val_ref;
10672 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10673 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10674 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10677 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10678 LDKReplyChannelRange this_ptr_conv;
10679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10680 this_ptr_conv.is_owned = false;
10681 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
10685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10686 LDKReplyChannelRange this_ptr_conv;
10687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10688 this_ptr_conv.is_owned = false;
10689 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
10692 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10693 LDKReplyChannelRange this_ptr_conv;
10694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10695 this_ptr_conv.is_owned = false;
10696 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
10700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10701 LDKReplyChannelRange this_ptr_conv;
10702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10703 this_ptr_conv.is_owned = false;
10704 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10707 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10708 LDKReplyChannelRange this_ptr_conv;
10709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10710 this_ptr_conv.is_owned = false;
10711 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
10715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10716 LDKReplyChannelRange this_ptr_conv;
10717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10718 this_ptr_conv.is_owned = false;
10719 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
10722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10723 LDKReplyChannelRange this_ptr_conv;
10724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10725 this_ptr_conv.is_owned = false;
10726 LDKCVec_u64Z val_constr;
10727 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10728 if (val_constr.datalen > 0)
10729 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10731 val_constr.data = NULL;
10732 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10733 for (size_t g = 0; g < val_constr.datalen; g++) {
10734 long arr_conv_6 = val_vals[g];
10735 val_constr.data[g] = arr_conv_6;
10737 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10738 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
10741 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) {
10742 LDKThirtyTwoBytes chain_hash_arg_ref;
10743 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10744 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10745 LDKCVec_u64Z short_channel_ids_arg_constr;
10746 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10747 if (short_channel_ids_arg_constr.datalen > 0)
10748 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10750 short_channel_ids_arg_constr.data = NULL;
10751 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10752 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10753 long arr_conv_6 = short_channel_ids_arg_vals[g];
10754 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10756 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10757 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
10758 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10759 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10760 long ret_ref = (long)ret_var.inner;
10761 if (ret_var.is_owned) {
10767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10768 LDKQueryShortChannelIds this_ptr_conv;
10769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10770 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10771 QueryShortChannelIds_free(this_ptr_conv);
10774 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10775 LDKQueryShortChannelIds orig_conv;
10776 orig_conv.inner = (void*)(orig & (~1));
10777 orig_conv.is_owned = false;
10778 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
10779 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10780 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10781 long ret_ref = (long)ret_var.inner;
10782 if (ret_var.is_owned) {
10788 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10789 LDKQueryShortChannelIds this_ptr_conv;
10790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10791 this_ptr_conv.is_owned = false;
10792 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10793 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
10797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10798 LDKQueryShortChannelIds this_ptr_conv;
10799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10800 this_ptr_conv.is_owned = false;
10801 LDKThirtyTwoBytes val_ref;
10802 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10803 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10804 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
10807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10808 LDKQueryShortChannelIds this_ptr_conv;
10809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10810 this_ptr_conv.is_owned = false;
10811 LDKCVec_u64Z val_constr;
10812 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10813 if (val_constr.datalen > 0)
10814 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10816 val_constr.data = NULL;
10817 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10818 for (size_t g = 0; g < val_constr.datalen; g++) {
10819 long arr_conv_6 = val_vals[g];
10820 val_constr.data[g] = arr_conv_6;
10822 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10823 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
10826 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
10827 LDKThirtyTwoBytes chain_hash_arg_ref;
10828 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10829 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10830 LDKCVec_u64Z short_channel_ids_arg_constr;
10831 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10832 if (short_channel_ids_arg_constr.datalen > 0)
10833 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10835 short_channel_ids_arg_constr.data = NULL;
10836 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10837 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10838 long arr_conv_6 = short_channel_ids_arg_vals[g];
10839 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10841 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10842 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
10843 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10844 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10845 long ret_ref = (long)ret_var.inner;
10846 if (ret_var.is_owned) {
10852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10853 LDKReplyShortChannelIdsEnd this_ptr_conv;
10854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10855 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10856 ReplyShortChannelIdsEnd_free(this_ptr_conv);
10859 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10860 LDKReplyShortChannelIdsEnd orig_conv;
10861 orig_conv.inner = (void*)(orig & (~1));
10862 orig_conv.is_owned = false;
10863 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
10864 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10865 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10866 long ret_ref = (long)ret_var.inner;
10867 if (ret_var.is_owned) {
10873 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10874 LDKReplyShortChannelIdsEnd this_ptr_conv;
10875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10876 this_ptr_conv.is_owned = false;
10877 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10878 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
10882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10883 LDKReplyShortChannelIdsEnd this_ptr_conv;
10884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10885 this_ptr_conv.is_owned = false;
10886 LDKThirtyTwoBytes val_ref;
10887 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10888 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10889 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
10892 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10893 LDKReplyShortChannelIdsEnd this_ptr_conv;
10894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10895 this_ptr_conv.is_owned = false;
10896 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
10900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10901 LDKReplyShortChannelIdsEnd this_ptr_conv;
10902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10903 this_ptr_conv.is_owned = false;
10904 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
10907 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
10908 LDKThirtyTwoBytes chain_hash_arg_ref;
10909 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10910 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10911 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
10912 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10913 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10914 long ret_ref = (long)ret_var.inner;
10915 if (ret_var.is_owned) {
10921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10922 LDKGossipTimestampFilter this_ptr_conv;
10923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10924 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10925 GossipTimestampFilter_free(this_ptr_conv);
10928 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10929 LDKGossipTimestampFilter orig_conv;
10930 orig_conv.inner = (void*)(orig & (~1));
10931 orig_conv.is_owned = false;
10932 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
10933 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10934 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10935 long ret_ref = (long)ret_var.inner;
10936 if (ret_var.is_owned) {
10942 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10943 LDKGossipTimestampFilter this_ptr_conv;
10944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10945 this_ptr_conv.is_owned = false;
10946 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10947 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
10951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10952 LDKGossipTimestampFilter this_ptr_conv;
10953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10954 this_ptr_conv.is_owned = false;
10955 LDKThirtyTwoBytes val_ref;
10956 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10957 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10958 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
10961 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10962 LDKGossipTimestampFilter this_ptr_conv;
10963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10964 this_ptr_conv.is_owned = false;
10965 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
10969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10970 LDKGossipTimestampFilter this_ptr_conv;
10971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10972 this_ptr_conv.is_owned = false;
10973 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
10976 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
10977 LDKGossipTimestampFilter this_ptr_conv;
10978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10979 this_ptr_conv.is_owned = false;
10980 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
10984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10985 LDKGossipTimestampFilter this_ptr_conv;
10986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10987 this_ptr_conv.is_owned = false;
10988 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
10991 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) {
10992 LDKThirtyTwoBytes chain_hash_arg_ref;
10993 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10994 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10995 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
10996 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10997 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10998 long ret_ref = (long)ret_var.inner;
10999 if (ret_var.is_owned) {
11005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11006 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
11007 FREE((void*)this_ptr);
11008 ErrorAction_free(this_ptr_conv);
11011 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11012 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
11013 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
11014 *ret_copy = ErrorAction_clone(orig_conv);
11015 long ret_ref = (long)ret_copy;
11019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11020 LDKLightningError this_ptr_conv;
11021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11022 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11023 LightningError_free(this_ptr_conv);
11026 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
11027 LDKLightningError this_ptr_conv;
11028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11029 this_ptr_conv.is_owned = false;
11030 LDKStr _str = LightningError_get_err(&this_ptr_conv);
11031 char* _buf = MALLOC(_str.len + 1, "str conv buf");
11032 memcpy(_buf, _str.chars, _str.len);
11033 _buf[_str.len] = 0;
11034 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
11039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11040 LDKLightningError this_ptr_conv;
11041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11042 this_ptr_conv.is_owned = false;
11043 LDKCVec_u8Z val_ref;
11044 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
11045 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
11046 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
11047 LightningError_set_err(&this_ptr_conv, val_ref);
11050 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
11051 LDKLightningError this_ptr_conv;
11052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11053 this_ptr_conv.is_owned = false;
11054 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
11055 *ret_copy = LightningError_get_action(&this_ptr_conv);
11056 long ret_ref = (long)ret_copy;
11060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11061 LDKLightningError this_ptr_conv;
11062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11063 this_ptr_conv.is_owned = false;
11064 LDKErrorAction val_conv = *(LDKErrorAction*)val;
11066 LightningError_set_action(&this_ptr_conv, val_conv);
11069 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
11070 LDKCVec_u8Z err_arg_ref;
11071 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
11072 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
11073 (*_env)->GetByteArrayRegion(_env, err_arg, 0, err_arg_ref.datalen, err_arg_ref.data);
11074 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
11075 FREE((void*)action_arg);
11076 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
11077 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11078 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11079 long ret_ref = (long)ret_var.inner;
11080 if (ret_var.is_owned) {
11086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11087 LDKCommitmentUpdate this_ptr_conv;
11088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11089 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11090 CommitmentUpdate_free(this_ptr_conv);
11093 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11094 LDKCommitmentUpdate orig_conv;
11095 orig_conv.inner = (void*)(orig & (~1));
11096 orig_conv.is_owned = false;
11097 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
11098 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11099 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11100 long ret_ref = (long)ret_var.inner;
11101 if (ret_var.is_owned) {
11107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11108 LDKCommitmentUpdate this_ptr_conv;
11109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11110 this_ptr_conv.is_owned = false;
11111 LDKCVec_UpdateAddHTLCZ val_constr;
11112 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11113 if (val_constr.datalen > 0)
11114 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11116 val_constr.data = NULL;
11117 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11118 for (size_t p = 0; p < val_constr.datalen; p++) {
11119 long arr_conv_15 = val_vals[p];
11120 LDKUpdateAddHTLC arr_conv_15_conv;
11121 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11122 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11123 if (arr_conv_15_conv.inner != NULL)
11124 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11125 val_constr.data[p] = arr_conv_15_conv;
11127 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11128 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
11131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11132 LDKCommitmentUpdate this_ptr_conv;
11133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11134 this_ptr_conv.is_owned = false;
11135 LDKCVec_UpdateFulfillHTLCZ val_constr;
11136 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11137 if (val_constr.datalen > 0)
11138 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11140 val_constr.data = NULL;
11141 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11142 for (size_t t = 0; t < val_constr.datalen; t++) {
11143 long arr_conv_19 = val_vals[t];
11144 LDKUpdateFulfillHTLC arr_conv_19_conv;
11145 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11146 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11147 if (arr_conv_19_conv.inner != NULL)
11148 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11149 val_constr.data[t] = arr_conv_19_conv;
11151 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11152 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
11155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11156 LDKCommitmentUpdate this_ptr_conv;
11157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11158 this_ptr_conv.is_owned = false;
11159 LDKCVec_UpdateFailHTLCZ val_constr;
11160 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11161 if (val_constr.datalen > 0)
11162 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11164 val_constr.data = NULL;
11165 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11166 for (size_t q = 0; q < val_constr.datalen; q++) {
11167 long arr_conv_16 = val_vals[q];
11168 LDKUpdateFailHTLC arr_conv_16_conv;
11169 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11170 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11171 if (arr_conv_16_conv.inner != NULL)
11172 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11173 val_constr.data[q] = arr_conv_16_conv;
11175 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11176 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
11179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11180 LDKCommitmentUpdate this_ptr_conv;
11181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11182 this_ptr_conv.is_owned = false;
11183 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
11184 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11185 if (val_constr.datalen > 0)
11186 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11188 val_constr.data = NULL;
11189 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11190 for (size_t z = 0; z < val_constr.datalen; z++) {
11191 long arr_conv_25 = val_vals[z];
11192 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11193 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11194 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11195 if (arr_conv_25_conv.inner != NULL)
11196 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11197 val_constr.data[z] = arr_conv_25_conv;
11199 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11200 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
11203 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
11204 LDKCommitmentUpdate this_ptr_conv;
11205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11206 this_ptr_conv.is_owned = false;
11207 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
11208 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11209 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11210 long ret_ref = (long)ret_var.inner;
11211 if (ret_var.is_owned) {
11217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11218 LDKCommitmentUpdate this_ptr_conv;
11219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11220 this_ptr_conv.is_owned = false;
11221 LDKUpdateFee val_conv;
11222 val_conv.inner = (void*)(val & (~1));
11223 val_conv.is_owned = (val & 1) || (val == 0);
11224 if (val_conv.inner != NULL)
11225 val_conv = UpdateFee_clone(&val_conv);
11226 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
11229 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
11230 LDKCommitmentUpdate this_ptr_conv;
11231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11232 this_ptr_conv.is_owned = false;
11233 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
11234 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11235 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11236 long ret_ref = (long)ret_var.inner;
11237 if (ret_var.is_owned) {
11243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11244 LDKCommitmentUpdate this_ptr_conv;
11245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11246 this_ptr_conv.is_owned = false;
11247 LDKCommitmentSigned val_conv;
11248 val_conv.inner = (void*)(val & (~1));
11249 val_conv.is_owned = (val & 1) || (val == 0);
11250 if (val_conv.inner != NULL)
11251 val_conv = CommitmentSigned_clone(&val_conv);
11252 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
11255 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) {
11256 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
11257 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
11258 if (update_add_htlcs_arg_constr.datalen > 0)
11259 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11261 update_add_htlcs_arg_constr.data = NULL;
11262 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
11263 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
11264 long arr_conv_15 = update_add_htlcs_arg_vals[p];
11265 LDKUpdateAddHTLC arr_conv_15_conv;
11266 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11267 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11268 if (arr_conv_15_conv.inner != NULL)
11269 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11270 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
11272 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
11273 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
11274 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
11275 if (update_fulfill_htlcs_arg_constr.datalen > 0)
11276 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11278 update_fulfill_htlcs_arg_constr.data = NULL;
11279 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
11280 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
11281 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
11282 LDKUpdateFulfillHTLC arr_conv_19_conv;
11283 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11284 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11285 if (arr_conv_19_conv.inner != NULL)
11286 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11287 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
11289 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
11290 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
11291 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
11292 if (update_fail_htlcs_arg_constr.datalen > 0)
11293 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11295 update_fail_htlcs_arg_constr.data = NULL;
11296 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
11297 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
11298 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
11299 LDKUpdateFailHTLC arr_conv_16_conv;
11300 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11301 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11302 if (arr_conv_16_conv.inner != NULL)
11303 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11304 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
11306 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
11307 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
11308 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
11309 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
11310 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11312 update_fail_malformed_htlcs_arg_constr.data = NULL;
11313 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
11314 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
11315 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
11316 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11317 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11318 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11319 if (arr_conv_25_conv.inner != NULL)
11320 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11321 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
11323 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
11324 LDKUpdateFee update_fee_arg_conv;
11325 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
11326 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
11327 if (update_fee_arg_conv.inner != NULL)
11328 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
11329 LDKCommitmentSigned commitment_signed_arg_conv;
11330 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
11331 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
11332 if (commitment_signed_arg_conv.inner != NULL)
11333 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
11334 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);
11335 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11336 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11337 long ret_ref = (long)ret_var.inner;
11338 if (ret_var.is_owned) {
11344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11345 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
11346 FREE((void*)this_ptr);
11347 HTLCFailChannelUpdate_free(this_ptr_conv);
11350 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11351 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
11352 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
11353 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
11354 long ret_ref = (long)ret_copy;
11358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11359 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
11360 FREE((void*)this_ptr);
11361 ChannelMessageHandler_free(this_ptr_conv);
11364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11365 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
11366 FREE((void*)this_ptr);
11367 RoutingMessageHandler_free(this_ptr_conv);
11370 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11371 LDKAcceptChannel obj_conv;
11372 obj_conv.inner = (void*)(obj & (~1));
11373 obj_conv.is_owned = false;
11374 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
11375 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11376 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11377 CVec_u8Z_free(arg_var);
11381 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11382 LDKu8slice ser_ref;
11383 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11384 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11385 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
11386 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11387 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11388 long ret_ref = (long)ret_var.inner;
11389 if (ret_var.is_owned) {
11392 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11396 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
11397 LDKAnnouncementSignatures obj_conv;
11398 obj_conv.inner = (void*)(obj & (~1));
11399 obj_conv.is_owned = false;
11400 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
11401 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11402 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11403 CVec_u8Z_free(arg_var);
11407 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11408 LDKu8slice ser_ref;
11409 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11410 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11411 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
11412 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11413 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11414 long ret_ref = (long)ret_var.inner;
11415 if (ret_var.is_owned) {
11418 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11422 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
11423 LDKChannelReestablish obj_conv;
11424 obj_conv.inner = (void*)(obj & (~1));
11425 obj_conv.is_owned = false;
11426 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
11427 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11428 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11429 CVec_u8Z_free(arg_var);
11433 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11434 LDKu8slice ser_ref;
11435 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11436 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11437 LDKChannelReestablish ret_var = ChannelReestablish_read(ser_ref);
11438 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11439 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11440 long ret_ref = (long)ret_var.inner;
11441 if (ret_var.is_owned) {
11444 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11448 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11449 LDKClosingSigned obj_conv;
11450 obj_conv.inner = (void*)(obj & (~1));
11451 obj_conv.is_owned = false;
11452 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
11453 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11454 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11455 CVec_u8Z_free(arg_var);
11459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11460 LDKu8slice ser_ref;
11461 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11462 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11463 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
11464 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11465 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11466 long ret_ref = (long)ret_var.inner;
11467 if (ret_var.is_owned) {
11470 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11474 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11475 LDKCommitmentSigned obj_conv;
11476 obj_conv.inner = (void*)(obj & (~1));
11477 obj_conv.is_owned = false;
11478 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
11479 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11480 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11481 CVec_u8Z_free(arg_var);
11485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11486 LDKu8slice ser_ref;
11487 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11488 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11489 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
11490 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11491 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11492 long ret_ref = (long)ret_var.inner;
11493 if (ret_var.is_owned) {
11496 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11500 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
11501 LDKFundingCreated obj_conv;
11502 obj_conv.inner = (void*)(obj & (~1));
11503 obj_conv.is_owned = false;
11504 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
11505 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11506 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11507 CVec_u8Z_free(arg_var);
11511 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11512 LDKu8slice ser_ref;
11513 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11514 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11515 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
11516 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11517 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11518 long ret_ref = (long)ret_var.inner;
11519 if (ret_var.is_owned) {
11522 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11526 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11527 LDKFundingSigned obj_conv;
11528 obj_conv.inner = (void*)(obj & (~1));
11529 obj_conv.is_owned = false;
11530 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
11531 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11532 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11533 CVec_u8Z_free(arg_var);
11537 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11538 LDKu8slice ser_ref;
11539 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11540 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11541 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
11542 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11543 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11544 long ret_ref = (long)ret_var.inner;
11545 if (ret_var.is_owned) {
11548 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11552 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
11553 LDKFundingLocked obj_conv;
11554 obj_conv.inner = (void*)(obj & (~1));
11555 obj_conv.is_owned = false;
11556 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
11557 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11558 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11559 CVec_u8Z_free(arg_var);
11563 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11564 LDKu8slice ser_ref;
11565 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11566 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11567 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
11568 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11569 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11570 long ret_ref = (long)ret_var.inner;
11571 if (ret_var.is_owned) {
11574 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11578 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
11580 obj_conv.inner = (void*)(obj & (~1));
11581 obj_conv.is_owned = false;
11582 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
11583 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11584 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11585 CVec_u8Z_free(arg_var);
11589 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11590 LDKu8slice ser_ref;
11591 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11592 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11593 LDKInit ret_var = Init_read(ser_ref);
11594 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11595 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11596 long ret_ref = (long)ret_var.inner;
11597 if (ret_var.is_owned) {
11600 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11604 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11605 LDKOpenChannel obj_conv;
11606 obj_conv.inner = (void*)(obj & (~1));
11607 obj_conv.is_owned = false;
11608 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
11609 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11610 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11611 CVec_u8Z_free(arg_var);
11615 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11616 LDKu8slice ser_ref;
11617 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11618 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11619 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
11620 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11621 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11622 long ret_ref = (long)ret_var.inner;
11623 if (ret_var.is_owned) {
11626 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11630 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
11631 LDKRevokeAndACK obj_conv;
11632 obj_conv.inner = (void*)(obj & (~1));
11633 obj_conv.is_owned = false;
11634 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
11635 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11636 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11637 CVec_u8Z_free(arg_var);
11641 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11642 LDKu8slice ser_ref;
11643 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11644 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11645 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
11646 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11647 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11648 long ret_ref = (long)ret_var.inner;
11649 if (ret_var.is_owned) {
11652 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11656 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
11657 LDKShutdown obj_conv;
11658 obj_conv.inner = (void*)(obj & (~1));
11659 obj_conv.is_owned = false;
11660 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
11661 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11662 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11663 CVec_u8Z_free(arg_var);
11667 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11668 LDKu8slice ser_ref;
11669 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11670 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11671 LDKShutdown ret_var = Shutdown_read(ser_ref);
11672 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11673 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11674 long ret_ref = (long)ret_var.inner;
11675 if (ret_var.is_owned) {
11678 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11682 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11683 LDKUpdateFailHTLC obj_conv;
11684 obj_conv.inner = (void*)(obj & (~1));
11685 obj_conv.is_owned = false;
11686 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
11687 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11688 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11689 CVec_u8Z_free(arg_var);
11693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11694 LDKu8slice ser_ref;
11695 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11696 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11697 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
11698 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11699 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11700 long ret_ref = (long)ret_var.inner;
11701 if (ret_var.is_owned) {
11704 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11708 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11709 LDKUpdateFailMalformedHTLC obj_conv;
11710 obj_conv.inner = (void*)(obj & (~1));
11711 obj_conv.is_owned = false;
11712 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
11713 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11714 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11715 CVec_u8Z_free(arg_var);
11719 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11720 LDKu8slice ser_ref;
11721 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11722 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11723 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
11724 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11725 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11726 long ret_ref = (long)ret_var.inner;
11727 if (ret_var.is_owned) {
11730 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11734 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
11735 LDKUpdateFee obj_conv;
11736 obj_conv.inner = (void*)(obj & (~1));
11737 obj_conv.is_owned = false;
11738 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
11739 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11740 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11741 CVec_u8Z_free(arg_var);
11745 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11746 LDKu8slice ser_ref;
11747 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11748 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11749 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
11750 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11751 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11752 long ret_ref = (long)ret_var.inner;
11753 if (ret_var.is_owned) {
11756 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11760 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11761 LDKUpdateFulfillHTLC obj_conv;
11762 obj_conv.inner = (void*)(obj & (~1));
11763 obj_conv.is_owned = false;
11764 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
11765 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11766 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11767 CVec_u8Z_free(arg_var);
11771 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11772 LDKu8slice ser_ref;
11773 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11774 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11775 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
11776 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11777 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11778 long ret_ref = (long)ret_var.inner;
11779 if (ret_var.is_owned) {
11782 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11786 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11787 LDKUpdateAddHTLC obj_conv;
11788 obj_conv.inner = (void*)(obj & (~1));
11789 obj_conv.is_owned = false;
11790 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
11791 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11792 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11793 CVec_u8Z_free(arg_var);
11797 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11798 LDKu8slice ser_ref;
11799 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11800 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11801 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
11802 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11803 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11804 long ret_ref = (long)ret_var.inner;
11805 if (ret_var.is_owned) {
11808 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11812 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
11814 obj_conv.inner = (void*)(obj & (~1));
11815 obj_conv.is_owned = false;
11816 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
11817 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11818 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11819 CVec_u8Z_free(arg_var);
11823 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11824 LDKu8slice ser_ref;
11825 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11826 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11827 LDKPing ret_var = Ping_read(ser_ref);
11828 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11829 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11830 long ret_ref = (long)ret_var.inner;
11831 if (ret_var.is_owned) {
11834 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11838 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
11840 obj_conv.inner = (void*)(obj & (~1));
11841 obj_conv.is_owned = false;
11842 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
11843 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11844 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11845 CVec_u8Z_free(arg_var);
11849 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11850 LDKu8slice ser_ref;
11851 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11852 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11853 LDKPong ret_var = Pong_read(ser_ref);
11854 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11855 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11856 long ret_ref = (long)ret_var.inner;
11857 if (ret_var.is_owned) {
11860 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11864 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11865 LDKUnsignedChannelAnnouncement obj_conv;
11866 obj_conv.inner = (void*)(obj & (~1));
11867 obj_conv.is_owned = false;
11868 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
11869 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11870 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11871 CVec_u8Z_free(arg_var);
11875 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11876 LDKu8slice ser_ref;
11877 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11878 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11879 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_read(ser_ref);
11880 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11881 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11882 long ret_ref = (long)ret_var.inner;
11883 if (ret_var.is_owned) {
11886 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11890 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11891 LDKChannelAnnouncement obj_conv;
11892 obj_conv.inner = (void*)(obj & (~1));
11893 obj_conv.is_owned = false;
11894 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
11895 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11896 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11897 CVec_u8Z_free(arg_var);
11901 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11902 LDKu8slice ser_ref;
11903 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11904 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11905 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
11906 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11907 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11908 long ret_ref = (long)ret_var.inner;
11909 if (ret_var.is_owned) {
11912 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11916 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
11917 LDKUnsignedChannelUpdate obj_conv;
11918 obj_conv.inner = (void*)(obj & (~1));
11919 obj_conv.is_owned = false;
11920 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
11921 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11922 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11923 CVec_u8Z_free(arg_var);
11927 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11928 LDKu8slice ser_ref;
11929 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11930 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11931 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_read(ser_ref);
11932 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11933 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11934 long ret_ref = (long)ret_var.inner;
11935 if (ret_var.is_owned) {
11938 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11942 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
11943 LDKChannelUpdate obj_conv;
11944 obj_conv.inner = (void*)(obj & (~1));
11945 obj_conv.is_owned = false;
11946 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
11947 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11948 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11949 CVec_u8Z_free(arg_var);
11953 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11954 LDKu8slice ser_ref;
11955 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11956 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11957 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
11958 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11959 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11960 long ret_ref = (long)ret_var.inner;
11961 if (ret_var.is_owned) {
11964 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11968 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
11969 LDKErrorMessage obj_conv;
11970 obj_conv.inner = (void*)(obj & (~1));
11971 obj_conv.is_owned = false;
11972 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
11973 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11974 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11975 CVec_u8Z_free(arg_var);
11979 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11980 LDKu8slice ser_ref;
11981 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11982 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11983 LDKErrorMessage ret_var = ErrorMessage_read(ser_ref);
11984 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11985 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11986 long ret_ref = (long)ret_var.inner;
11987 if (ret_var.is_owned) {
11990 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11994 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11995 LDKUnsignedNodeAnnouncement obj_conv;
11996 obj_conv.inner = (void*)(obj & (~1));
11997 obj_conv.is_owned = false;
11998 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
11999 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12000 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12001 CVec_u8Z_free(arg_var);
12005 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12006 LDKu8slice ser_ref;
12007 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12008 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12009 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_read(ser_ref);
12010 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12011 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12012 long ret_ref = (long)ret_var.inner;
12013 if (ret_var.is_owned) {
12016 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12020 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
12021 LDKNodeAnnouncement obj_conv;
12022 obj_conv.inner = (void*)(obj & (~1));
12023 obj_conv.is_owned = false;
12024 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
12025 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12026 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12027 CVec_u8Z_free(arg_var);
12031 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12032 LDKu8slice ser_ref;
12033 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12034 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12035 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
12036 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12037 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12038 long ret_ref = (long)ret_var.inner;
12039 if (ret_var.is_owned) {
12042 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12046 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12047 LDKu8slice ser_ref;
12048 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12049 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12050 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_read(ser_ref);
12051 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12052 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12053 long ret_ref = (long)ret_var.inner;
12054 if (ret_var.is_owned) {
12057 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12061 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
12062 LDKQueryShortChannelIds obj_conv;
12063 obj_conv.inner = (void*)(obj & (~1));
12064 obj_conv.is_owned = false;
12065 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
12066 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12067 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12068 CVec_u8Z_free(arg_var);
12072 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12073 LDKu8slice ser_ref;
12074 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12075 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12076 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_read(ser_ref);
12077 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12078 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12079 long ret_ref = (long)ret_var.inner;
12080 if (ret_var.is_owned) {
12083 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12087 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
12088 LDKReplyShortChannelIdsEnd obj_conv;
12089 obj_conv.inner = (void*)(obj & (~1));
12090 obj_conv.is_owned = false;
12091 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
12092 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12093 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12094 CVec_u8Z_free(arg_var);
12098 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12099 LDKu8slice ser_ref;
12100 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12101 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12102 LDKQueryChannelRange ret_var = QueryChannelRange_read(ser_ref);
12103 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12104 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12105 long ret_ref = (long)ret_var.inner;
12106 if (ret_var.is_owned) {
12109 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12113 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
12114 LDKQueryChannelRange obj_conv;
12115 obj_conv.inner = (void*)(obj & (~1));
12116 obj_conv.is_owned = false;
12117 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
12118 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12119 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12120 CVec_u8Z_free(arg_var);
12124 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12125 LDKu8slice ser_ref;
12126 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12127 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12128 LDKReplyChannelRange ret_var = ReplyChannelRange_read(ser_ref);
12129 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12130 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12131 long ret_ref = (long)ret_var.inner;
12132 if (ret_var.is_owned) {
12135 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12139 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
12140 LDKReplyChannelRange obj_conv;
12141 obj_conv.inner = (void*)(obj & (~1));
12142 obj_conv.is_owned = false;
12143 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
12144 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12145 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12146 CVec_u8Z_free(arg_var);
12150 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12151 LDKu8slice ser_ref;
12152 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12153 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12154 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_read(ser_ref);
12155 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12156 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12157 long ret_ref = (long)ret_var.inner;
12158 if (ret_var.is_owned) {
12161 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12165 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
12166 LDKGossipTimestampFilter obj_conv;
12167 obj_conv.inner = (void*)(obj & (~1));
12168 obj_conv.is_owned = false;
12169 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
12170 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12171 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12172 CVec_u8Z_free(arg_var);
12176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12177 LDKMessageHandler this_ptr_conv;
12178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12179 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12180 MessageHandler_free(this_ptr_conv);
12183 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12184 LDKMessageHandler this_ptr_conv;
12185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12186 this_ptr_conv.is_owned = false;
12187 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
12191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12192 LDKMessageHandler this_ptr_conv;
12193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12194 this_ptr_conv.is_owned = false;
12195 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
12196 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
12197 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12198 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
12200 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
12203 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12204 LDKMessageHandler this_ptr_conv;
12205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12206 this_ptr_conv.is_owned = false;
12207 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
12211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12212 LDKMessageHandler this_ptr_conv;
12213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12214 this_ptr_conv.is_owned = false;
12215 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
12216 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12217 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12218 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
12220 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
12223 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
12224 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
12225 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
12226 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12227 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
12229 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
12230 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12231 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12232 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
12234 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
12235 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12236 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12237 long ret_ref = (long)ret_var.inner;
12238 if (ret_var.is_owned) {
12244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12245 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
12246 FREE((void*)this_ptr);
12247 SocketDescriptor_free(this_ptr_conv);
12250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12251 LDKPeerHandleError this_ptr_conv;
12252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12253 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12254 PeerHandleError_free(this_ptr_conv);
12257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
12258 LDKPeerHandleError this_ptr_conv;
12259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12260 this_ptr_conv.is_owned = false;
12261 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
12265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12266 LDKPeerHandleError this_ptr_conv;
12267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12268 this_ptr_conv.is_owned = false;
12269 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
12272 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
12273 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
12274 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12275 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12276 long ret_ref = (long)ret_var.inner;
12277 if (ret_var.is_owned) {
12283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12284 LDKPeerManager this_ptr_conv;
12285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12286 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12287 PeerManager_free(this_ptr_conv);
12290 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) {
12291 LDKMessageHandler message_handler_conv;
12292 message_handler_conv.inner = (void*)(message_handler & (~1));
12293 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
12294 // Warning: we may need a move here but can't clone!
12295 LDKSecretKey our_node_secret_ref;
12296 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
12297 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
12298 unsigned char ephemeral_random_data_arr[32];
12299 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
12300 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
12301 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
12302 LDKLogger logger_conv = *(LDKLogger*)logger;
12303 if (logger_conv.free == LDKLogger_JCalls_free) {
12304 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12305 LDKLogger_JCalls_clone(logger_conv.this_arg);
12307 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
12308 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12309 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12310 long ret_ref = (long)ret_var.inner;
12311 if (ret_var.is_owned) {
12317 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
12318 LDKPeerManager this_arg_conv;
12319 this_arg_conv.inner = (void*)(this_arg & (~1));
12320 this_arg_conv.is_owned = false;
12321 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
12322 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, arr_of_B_clz, NULL);
12323 for (size_t i = 0; i < ret_var.datalen; i++) {
12324 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
12325 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
12326 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
12328 CVec_PublicKeyZ_free(ret_var);
12332 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) {
12333 LDKPeerManager this_arg_conv;
12334 this_arg_conv.inner = (void*)(this_arg & (~1));
12335 this_arg_conv.is_owned = false;
12336 LDKPublicKey their_node_id_ref;
12337 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
12338 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12339 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12340 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12341 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12342 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12344 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
12345 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
12346 return (long)ret_conv;
12349 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12350 LDKPeerManager this_arg_conv;
12351 this_arg_conv.inner = (void*)(this_arg & (~1));
12352 this_arg_conv.is_owned = false;
12353 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12354 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12355 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12356 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12358 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12359 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
12360 return (long)ret_conv;
12363 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12364 LDKPeerManager this_arg_conv;
12365 this_arg_conv.inner = (void*)(this_arg & (~1));
12366 this_arg_conv.is_owned = false;
12367 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12368 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12369 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
12370 return (long)ret_conv;
12373 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
12374 LDKPeerManager this_arg_conv;
12375 this_arg_conv.inner = (void*)(this_arg & (~1));
12376 this_arg_conv.is_owned = false;
12377 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
12378 LDKu8slice data_ref;
12379 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
12380 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
12381 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12382 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
12383 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
12384 return (long)ret_conv;
12387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
12388 LDKPeerManager this_arg_conv;
12389 this_arg_conv.inner = (void*)(this_arg & (~1));
12390 this_arg_conv.is_owned = false;
12391 PeerManager_process_events(&this_arg_conv);
12394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12395 LDKPeerManager this_arg_conv;
12396 this_arg_conv.inner = (void*)(this_arg & (~1));
12397 this_arg_conv.is_owned = false;
12398 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12399 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
12402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
12403 LDKPeerManager this_arg_conv;
12404 this_arg_conv.inner = (void*)(this_arg & (~1));
12405 this_arg_conv.is_owned = false;
12406 PeerManager_timer_tick_occured(&this_arg_conv);
12409 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
12410 unsigned char commitment_seed_arr[32];
12411 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
12412 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
12413 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
12414 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
12415 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
12419 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
12420 LDKPublicKey per_commitment_point_ref;
12421 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12422 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12423 unsigned char base_secret_arr[32];
12424 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
12425 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
12426 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
12427 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12428 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
12429 return (long)ret_conv;
12432 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
12433 LDKPublicKey per_commitment_point_ref;
12434 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12435 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12436 LDKPublicKey base_point_ref;
12437 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
12438 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
12439 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12440 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
12441 return (long)ret_conv;
12444 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) {
12445 unsigned char per_commitment_secret_arr[32];
12446 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
12447 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
12448 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
12449 unsigned char countersignatory_revocation_base_secret_arr[32];
12450 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
12451 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
12452 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
12453 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12454 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
12455 return (long)ret_conv;
12458 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) {
12459 LDKPublicKey per_commitment_point_ref;
12460 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12461 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12462 LDKPublicKey countersignatory_revocation_base_point_ref;
12463 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
12464 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
12465 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12466 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
12467 return (long)ret_conv;
12470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12471 LDKTxCreationKeys this_ptr_conv;
12472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12473 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12474 TxCreationKeys_free(this_ptr_conv);
12477 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12478 LDKTxCreationKeys orig_conv;
12479 orig_conv.inner = (void*)(orig & (~1));
12480 orig_conv.is_owned = false;
12481 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
12482 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12483 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12484 long ret_ref = (long)ret_var.inner;
12485 if (ret_var.is_owned) {
12491 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12492 LDKTxCreationKeys this_ptr_conv;
12493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12494 this_ptr_conv.is_owned = false;
12495 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12496 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
12500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12501 LDKTxCreationKeys this_ptr_conv;
12502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12503 this_ptr_conv.is_owned = false;
12504 LDKPublicKey val_ref;
12505 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12506 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12507 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
12510 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12511 LDKTxCreationKeys this_ptr_conv;
12512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12513 this_ptr_conv.is_owned = false;
12514 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12515 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
12519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12520 LDKTxCreationKeys this_ptr_conv;
12521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12522 this_ptr_conv.is_owned = false;
12523 LDKPublicKey val_ref;
12524 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12525 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12526 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
12529 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12530 LDKTxCreationKeys this_ptr_conv;
12531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12532 this_ptr_conv.is_owned = false;
12533 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12534 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
12538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12539 LDKTxCreationKeys this_ptr_conv;
12540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12541 this_ptr_conv.is_owned = false;
12542 LDKPublicKey val_ref;
12543 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12544 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12545 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
12548 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12549 LDKTxCreationKeys this_ptr_conv;
12550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12551 this_ptr_conv.is_owned = false;
12552 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12553 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
12557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12558 LDKTxCreationKeys this_ptr_conv;
12559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12560 this_ptr_conv.is_owned = false;
12561 LDKPublicKey val_ref;
12562 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12563 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12564 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
12567 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12568 LDKTxCreationKeys this_ptr_conv;
12569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12570 this_ptr_conv.is_owned = false;
12571 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12572 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
12576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12577 LDKTxCreationKeys this_ptr_conv;
12578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12579 this_ptr_conv.is_owned = false;
12580 LDKPublicKey val_ref;
12581 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12582 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12583 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
12586 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) {
12587 LDKPublicKey per_commitment_point_arg_ref;
12588 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
12589 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
12590 LDKPublicKey revocation_key_arg_ref;
12591 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
12592 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
12593 LDKPublicKey broadcaster_htlc_key_arg_ref;
12594 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
12595 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
12596 LDKPublicKey countersignatory_htlc_key_arg_ref;
12597 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
12598 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
12599 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
12600 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
12601 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
12602 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);
12603 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12604 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12605 long ret_ref = (long)ret_var.inner;
12606 if (ret_var.is_owned) {
12612 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12613 LDKTxCreationKeys obj_conv;
12614 obj_conv.inner = (void*)(obj & (~1));
12615 obj_conv.is_owned = false;
12616 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
12617 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12618 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12619 CVec_u8Z_free(arg_var);
12623 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12624 LDKu8slice ser_ref;
12625 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12626 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12627 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
12628 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12629 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12630 long ret_ref = (long)ret_var.inner;
12631 if (ret_var.is_owned) {
12634 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12639 LDKPreCalculatedTxCreationKeys this_ptr_conv;
12640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12641 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12642 PreCalculatedTxCreationKeys_free(this_ptr_conv);
12645 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12646 LDKPreCalculatedTxCreationKeys orig_conv;
12647 orig_conv.inner = (void*)(orig & (~1));
12648 orig_conv.is_owned = false;
12649 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_clone(&orig_conv);
12650 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12651 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12652 long ret_ref = (long)ret_var.inner;
12653 if (ret_var.is_owned) {
12659 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
12660 LDKTxCreationKeys keys_conv;
12661 keys_conv.inner = (void*)(keys & (~1));
12662 keys_conv.is_owned = (keys & 1) || (keys == 0);
12663 if (keys_conv.inner != NULL)
12664 keys_conv = TxCreationKeys_clone(&keys_conv);
12665 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_new(keys_conv);
12666 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12667 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12668 long ret_ref = (long)ret_var.inner;
12669 if (ret_var.is_owned) {
12675 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
12676 LDKPreCalculatedTxCreationKeys this_arg_conv;
12677 this_arg_conv.inner = (void*)(this_arg & (~1));
12678 this_arg_conv.is_owned = false;
12679 LDKTxCreationKeys ret_var = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
12680 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12681 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12682 long ret_ref = (long)ret_var.inner;
12683 if (ret_var.is_owned) {
12689 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
12690 LDKPreCalculatedTxCreationKeys this_arg_conv;
12691 this_arg_conv.inner = (void*)(this_arg & (~1));
12692 this_arg_conv.is_owned = false;
12693 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12694 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
12698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12699 LDKChannelPublicKeys this_ptr_conv;
12700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12701 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12702 ChannelPublicKeys_free(this_ptr_conv);
12705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12706 LDKChannelPublicKeys orig_conv;
12707 orig_conv.inner = (void*)(orig & (~1));
12708 orig_conv.is_owned = false;
12709 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
12710 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12711 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12712 long ret_ref = (long)ret_var.inner;
12713 if (ret_var.is_owned) {
12719 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
12720 LDKChannelPublicKeys this_ptr_conv;
12721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12722 this_ptr_conv.is_owned = false;
12723 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12724 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
12728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12729 LDKChannelPublicKeys this_ptr_conv;
12730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12731 this_ptr_conv.is_owned = false;
12732 LDKPublicKey val_ref;
12733 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12734 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12735 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
12738 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12739 LDKChannelPublicKeys this_ptr_conv;
12740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12741 this_ptr_conv.is_owned = false;
12742 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12743 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
12747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12748 LDKChannelPublicKeys this_ptr_conv;
12749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12750 this_ptr_conv.is_owned = false;
12751 LDKPublicKey val_ref;
12752 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12753 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12754 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
12757 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12758 LDKChannelPublicKeys this_ptr_conv;
12759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12760 this_ptr_conv.is_owned = false;
12761 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12762 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
12766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12767 LDKChannelPublicKeys this_ptr_conv;
12768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12769 this_ptr_conv.is_owned = false;
12770 LDKPublicKey val_ref;
12771 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12772 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12773 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
12776 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12777 LDKChannelPublicKeys this_ptr_conv;
12778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12779 this_ptr_conv.is_owned = false;
12780 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12781 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
12785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12786 LDKChannelPublicKeys this_ptr_conv;
12787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12788 this_ptr_conv.is_owned = false;
12789 LDKPublicKey val_ref;
12790 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12791 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12792 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12795 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12796 LDKChannelPublicKeys this_ptr_conv;
12797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12798 this_ptr_conv.is_owned = false;
12799 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12800 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
12804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12805 LDKChannelPublicKeys this_ptr_conv;
12806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12807 this_ptr_conv.is_owned = false;
12808 LDKPublicKey val_ref;
12809 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12810 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12811 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
12814 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) {
12815 LDKPublicKey funding_pubkey_arg_ref;
12816 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
12817 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
12818 LDKPublicKey revocation_basepoint_arg_ref;
12819 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
12820 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
12821 LDKPublicKey payment_point_arg_ref;
12822 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
12823 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
12824 LDKPublicKey delayed_payment_basepoint_arg_ref;
12825 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
12826 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
12827 LDKPublicKey htlc_basepoint_arg_ref;
12828 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
12829 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
12830 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);
12831 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12832 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12833 long ret_ref = (long)ret_var.inner;
12834 if (ret_var.is_owned) {
12840 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12841 LDKChannelPublicKeys obj_conv;
12842 obj_conv.inner = (void*)(obj & (~1));
12843 obj_conv.is_owned = false;
12844 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
12845 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12846 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12847 CVec_u8Z_free(arg_var);
12851 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12852 LDKu8slice ser_ref;
12853 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12854 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12855 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
12856 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12857 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12858 long ret_ref = (long)ret_var.inner;
12859 if (ret_var.is_owned) {
12862 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12866 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) {
12867 LDKPublicKey per_commitment_point_ref;
12868 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12869 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12870 LDKPublicKey broadcaster_delayed_payment_base_ref;
12871 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
12872 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
12873 LDKPublicKey broadcaster_htlc_base_ref;
12874 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
12875 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
12876 LDKPublicKey countersignatory_revocation_base_ref;
12877 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
12878 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
12879 LDKPublicKey countersignatory_htlc_base_ref;
12880 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
12881 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
12882 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
12883 *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);
12884 return (long)ret_conv;
12887 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) {
12888 LDKPublicKey revocation_key_ref;
12889 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
12890 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
12891 LDKPublicKey broadcaster_delayed_payment_key_ref;
12892 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
12893 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
12894 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
12895 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12896 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12897 CVec_u8Z_free(arg_var);
12901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12902 LDKHTLCOutputInCommitment this_ptr_conv;
12903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12905 HTLCOutputInCommitment_free(this_ptr_conv);
12908 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12909 LDKHTLCOutputInCommitment orig_conv;
12910 orig_conv.inner = (void*)(orig & (~1));
12911 orig_conv.is_owned = false;
12912 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
12913 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12914 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12915 long ret_ref = (long)ret_var.inner;
12916 if (ret_var.is_owned) {
12922 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
12923 LDKHTLCOutputInCommitment this_ptr_conv;
12924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12925 this_ptr_conv.is_owned = false;
12926 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
12930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12931 LDKHTLCOutputInCommitment this_ptr_conv;
12932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12933 this_ptr_conv.is_owned = false;
12934 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
12937 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12938 LDKHTLCOutputInCommitment this_ptr_conv;
12939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12940 this_ptr_conv.is_owned = false;
12941 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
12945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12946 LDKHTLCOutputInCommitment this_ptr_conv;
12947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12948 this_ptr_conv.is_owned = false;
12949 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
12952 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
12953 LDKHTLCOutputInCommitment this_ptr_conv;
12954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12955 this_ptr_conv.is_owned = false;
12956 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
12960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12961 LDKHTLCOutputInCommitment this_ptr_conv;
12962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12963 this_ptr_conv.is_owned = false;
12964 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
12967 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
12968 LDKHTLCOutputInCommitment this_ptr_conv;
12969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12970 this_ptr_conv.is_owned = false;
12971 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12972 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
12976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12977 LDKHTLCOutputInCommitment this_ptr_conv;
12978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12979 this_ptr_conv.is_owned = false;
12980 LDKThirtyTwoBytes val_ref;
12981 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12982 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12983 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
12986 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
12987 LDKHTLCOutputInCommitment obj_conv;
12988 obj_conv.inner = (void*)(obj & (~1));
12989 obj_conv.is_owned = false;
12990 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
12991 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12992 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12993 CVec_u8Z_free(arg_var);
12997 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12998 LDKu8slice ser_ref;
12999 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13000 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13001 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
13002 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13003 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13004 long ret_ref = (long)ret_var.inner;
13005 if (ret_var.is_owned) {
13008 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13012 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
13013 LDKHTLCOutputInCommitment htlc_conv;
13014 htlc_conv.inner = (void*)(htlc & (~1));
13015 htlc_conv.is_owned = false;
13016 LDKTxCreationKeys keys_conv;
13017 keys_conv.inner = (void*)(keys & (~1));
13018 keys_conv.is_owned = false;
13019 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
13020 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13021 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13022 CVec_u8Z_free(arg_var);
13026 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
13027 LDKPublicKey broadcaster_ref;
13028 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
13029 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
13030 LDKPublicKey countersignatory_ref;
13031 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
13032 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
13033 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
13034 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13035 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13036 CVec_u8Z_free(arg_var);
13040 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv * _env, jclass _b, jbyteArray prev_hash, jint feerate_per_kw, jshort contest_delay, jlong htlc, jbyteArray broadcaster_delayed_payment_key, jbyteArray revocation_key) {
13041 unsigned char prev_hash_arr[32];
13042 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
13043 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
13044 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
13045 LDKHTLCOutputInCommitment htlc_conv;
13046 htlc_conv.inner = (void*)(htlc & (~1));
13047 htlc_conv.is_owned = false;
13048 LDKPublicKey broadcaster_delayed_payment_key_ref;
13049 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
13050 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
13051 LDKPublicKey revocation_key_ref;
13052 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
13053 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
13054 LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
13055 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13056 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13057 Transaction_free(arg_var);
13061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13062 LDKHolderCommitmentTransaction this_ptr_conv;
13063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13064 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13065 HolderCommitmentTransaction_free(this_ptr_conv);
13068 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13069 LDKHolderCommitmentTransaction orig_conv;
13070 orig_conv.inner = (void*)(orig & (~1));
13071 orig_conv.is_owned = false;
13072 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
13073 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13074 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13075 long ret_ref = (long)ret_var.inner;
13076 if (ret_var.is_owned) {
13082 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
13083 LDKHolderCommitmentTransaction this_ptr_conv;
13084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13085 this_ptr_conv.is_owned = false;
13086 LDKTransaction arg_var = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
13087 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13088 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13089 Transaction_free(arg_var);
13093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13094 LDKHolderCommitmentTransaction this_ptr_conv;
13095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13096 this_ptr_conv.is_owned = false;
13097 LDKTransaction val_ref;
13098 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
13099 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
13100 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
13101 val_ref.data_is_owned = true;
13102 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_ref);
13105 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
13106 LDKHolderCommitmentTransaction this_ptr_conv;
13107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13108 this_ptr_conv.is_owned = false;
13109 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
13110 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
13114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13115 LDKHolderCommitmentTransaction this_ptr_conv;
13116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13117 this_ptr_conv.is_owned = false;
13118 LDKSignature val_ref;
13119 CHECK((*_env)->GetArrayLength (_env, val) == 64);
13120 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
13121 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
13124 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
13125 LDKHolderCommitmentTransaction this_ptr_conv;
13126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13127 this_ptr_conv.is_owned = false;
13128 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
13132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13133 LDKHolderCommitmentTransaction this_ptr_conv;
13134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13135 this_ptr_conv.is_owned = false;
13136 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
13139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
13140 LDKHolderCommitmentTransaction this_ptr_conv;
13141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13142 this_ptr_conv.is_owned = false;
13143 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_constr;
13144 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13145 if (val_constr.datalen > 0)
13146 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
13148 val_constr.data = NULL;
13149 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
13150 for (size_t q = 0; q < val_constr.datalen; q++) {
13151 long arr_conv_42 = val_vals[q];
13152 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
13153 FREE((void*)arr_conv_42);
13154 val_constr.data[q] = arr_conv_42_conv;
13156 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
13157 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_constr);
13160 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new_1missing_1holder_1sig(JNIEnv * _env, jclass _b, jbyteArray unsigned_tx, jbyteArray counterparty_sig, jbyteArray holder_funding_key, jbyteArray counterparty_funding_key, jlong keys, jint feerate_per_kw, jlongArray htlc_data) {
13161 LDKTransaction unsigned_tx_ref;
13162 unsigned_tx_ref.datalen = (*_env)->GetArrayLength (_env, unsigned_tx);
13163 unsigned_tx_ref.data = MALLOC(unsigned_tx_ref.datalen, "LDKTransaction Bytes");
13164 (*_env)->GetByteArrayRegion(_env, unsigned_tx, 0, unsigned_tx_ref.datalen, unsigned_tx_ref.data);
13165 unsigned_tx_ref.data_is_owned = true;
13166 LDKSignature counterparty_sig_ref;
13167 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
13168 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
13169 LDKPublicKey holder_funding_key_ref;
13170 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
13171 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
13172 LDKPublicKey counterparty_funding_key_ref;
13173 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
13174 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
13175 LDKTxCreationKeys keys_conv;
13176 keys_conv.inner = (void*)(keys & (~1));
13177 keys_conv.is_owned = (keys & 1) || (keys == 0);
13178 if (keys_conv.inner != NULL)
13179 keys_conv = TxCreationKeys_clone(&keys_conv);
13180 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_constr;
13181 htlc_data_constr.datalen = (*_env)->GetArrayLength (_env, htlc_data);
13182 if (htlc_data_constr.datalen > 0)
13183 htlc_data_constr.data = MALLOC(htlc_data_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
13185 htlc_data_constr.data = NULL;
13186 long* htlc_data_vals = (*_env)->GetLongArrayElements (_env, htlc_data, NULL);
13187 for (size_t q = 0; q < htlc_data_constr.datalen; q++) {
13188 long arr_conv_42 = htlc_data_vals[q];
13189 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
13190 FREE((void*)arr_conv_42);
13191 htlc_data_constr.data[q] = arr_conv_42_conv;
13193 (*_env)->ReleaseLongArrayElements (_env, htlc_data, htlc_data_vals, 0);
13194 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new_missing_holder_sig(unsigned_tx_ref, counterparty_sig_ref, holder_funding_key_ref, counterparty_funding_key_ref, keys_conv, feerate_per_kw, htlc_data_constr);
13195 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13196 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13197 long ret_ref = (long)ret_var.inner;
13198 if (ret_var.is_owned) {
13204 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
13205 LDKHolderCommitmentTransaction this_arg_conv;
13206 this_arg_conv.inner = (void*)(this_arg & (~1));
13207 this_arg_conv.is_owned = false;
13208 LDKTxCreationKeys ret_var = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
13209 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13210 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13211 long ret_ref = (long)ret_var.inner;
13212 if (ret_var.is_owned) {
13218 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
13219 LDKHolderCommitmentTransaction this_arg_conv;
13220 this_arg_conv.inner = (void*)(this_arg & (~1));
13221 this_arg_conv.is_owned = false;
13222 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
13223 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
13227 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) {
13228 LDKHolderCommitmentTransaction this_arg_conv;
13229 this_arg_conv.inner = (void*)(this_arg & (~1));
13230 this_arg_conv.is_owned = false;
13231 unsigned char funding_key_arr[32];
13232 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
13233 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
13234 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
13235 LDKu8slice funding_redeemscript_ref;
13236 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
13237 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
13238 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
13239 (*_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);
13240 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
13244 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) {
13245 LDKHolderCommitmentTransaction this_arg_conv;
13246 this_arg_conv.inner = (void*)(this_arg & (~1));
13247 this_arg_conv.is_owned = false;
13248 unsigned char htlc_base_key_arr[32];
13249 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
13250 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
13251 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
13252 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
13253 *ret_conv = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
13254 return (long)ret_conv;
13257 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
13258 LDKHolderCommitmentTransaction obj_conv;
13259 obj_conv.inner = (void*)(obj & (~1));
13260 obj_conv.is_owned = false;
13261 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
13262 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13263 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13264 CVec_u8Z_free(arg_var);
13268 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13269 LDKu8slice ser_ref;
13270 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13271 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13272 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
13273 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13274 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13275 long ret_ref = (long)ret_var.inner;
13276 if (ret_var.is_owned) {
13279 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13284 LDKInitFeatures this_ptr_conv;
13285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13286 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13287 InitFeatures_free(this_ptr_conv);
13290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13291 LDKNodeFeatures this_ptr_conv;
13292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13293 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13294 NodeFeatures_free(this_ptr_conv);
13297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13298 LDKChannelFeatures this_ptr_conv;
13299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13300 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13301 ChannelFeatures_free(this_ptr_conv);
13304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13305 LDKRouteHop this_ptr_conv;
13306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13308 RouteHop_free(this_ptr_conv);
13311 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13312 LDKRouteHop orig_conv;
13313 orig_conv.inner = (void*)(orig & (~1));
13314 orig_conv.is_owned = false;
13315 LDKRouteHop ret_var = RouteHop_clone(&orig_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 jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
13326 LDKRouteHop this_ptr_conv;
13327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13328 this_ptr_conv.is_owned = false;
13329 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13330 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
13334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13335 LDKRouteHop this_ptr_conv;
13336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13337 this_ptr_conv.is_owned = false;
13338 LDKPublicKey val_ref;
13339 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13340 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13341 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
13344 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13345 LDKRouteHop this_ptr_conv;
13346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13347 this_ptr_conv.is_owned = false;
13348 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
13349 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13350 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13351 long ret_ref = (long)ret_var.inner;
13352 if (ret_var.is_owned) {
13358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13359 LDKRouteHop this_ptr_conv;
13360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13361 this_ptr_conv.is_owned = false;
13362 LDKNodeFeatures val_conv;
13363 val_conv.inner = (void*)(val & (~1));
13364 val_conv.is_owned = (val & 1) || (val == 0);
13365 // Warning: we may need a move here but can't clone!
13366 RouteHop_set_node_features(&this_ptr_conv, val_conv);
13369 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13370 LDKRouteHop this_ptr_conv;
13371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13372 this_ptr_conv.is_owned = false;
13373 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
13377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13378 LDKRouteHop this_ptr_conv;
13379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13380 this_ptr_conv.is_owned = false;
13381 RouteHop_set_short_channel_id(&this_ptr_conv, val);
13384 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13385 LDKRouteHop this_ptr_conv;
13386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13387 this_ptr_conv.is_owned = false;
13388 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
13389 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13390 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13391 long ret_ref = (long)ret_var.inner;
13392 if (ret_var.is_owned) {
13398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13399 LDKRouteHop this_ptr_conv;
13400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13401 this_ptr_conv.is_owned = false;
13402 LDKChannelFeatures val_conv;
13403 val_conv.inner = (void*)(val & (~1));
13404 val_conv.is_owned = (val & 1) || (val == 0);
13405 // Warning: we may need a move here but can't clone!
13406 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
13409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13410 LDKRouteHop this_ptr_conv;
13411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13412 this_ptr_conv.is_owned = false;
13413 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
13417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13418 LDKRouteHop this_ptr_conv;
13419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13420 this_ptr_conv.is_owned = false;
13421 RouteHop_set_fee_msat(&this_ptr_conv, val);
13424 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13425 LDKRouteHop this_ptr_conv;
13426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13427 this_ptr_conv.is_owned = false;
13428 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
13432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13433 LDKRouteHop this_ptr_conv;
13434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13435 this_ptr_conv.is_owned = false;
13436 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
13439 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) {
13440 LDKPublicKey pubkey_arg_ref;
13441 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
13442 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
13443 LDKNodeFeatures node_features_arg_conv;
13444 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
13445 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
13446 // Warning: we may need a move here but can't clone!
13447 LDKChannelFeatures channel_features_arg_conv;
13448 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
13449 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
13450 // Warning: we may need a move here but can't clone!
13451 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);
13452 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13453 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13454 long ret_ref = (long)ret_var.inner;
13455 if (ret_var.is_owned) {
13461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13462 LDKRoute this_ptr_conv;
13463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13464 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13465 Route_free(this_ptr_conv);
13468 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13469 LDKRoute orig_conv;
13470 orig_conv.inner = (void*)(orig & (~1));
13471 orig_conv.is_owned = false;
13472 LDKRoute ret_var = Route_clone(&orig_conv);
13473 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13474 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13475 long ret_ref = (long)ret_var.inner;
13476 if (ret_var.is_owned) {
13482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
13483 LDKRoute this_ptr_conv;
13484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13485 this_ptr_conv.is_owned = false;
13486 LDKCVec_CVec_RouteHopZZ val_constr;
13487 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13488 if (val_constr.datalen > 0)
13489 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13491 val_constr.data = NULL;
13492 for (size_t m = 0; m < val_constr.datalen; m++) {
13493 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
13494 LDKCVec_RouteHopZ arr_conv_12_constr;
13495 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13496 if (arr_conv_12_constr.datalen > 0)
13497 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13499 arr_conv_12_constr.data = NULL;
13500 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13501 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13502 long arr_conv_10 = arr_conv_12_vals[k];
13503 LDKRouteHop arr_conv_10_conv;
13504 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13505 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13506 if (arr_conv_10_conv.inner != NULL)
13507 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13508 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13510 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13511 val_constr.data[m] = arr_conv_12_constr;
13513 Route_set_paths(&this_ptr_conv, val_constr);
13516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
13517 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
13518 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
13519 if (paths_arg_constr.datalen > 0)
13520 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13522 paths_arg_constr.data = NULL;
13523 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
13524 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
13525 LDKCVec_RouteHopZ arr_conv_12_constr;
13526 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13527 if (arr_conv_12_constr.datalen > 0)
13528 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13530 arr_conv_12_constr.data = NULL;
13531 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13532 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13533 long arr_conv_10 = arr_conv_12_vals[k];
13534 LDKRouteHop arr_conv_10_conv;
13535 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13536 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13537 if (arr_conv_10_conv.inner != NULL)
13538 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13539 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13541 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13542 paths_arg_constr.data[m] = arr_conv_12_constr;
13544 LDKRoute ret_var = Route_new(paths_arg_constr);
13545 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13546 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13547 long ret_ref = (long)ret_var.inner;
13548 if (ret_var.is_owned) {
13554 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
13556 obj_conv.inner = (void*)(obj & (~1));
13557 obj_conv.is_owned = false;
13558 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
13559 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13560 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13561 CVec_u8Z_free(arg_var);
13565 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13566 LDKu8slice ser_ref;
13567 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13568 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13569 LDKRoute ret_var = Route_read(ser_ref);
13570 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13571 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13572 long ret_ref = (long)ret_var.inner;
13573 if (ret_var.is_owned) {
13576 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13581 LDKRouteHint this_ptr_conv;
13582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13583 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13584 RouteHint_free(this_ptr_conv);
13587 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13588 LDKRouteHint orig_conv;
13589 orig_conv.inner = (void*)(orig & (~1));
13590 orig_conv.is_owned = false;
13591 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
13592 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13593 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13594 long ret_ref = (long)ret_var.inner;
13595 if (ret_var.is_owned) {
13601 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13602 LDKRouteHint this_ptr_conv;
13603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13604 this_ptr_conv.is_owned = false;
13605 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13606 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
13610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13611 LDKRouteHint this_ptr_conv;
13612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13613 this_ptr_conv.is_owned = false;
13614 LDKPublicKey val_ref;
13615 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13616 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13617 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
13620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13621 LDKRouteHint this_ptr_conv;
13622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13623 this_ptr_conv.is_owned = false;
13624 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
13628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13629 LDKRouteHint this_ptr_conv;
13630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13631 this_ptr_conv.is_owned = false;
13632 RouteHint_set_short_channel_id(&this_ptr_conv, val);
13635 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
13636 LDKRouteHint this_ptr_conv;
13637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13638 this_ptr_conv.is_owned = false;
13639 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
13640 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13641 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13642 long ret_ref = (long)ret_var.inner;
13643 if (ret_var.is_owned) {
13649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13650 LDKRouteHint this_ptr_conv;
13651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13652 this_ptr_conv.is_owned = false;
13653 LDKRoutingFees val_conv;
13654 val_conv.inner = (void*)(val & (~1));
13655 val_conv.is_owned = (val & 1) || (val == 0);
13656 if (val_conv.inner != NULL)
13657 val_conv = RoutingFees_clone(&val_conv);
13658 RouteHint_set_fees(&this_ptr_conv, val_conv);
13661 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13662 LDKRouteHint this_ptr_conv;
13663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13664 this_ptr_conv.is_owned = false;
13665 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
13669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13670 LDKRouteHint this_ptr_conv;
13671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13672 this_ptr_conv.is_owned = false;
13673 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
13676 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13677 LDKRouteHint this_ptr_conv;
13678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13679 this_ptr_conv.is_owned = false;
13680 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
13684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13685 LDKRouteHint this_ptr_conv;
13686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13687 this_ptr_conv.is_owned = false;
13688 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
13691 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) {
13692 LDKPublicKey src_node_id_arg_ref;
13693 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
13694 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
13695 LDKRoutingFees fees_arg_conv;
13696 fees_arg_conv.inner = (void*)(fees_arg & (~1));
13697 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
13698 if (fees_arg_conv.inner != NULL)
13699 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
13700 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);
13701 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13702 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13703 long ret_ref = (long)ret_var.inner;
13704 if (ret_var.is_owned) {
13710 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) {
13711 LDKPublicKey our_node_id_ref;
13712 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
13713 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
13714 LDKNetworkGraph network_conv;
13715 network_conv.inner = (void*)(network & (~1));
13716 network_conv.is_owned = false;
13717 LDKPublicKey target_ref;
13718 CHECK((*_env)->GetArrayLength (_env, target) == 33);
13719 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
13720 LDKCVec_ChannelDetailsZ first_hops_constr;
13721 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
13722 if (first_hops_constr.datalen > 0)
13723 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13725 first_hops_constr.data = NULL;
13726 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
13727 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13728 long arr_conv_16 = first_hops_vals[q];
13729 LDKChannelDetails arr_conv_16_conv;
13730 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13731 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13732 first_hops_constr.data[q] = arr_conv_16_conv;
13734 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
13735 LDKCVec_RouteHintZ last_hops_constr;
13736 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
13737 if (last_hops_constr.datalen > 0)
13738 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13740 last_hops_constr.data = NULL;
13741 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
13742 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
13743 long arr_conv_11 = last_hops_vals[l];
13744 LDKRouteHint arr_conv_11_conv;
13745 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
13746 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
13747 if (arr_conv_11_conv.inner != NULL)
13748 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
13749 last_hops_constr.data[l] = arr_conv_11_conv;
13751 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
13752 LDKLogger logger_conv = *(LDKLogger*)logger;
13753 if (logger_conv.free == LDKLogger_JCalls_free) {
13754 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13755 LDKLogger_JCalls_clone(logger_conv.this_arg);
13757 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13758 *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);
13759 FREE(first_hops_constr.data);
13760 return (long)ret_conv;
13763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13764 LDKNetworkGraph this_ptr_conv;
13765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13766 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13767 NetworkGraph_free(this_ptr_conv);
13770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13771 LDKLockedNetworkGraph this_ptr_conv;
13772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13773 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13774 LockedNetworkGraph_free(this_ptr_conv);
13777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13778 LDKNetGraphMsgHandler this_ptr_conv;
13779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13780 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13781 NetGraphMsgHandler_free(this_ptr_conv);
13784 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
13785 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13786 LDKLogger logger_conv = *(LDKLogger*)logger;
13787 if (logger_conv.free == LDKLogger_JCalls_free) {
13788 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13789 LDKLogger_JCalls_clone(logger_conv.this_arg);
13791 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
13792 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13793 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13794 long ret_ref = (long)ret_var.inner;
13795 if (ret_var.is_owned) {
13801 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
13802 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13803 LDKLogger logger_conv = *(LDKLogger*)logger;
13804 if (logger_conv.free == LDKLogger_JCalls_free) {
13805 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13806 LDKLogger_JCalls_clone(logger_conv.this_arg);
13808 LDKNetworkGraph network_graph_conv;
13809 network_graph_conv.inner = (void*)(network_graph & (~1));
13810 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
13811 // Warning: we may need a move here but can't clone!
13812 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
13813 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13814 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13815 long ret_ref = (long)ret_var.inner;
13816 if (ret_var.is_owned) {
13822 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13823 LDKNetGraphMsgHandler this_arg_conv;
13824 this_arg_conv.inner = (void*)(this_arg & (~1));
13825 this_arg_conv.is_owned = false;
13826 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
13827 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13828 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13829 long ret_ref = (long)ret_var.inner;
13830 if (ret_var.is_owned) {
13836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13837 LDKLockedNetworkGraph this_arg_conv;
13838 this_arg_conv.inner = (void*)(this_arg & (~1));
13839 this_arg_conv.is_owned = false;
13840 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
13841 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13842 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13843 long ret_ref = (long)ret_var.inner;
13844 if (ret_var.is_owned) {
13850 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
13851 LDKNetGraphMsgHandler this_arg_conv;
13852 this_arg_conv.inner = (void*)(this_arg & (~1));
13853 this_arg_conv.is_owned = false;
13854 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13855 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
13859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13860 LDKDirectionalChannelInfo this_ptr_conv;
13861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13863 DirectionalChannelInfo_free(this_ptr_conv);
13866 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
13867 LDKDirectionalChannelInfo this_ptr_conv;
13868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13869 this_ptr_conv.is_owned = false;
13870 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
13874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13875 LDKDirectionalChannelInfo this_ptr_conv;
13876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13877 this_ptr_conv.is_owned = false;
13878 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
13881 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
13882 LDKDirectionalChannelInfo this_ptr_conv;
13883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13884 this_ptr_conv.is_owned = false;
13885 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
13889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
13890 LDKDirectionalChannelInfo this_ptr_conv;
13891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13892 this_ptr_conv.is_owned = false;
13893 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
13896 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13897 LDKDirectionalChannelInfo this_ptr_conv;
13898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13899 this_ptr_conv.is_owned = false;
13900 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
13904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13905 LDKDirectionalChannelInfo this_ptr_conv;
13906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13907 this_ptr_conv.is_owned = false;
13908 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
13911 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13912 LDKDirectionalChannelInfo this_ptr_conv;
13913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13914 this_ptr_conv.is_owned = false;
13915 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
13919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13920 LDKDirectionalChannelInfo this_ptr_conv;
13921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13922 this_ptr_conv.is_owned = false;
13923 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
13926 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
13927 LDKDirectionalChannelInfo this_ptr_conv;
13928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13929 this_ptr_conv.is_owned = false;
13930 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
13931 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13932 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13933 long ret_ref = (long)ret_var.inner;
13934 if (ret_var.is_owned) {
13940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13941 LDKDirectionalChannelInfo this_ptr_conv;
13942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13943 this_ptr_conv.is_owned = false;
13944 LDKChannelUpdate val_conv;
13945 val_conv.inner = (void*)(val & (~1));
13946 val_conv.is_owned = (val & 1) || (val == 0);
13947 if (val_conv.inner != NULL)
13948 val_conv = ChannelUpdate_clone(&val_conv);
13949 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
13952 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13953 LDKDirectionalChannelInfo obj_conv;
13954 obj_conv.inner = (void*)(obj & (~1));
13955 obj_conv.is_owned = false;
13956 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
13957 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13958 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13959 CVec_u8Z_free(arg_var);
13963 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13964 LDKu8slice ser_ref;
13965 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13966 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13967 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
13968 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13969 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13970 long ret_ref = (long)ret_var.inner;
13971 if (ret_var.is_owned) {
13974 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13979 LDKChannelInfo this_ptr_conv;
13980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13981 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13982 ChannelInfo_free(this_ptr_conv);
13985 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13986 LDKChannelInfo this_ptr_conv;
13987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13988 this_ptr_conv.is_owned = false;
13989 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
13990 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13991 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13992 long ret_ref = (long)ret_var.inner;
13993 if (ret_var.is_owned) {
13999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14000 LDKChannelInfo this_ptr_conv;
14001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14002 this_ptr_conv.is_owned = false;
14003 LDKChannelFeatures val_conv;
14004 val_conv.inner = (void*)(val & (~1));
14005 val_conv.is_owned = (val & 1) || (val == 0);
14006 // Warning: we may need a move here but can't clone!
14007 ChannelInfo_set_features(&this_ptr_conv, val_conv);
14010 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
14011 LDKChannelInfo this_ptr_conv;
14012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14013 this_ptr_conv.is_owned = false;
14014 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14015 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
14019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14020 LDKChannelInfo this_ptr_conv;
14021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14022 this_ptr_conv.is_owned = false;
14023 LDKPublicKey val_ref;
14024 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14025 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14026 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
14029 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
14030 LDKChannelInfo this_ptr_conv;
14031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14032 this_ptr_conv.is_owned = false;
14033 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
14034 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14035 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14036 long ret_ref = (long)ret_var.inner;
14037 if (ret_var.is_owned) {
14043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14044 LDKChannelInfo this_ptr_conv;
14045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14046 this_ptr_conv.is_owned = false;
14047 LDKDirectionalChannelInfo val_conv;
14048 val_conv.inner = (void*)(val & (~1));
14049 val_conv.is_owned = (val & 1) || (val == 0);
14050 // Warning: we may need a move here but can't clone!
14051 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
14054 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
14055 LDKChannelInfo this_ptr_conv;
14056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14057 this_ptr_conv.is_owned = false;
14058 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14059 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
14063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14064 LDKChannelInfo this_ptr_conv;
14065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14066 this_ptr_conv.is_owned = false;
14067 LDKPublicKey val_ref;
14068 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14069 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14070 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
14073 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
14074 LDKChannelInfo this_ptr_conv;
14075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14076 this_ptr_conv.is_owned = false;
14077 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
14078 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14079 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14080 long ret_ref = (long)ret_var.inner;
14081 if (ret_var.is_owned) {
14087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14088 LDKChannelInfo this_ptr_conv;
14089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14090 this_ptr_conv.is_owned = false;
14091 LDKDirectionalChannelInfo val_conv;
14092 val_conv.inner = (void*)(val & (~1));
14093 val_conv.is_owned = (val & 1) || (val == 0);
14094 // Warning: we may need a move here but can't clone!
14095 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
14098 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14099 LDKChannelInfo this_ptr_conv;
14100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14101 this_ptr_conv.is_owned = false;
14102 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
14103 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14104 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14105 long ret_ref = (long)ret_var.inner;
14106 if (ret_var.is_owned) {
14112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14113 LDKChannelInfo this_ptr_conv;
14114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14115 this_ptr_conv.is_owned = false;
14116 LDKChannelAnnouncement val_conv;
14117 val_conv.inner = (void*)(val & (~1));
14118 val_conv.is_owned = (val & 1) || (val == 0);
14119 if (val_conv.inner != NULL)
14120 val_conv = ChannelAnnouncement_clone(&val_conv);
14121 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
14124 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14125 LDKChannelInfo obj_conv;
14126 obj_conv.inner = (void*)(obj & (~1));
14127 obj_conv.is_owned = false;
14128 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
14129 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14130 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14131 CVec_u8Z_free(arg_var);
14135 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14136 LDKu8slice ser_ref;
14137 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14138 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14139 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
14140 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14141 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14142 long ret_ref = (long)ret_var.inner;
14143 if (ret_var.is_owned) {
14146 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14151 LDKRoutingFees this_ptr_conv;
14152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14153 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14154 RoutingFees_free(this_ptr_conv);
14157 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
14158 LDKRoutingFees orig_conv;
14159 orig_conv.inner = (void*)(orig & (~1));
14160 orig_conv.is_owned = false;
14161 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
14162 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14163 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14164 long ret_ref = (long)ret_var.inner;
14165 if (ret_var.is_owned) {
14171 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
14172 LDKRoutingFees this_ptr_conv;
14173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14174 this_ptr_conv.is_owned = false;
14175 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
14179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14180 LDKRoutingFees this_ptr_conv;
14181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14182 this_ptr_conv.is_owned = false;
14183 RoutingFees_set_base_msat(&this_ptr_conv, val);
14186 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
14187 LDKRoutingFees this_ptr_conv;
14188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14189 this_ptr_conv.is_owned = false;
14190 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
14194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14195 LDKRoutingFees this_ptr_conv;
14196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14197 this_ptr_conv.is_owned = false;
14198 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
14201 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
14202 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
14203 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14204 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14205 long ret_ref = (long)ret_var.inner;
14206 if (ret_var.is_owned) {
14212 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14213 LDKu8slice ser_ref;
14214 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14215 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14216 LDKRoutingFees ret_var = RoutingFees_read(ser_ref);
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) {
14223 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14227 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
14228 LDKRoutingFees obj_conv;
14229 obj_conv.inner = (void*)(obj & (~1));
14230 obj_conv.is_owned = false;
14231 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
14232 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14233 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14234 CVec_u8Z_free(arg_var);
14238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14239 LDKNodeAnnouncementInfo this_ptr_conv;
14240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14241 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14242 NodeAnnouncementInfo_free(this_ptr_conv);
14245 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
14246 LDKNodeAnnouncementInfo this_ptr_conv;
14247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14248 this_ptr_conv.is_owned = false;
14249 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
14250 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14251 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14252 long ret_ref = (long)ret_var.inner;
14253 if (ret_var.is_owned) {
14259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14260 LDKNodeAnnouncementInfo this_ptr_conv;
14261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14262 this_ptr_conv.is_owned = false;
14263 LDKNodeFeatures val_conv;
14264 val_conv.inner = (void*)(val & (~1));
14265 val_conv.is_owned = (val & 1) || (val == 0);
14266 // Warning: we may need a move here but can't clone!
14267 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
14270 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
14271 LDKNodeAnnouncementInfo this_ptr_conv;
14272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14273 this_ptr_conv.is_owned = false;
14274 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
14278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14279 LDKNodeAnnouncementInfo this_ptr_conv;
14280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14281 this_ptr_conv.is_owned = false;
14282 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
14285 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
14286 LDKNodeAnnouncementInfo this_ptr_conv;
14287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14288 this_ptr_conv.is_owned = false;
14289 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
14290 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
14294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14295 LDKNodeAnnouncementInfo this_ptr_conv;
14296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14297 this_ptr_conv.is_owned = false;
14298 LDKThreeBytes val_ref;
14299 CHECK((*_env)->GetArrayLength (_env, val) == 3);
14300 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
14301 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
14304 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
14305 LDKNodeAnnouncementInfo this_ptr_conv;
14306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14307 this_ptr_conv.is_owned = false;
14308 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
14309 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
14313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14314 LDKNodeAnnouncementInfo this_ptr_conv;
14315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14316 this_ptr_conv.is_owned = false;
14317 LDKThirtyTwoBytes val_ref;
14318 CHECK((*_env)->GetArrayLength (_env, val) == 32);
14319 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
14320 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
14323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14324 LDKNodeAnnouncementInfo this_ptr_conv;
14325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14326 this_ptr_conv.is_owned = false;
14327 LDKCVec_NetAddressZ val_constr;
14328 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14329 if (val_constr.datalen > 0)
14330 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14332 val_constr.data = NULL;
14333 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14334 for (size_t m = 0; m < val_constr.datalen; m++) {
14335 long arr_conv_12 = val_vals[m];
14336 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14337 FREE((void*)arr_conv_12);
14338 val_constr.data[m] = arr_conv_12_conv;
14340 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14341 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
14344 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14345 LDKNodeAnnouncementInfo this_ptr_conv;
14346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14347 this_ptr_conv.is_owned = false;
14348 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
14349 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14350 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14351 long ret_ref = (long)ret_var.inner;
14352 if (ret_var.is_owned) {
14358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14359 LDKNodeAnnouncementInfo this_ptr_conv;
14360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14361 this_ptr_conv.is_owned = false;
14362 LDKNodeAnnouncement val_conv;
14363 val_conv.inner = (void*)(val & (~1));
14364 val_conv.is_owned = (val & 1) || (val == 0);
14365 if (val_conv.inner != NULL)
14366 val_conv = NodeAnnouncement_clone(&val_conv);
14367 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
14370 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) {
14371 LDKNodeFeatures features_arg_conv;
14372 features_arg_conv.inner = (void*)(features_arg & (~1));
14373 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
14374 // Warning: we may need a move here but can't clone!
14375 LDKThreeBytes rgb_arg_ref;
14376 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
14377 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
14378 LDKThirtyTwoBytes alias_arg_ref;
14379 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
14380 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
14381 LDKCVec_NetAddressZ addresses_arg_constr;
14382 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
14383 if (addresses_arg_constr.datalen > 0)
14384 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14386 addresses_arg_constr.data = NULL;
14387 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
14388 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
14389 long arr_conv_12 = addresses_arg_vals[m];
14390 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14391 FREE((void*)arr_conv_12);
14392 addresses_arg_constr.data[m] = arr_conv_12_conv;
14394 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
14395 LDKNodeAnnouncement announcement_message_arg_conv;
14396 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
14397 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
14398 if (announcement_message_arg_conv.inner != NULL)
14399 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
14400 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
14401 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14402 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14403 long ret_ref = (long)ret_var.inner;
14404 if (ret_var.is_owned) {
14410 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14411 LDKNodeAnnouncementInfo obj_conv;
14412 obj_conv.inner = (void*)(obj & (~1));
14413 obj_conv.is_owned = false;
14414 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
14415 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14416 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14417 CVec_u8Z_free(arg_var);
14421 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14422 LDKu8slice ser_ref;
14423 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14424 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14425 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_read(ser_ref);
14426 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14427 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14428 long ret_ref = (long)ret_var.inner;
14429 if (ret_var.is_owned) {
14432 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14437 LDKNodeInfo this_ptr_conv;
14438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14439 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14440 NodeInfo_free(this_ptr_conv);
14443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14444 LDKNodeInfo this_ptr_conv;
14445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14446 this_ptr_conv.is_owned = false;
14447 LDKCVec_u64Z val_constr;
14448 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14449 if (val_constr.datalen > 0)
14450 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14452 val_constr.data = NULL;
14453 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14454 for (size_t g = 0; g < val_constr.datalen; g++) {
14455 long arr_conv_6 = val_vals[g];
14456 val_constr.data[g] = arr_conv_6;
14458 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14459 NodeInfo_set_channels(&this_ptr_conv, val_constr);
14462 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
14463 LDKNodeInfo this_ptr_conv;
14464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14465 this_ptr_conv.is_owned = false;
14466 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
14467 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14468 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14469 long ret_ref = (long)ret_var.inner;
14470 if (ret_var.is_owned) {
14476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14477 LDKNodeInfo this_ptr_conv;
14478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14479 this_ptr_conv.is_owned = false;
14480 LDKRoutingFees val_conv;
14481 val_conv.inner = (void*)(val & (~1));
14482 val_conv.is_owned = (val & 1) || (val == 0);
14483 if (val_conv.inner != NULL)
14484 val_conv = RoutingFees_clone(&val_conv);
14485 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
14488 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
14489 LDKNodeInfo this_ptr_conv;
14490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14491 this_ptr_conv.is_owned = false;
14492 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
14493 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14494 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14495 long ret_ref = (long)ret_var.inner;
14496 if (ret_var.is_owned) {
14502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14503 LDKNodeInfo this_ptr_conv;
14504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14505 this_ptr_conv.is_owned = false;
14506 LDKNodeAnnouncementInfo val_conv;
14507 val_conv.inner = (void*)(val & (~1));
14508 val_conv.is_owned = (val & 1) || (val == 0);
14509 // Warning: we may need a move here but can't clone!
14510 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
14513 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) {
14514 LDKCVec_u64Z channels_arg_constr;
14515 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
14516 if (channels_arg_constr.datalen > 0)
14517 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14519 channels_arg_constr.data = NULL;
14520 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
14521 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
14522 long arr_conv_6 = channels_arg_vals[g];
14523 channels_arg_constr.data[g] = arr_conv_6;
14525 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
14526 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
14527 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
14528 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
14529 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
14530 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
14531 LDKNodeAnnouncementInfo announcement_info_arg_conv;
14532 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
14533 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
14534 // Warning: we may need a move here but can't clone!
14535 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
14536 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14537 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14538 long ret_ref = (long)ret_var.inner;
14539 if (ret_var.is_owned) {
14545 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14546 LDKNodeInfo obj_conv;
14547 obj_conv.inner = (void*)(obj & (~1));
14548 obj_conv.is_owned = false;
14549 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
14550 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14551 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14552 CVec_u8Z_free(arg_var);
14556 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14557 LDKu8slice ser_ref;
14558 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14559 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14560 LDKNodeInfo ret_var = NodeInfo_read(ser_ref);
14561 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14562 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14563 long ret_ref = (long)ret_var.inner;
14564 if (ret_var.is_owned) {
14567 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14571 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
14572 LDKNetworkGraph obj_conv;
14573 obj_conv.inner = (void*)(obj & (~1));
14574 obj_conv.is_owned = false;
14575 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
14576 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14577 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14578 CVec_u8Z_free(arg_var);
14582 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14583 LDKu8slice ser_ref;
14584 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14585 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14586 LDKNetworkGraph ret_var = NetworkGraph_read(ser_ref);
14587 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14588 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14589 long ret_ref = (long)ret_var.inner;
14590 if (ret_var.is_owned) {
14593 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14597 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
14598 LDKNetworkGraph ret_var = NetworkGraph_new();
14599 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14600 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14601 long ret_ref = (long)ret_var.inner;
14602 if (ret_var.is_owned) {
14608 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) {
14609 LDKNetworkGraph this_arg_conv;
14610 this_arg_conv.inner = (void*)(this_arg & (~1));
14611 this_arg_conv.is_owned = false;
14612 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);