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, jlong b) {
475 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
477 LDKTransaction b_conv = *(LDKTransaction*)b;
481 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
482 LDKC2TupleTempl_usize__Transaction *tuple = (LDKC2TupleTempl_usize__Transaction*)ptr;
485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
486 LDKC2TupleTempl_usize__Transaction *tuple = (LDKC2TupleTempl_usize__Transaction*)ptr;
487 LDKTransaction *b_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
489 long b_ref = (long)b_copy;
492 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
493 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
495 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
496 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
497 CHECK(val->result_ok);
498 return *val->contents.result;
500 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
501 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
502 CHECK(!val->result_ok);
503 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(_env, (*val->contents.err));
506 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
507 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
509 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
510 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
511 CHECK(val->result_ok);
512 return *val->contents.result;
514 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
515 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
516 CHECK(!val->result_ok);
517 LDKMonitorUpdateError err_var = (*val->contents.err);
518 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
519 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
520 long err_ref = (long)err_var.inner & ~1;
523 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
524 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
526 a_conv.inner = (void*)(a & (~1));
527 a_conv.is_owned = (a & 1) || (a == 0);
528 if (a_conv.inner != NULL)
529 a_conv = OutPoint_clone(&a_conv);
532 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
533 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
535 //TODO: Really need to call (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0); here
538 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
539 LDKC2TupleTempl_OutPoint__CVec_u8Z *tuple = (LDKC2TupleTempl_OutPoint__CVec_u8Z*)ptr;
540 LDKOutPoint a_var = tuple->a;
541 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
542 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
543 long a_ref = (long)a_var.inner & ~1;
546 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
547 LDKC2TupleTempl_OutPoint__CVec_u8Z *tuple = (LDKC2TupleTempl_OutPoint__CVec_u8Z*)ptr;
548 LDKCVec_u8Z b_var = tuple->b;
549 jbyteArray b_arr = (*_env)->NewByteArray(_env, b_var.datalen);
550 (*_env)->SetByteArrayRegion(_env, b_arr, 0, b_var.datalen, b_var.data);
553 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
554 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
555 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
558 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
559 ret->datalen = (*env)->GetArrayLength(env, elems);
560 if (ret->datalen == 0) {
563 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
564 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
565 for (size_t i = 0; i < ret->datalen; i++) {
566 jlong arr_elem = java_elems[i];
567 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
568 FREE((void*)arr_elem);
569 ret->data[i] = arr_elem_conv;
571 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
575 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlongArray b) {
576 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
577 LDKThirtyTwoBytes a_ref;
578 CHECK((*_env)->GetArrayLength (_env, a) == 32);
579 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
581 LDKCVecTempl_TxOut b_constr;
582 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
583 if (b_constr.datalen > 0)
584 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVecTempl_TxOut Elements");
586 b_constr.data = NULL;
587 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
588 for (size_t h = 0; h < b_constr.datalen; h++) {
589 long arr_conv_7 = b_vals[h];
590 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
591 FREE((void*)arr_conv_7);
592 b_constr.data[h] = arr_conv_7_conv;
594 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
598 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1TxOutZZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
599 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *tuple = (LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
600 jbyteArray a_arr = (*_env)->NewByteArray(_env, 32);
601 (*_env)->SetByteArrayRegion(_env, a_arr, 0, 32, tuple->a.data);
604 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1TxOutZZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
605 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *tuple = (LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
606 LDKCVecTempl_TxOut b_var = tuple->b;
607 jlongArray b_arr = (*_env)->NewLongArray(_env, b_var.datalen);
608 jlong *b_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, b_arr, NULL);
609 for (size_t h = 0; h < b_var.datalen; h++) {
610 long arr_conv_7_ref = (long)&b_var.data[h];
611 b_arr_ptr[h] = arr_conv_7_ref;
613 (*_env)->ReleasePrimitiveArrayCritical(_env, b_arr, b_arr_ptr, 0);
616 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
617 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
622 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
623 LDKC2TupleTempl_u64__u64 *tuple = (LDKC2TupleTempl_u64__u64*)ptr;
626 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
627 LDKC2TupleTempl_u64__u64 *tuple = (LDKC2TupleTempl_u64__u64*)ptr;
630 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
631 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
632 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
634 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jbyteArray a, jobjectArray b) {
635 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
637 CHECK((*_env)->GetArrayLength (_env, a) == 64);
638 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
640 LDKCVecTempl_Signature b_constr;
641 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
642 if (b_constr.datalen > 0)
643 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVecTempl_Signature Elements");
645 b_constr.data = NULL;
646 for (size_t i = 0; i < b_constr.datalen; i++) {
647 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
648 LDKSignature arr_conv_8_ref;
649 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
650 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
651 b_constr.data[i] = arr_conv_8_ref;
656 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
657 LDKC2TupleTempl_Signature__CVecTempl_Signature *tuple = (LDKC2TupleTempl_Signature__CVecTempl_Signature*)ptr;
658 jbyteArray a_arr = (*_env)->NewByteArray(_env, 64);
659 (*_env)->SetByteArrayRegion(_env, a_arr, 0, 64, tuple->a.compact_form);
662 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
663 LDKC2TupleTempl_Signature__CVecTempl_Signature *tuple = (LDKC2TupleTempl_Signature__CVecTempl_Signature*)ptr;
664 LDKCVecTempl_Signature b_var = tuple->b;
665 jobjectArray b_arr = (*_env)->NewObjectArray(_env, b_var.datalen, arr_of_B_clz, NULL);
666 for (size_t i = 0; i < b_var.datalen; i++) {
667 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
668 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, b_var.data[i].compact_form);
669 (*_env)->SetObjectArrayElement(_env, b_arr, i, arr_conv_8_arr);
673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
674 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
676 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
677 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
678 CHECK(val->result_ok);
679 long res_ref = (long)&(*val->contents.result);
682 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
683 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
684 CHECK(!val->result_ok);
685 return *val->contents.err;
687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
688 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
690 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
691 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
692 CHECK(val->result_ok);
693 jbyteArray res_arr = (*_env)->NewByteArray(_env, 64);
694 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 64, (*val->contents.result).compact_form);
697 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
698 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
699 CHECK(!val->result_ok);
700 return *val->contents.err;
702 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
703 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
705 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
706 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
707 CHECK(val->result_ok);
708 LDKCVecTempl_Signature res_var = (*val->contents.result);
709 jobjectArray res_arr = (*_env)->NewObjectArray(_env, res_var.datalen, arr_of_B_clz, NULL);
710 for (size_t i = 0; i < res_var.datalen; i++) {
711 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
712 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
713 (*_env)->SetObjectArrayElement(_env, res_arr, i, arr_conv_8_arr);
717 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
718 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
719 CHECK(!val->result_ok);
720 return *val->contents.err;
722 static jclass LDKAPIError_APIMisuseError_class = NULL;
723 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
724 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
725 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
726 static jclass LDKAPIError_RouteError_class = NULL;
727 static jmethodID LDKAPIError_RouteError_meth = NULL;
728 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
729 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
730 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
731 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
733 LDKAPIError_APIMisuseError_class =
734 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
735 CHECK(LDKAPIError_APIMisuseError_class != NULL);
736 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
737 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
738 LDKAPIError_FeeRateTooHigh_class =
739 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
740 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
741 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
742 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
743 LDKAPIError_RouteError_class =
744 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
745 CHECK(LDKAPIError_RouteError_class != NULL);
746 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
747 CHECK(LDKAPIError_RouteError_meth != NULL);
748 LDKAPIError_ChannelUnavailable_class =
749 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
750 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
751 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
752 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
753 LDKAPIError_MonitorUpdateFailed_class =
754 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
755 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
756 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
757 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
759 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
760 LDKAPIError *obj = (LDKAPIError*)ptr;
762 case LDKAPIError_APIMisuseError: {
763 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
764 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
765 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
766 return (*_env)->NewObject(_env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
768 case LDKAPIError_FeeRateTooHigh: {
769 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
770 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
771 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
772 return (*_env)->NewObject(_env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
774 case LDKAPIError_RouteError: {
775 LDKStr err_str = obj->route_error.err;
776 char* err_buf = MALLOC(err_str.len + 1, "str conv buf");
777 memcpy(err_buf, err_str.chars, err_str.len);
778 err_buf[err_str.len] = 0;
779 jstring err_conv = (*_env)->NewStringUTF(_env, err_str.chars);
781 return (*_env)->NewObject(_env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
783 case LDKAPIError_ChannelUnavailable: {
784 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
785 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
786 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
787 return (*_env)->NewObject(_env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
789 case LDKAPIError_MonitorUpdateFailed: {
790 return (*_env)->NewObject(_env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
795 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
796 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
798 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
799 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
800 CHECK(val->result_ok);
801 return *val->contents.result;
803 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
804 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
805 CHECK(!val->result_ok);
806 long err_ref = (long)&(*val->contents.err);
809 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
810 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
812 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
813 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
814 CHECK(val->result_ok);
815 return *val->contents.result;
817 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
818 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
819 CHECK(!val->result_ok);
820 LDKPaymentSendFailure err_var = (*val->contents.err);
821 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
822 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
823 long err_ref = (long)err_var.inner & ~1;
826 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) {
827 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
828 LDKChannelAnnouncement a_conv;
829 a_conv.inner = (void*)(a & (~1));
830 a_conv.is_owned = (a & 1) || (a == 0);
831 if (a_conv.inner != NULL)
832 a_conv = ChannelAnnouncement_clone(&a_conv);
834 LDKChannelUpdate b_conv;
835 b_conv.inner = (void*)(b & (~1));
836 b_conv.is_owned = (b & 1) || (b == 0);
837 if (b_conv.inner != NULL)
838 b_conv = ChannelUpdate_clone(&b_conv);
840 LDKChannelUpdate c_conv;
841 c_conv.inner = (void*)(c & (~1));
842 c_conv.is_owned = (c & 1) || (c == 0);
843 if (c_conv.inner != NULL)
844 c_conv = ChannelUpdate_clone(&c_conv);
848 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
849 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
850 LDKChannelAnnouncement a_var = tuple->a;
851 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
852 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
853 long a_ref = (long)a_var.inner & ~1;
856 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
857 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
858 LDKChannelUpdate b_var = tuple->b;
859 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
860 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
861 long b_ref = (long)b_var.inner & ~1;
864 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *_env, jclass _b, jlong ptr) {
865 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
866 LDKChannelUpdate c_var = tuple->c;
867 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
868 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
869 long c_ref = (long)c_var.inner & ~1;
872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
873 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
875 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
876 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
877 CHECK(val->result_ok);
878 return *val->contents.result;
880 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
881 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
882 CHECK(!val->result_ok);
883 LDKPeerHandleError err_var = (*val->contents.err);
884 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
885 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
886 long err_ref = (long)err_var.inner & ~1;
889 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
890 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
891 LDKHTLCOutputInCommitment a_conv;
892 a_conv.inner = (void*)(a & (~1));
893 a_conv.is_owned = (a & 1) || (a == 0);
894 if (a_conv.inner != NULL)
895 a_conv = HTLCOutputInCommitment_clone(&a_conv);
898 CHECK((*_env)->GetArrayLength (_env, b) == 64);
899 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
903 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1HTLCOutputInCommitmentSignatureZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
904 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *tuple = (LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
905 LDKHTLCOutputInCommitment a_var = tuple->a;
906 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
907 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
908 long a_ref = (long)a_var.inner & ~1;
911 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1HTLCOutputInCommitmentSignatureZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
912 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *tuple = (LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
913 jbyteArray b_arr = (*_env)->NewByteArray(_env, 64);
914 (*_env)->SetByteArrayRegion(_env, b_arr, 0, 64, tuple->b.compact_form);
917 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
918 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
919 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
920 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
921 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
922 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
924 LDKSpendableOutputDescriptor_StaticOutput_class =
925 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
926 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
927 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
928 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
929 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
930 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
931 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
932 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
933 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
934 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
935 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
936 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
937 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
938 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
940 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
941 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
943 case LDKSpendableOutputDescriptor_StaticOutput: {
944 LDKOutPoint outpoint_var = obj->static_output.outpoint;
945 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
946 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
947 long outpoint_ref = (long)outpoint_var.inner & ~1;
948 long output_ref = (long)&obj->static_output.output;
949 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
951 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
952 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
953 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
954 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
955 long outpoint_ref = (long)outpoint_var.inner & ~1;
956 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
957 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
958 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
959 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
960 jbyteArray revocation_pubkey_arr = (*_env)->NewByteArray(_env, 33);
961 (*_env)->SetByteArrayRegion(_env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
962 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);
964 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
965 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
966 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
967 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
968 long outpoint_ref = (long)outpoint_var.inner & ~1;
969 long output_ref = (long)&obj->static_output_counterparty_payment.output;
970 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
971 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
976 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
977 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
978 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
980 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
981 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
982 ret->datalen = (*env)->GetArrayLength(env, elems);
983 if (ret->datalen == 0) {
986 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
987 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
988 for (size_t i = 0; i < ret->datalen; i++) {
989 jlong arr_elem = java_elems[i];
990 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
991 FREE((void*)arr_elem);
992 ret->data[i] = arr_elem_conv;
994 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
998 static jclass LDKEvent_FundingGenerationReady_class = NULL;
999 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
1000 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
1001 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
1002 static jclass LDKEvent_PaymentReceived_class = NULL;
1003 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
1004 static jclass LDKEvent_PaymentSent_class = NULL;
1005 static jmethodID LDKEvent_PaymentSent_meth = NULL;
1006 static jclass LDKEvent_PaymentFailed_class = NULL;
1007 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
1008 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
1009 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
1010 static jclass LDKEvent_SpendableOutputs_class = NULL;
1011 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
1012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
1013 LDKEvent_FundingGenerationReady_class =
1014 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
1015 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
1016 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
1017 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
1018 LDKEvent_FundingBroadcastSafe_class =
1019 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
1020 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
1021 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
1022 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
1023 LDKEvent_PaymentReceived_class =
1024 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
1025 CHECK(LDKEvent_PaymentReceived_class != NULL);
1026 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
1027 CHECK(LDKEvent_PaymentReceived_meth != NULL);
1028 LDKEvent_PaymentSent_class =
1029 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
1030 CHECK(LDKEvent_PaymentSent_class != NULL);
1031 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
1032 CHECK(LDKEvent_PaymentSent_meth != NULL);
1033 LDKEvent_PaymentFailed_class =
1034 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
1035 CHECK(LDKEvent_PaymentFailed_class != NULL);
1036 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
1037 CHECK(LDKEvent_PaymentFailed_meth != NULL);
1038 LDKEvent_PendingHTLCsForwardable_class =
1039 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
1040 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
1041 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
1042 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
1043 LDKEvent_SpendableOutputs_class =
1044 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
1045 CHECK(LDKEvent_SpendableOutputs_class != NULL);
1046 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
1047 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
1049 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1050 LDKEvent *obj = (LDKEvent*)ptr;
1052 case LDKEvent_FundingGenerationReady: {
1053 jbyteArray temporary_channel_id_arr = (*_env)->NewByteArray(_env, 32);
1054 (*_env)->SetByteArrayRegion(_env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
1055 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1056 jbyteArray output_script_arr = (*_env)->NewByteArray(_env, output_script_var.datalen);
1057 (*_env)->SetByteArrayRegion(_env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
1058 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);
1060 case LDKEvent_FundingBroadcastSafe: {
1061 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1062 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1063 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1064 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1065 return (*_env)->NewObject(_env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
1067 case LDKEvent_PaymentReceived: {
1068 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
1069 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
1070 jbyteArray payment_secret_arr = (*_env)->NewByteArray(_env, 32);
1071 (*_env)->SetByteArrayRegion(_env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
1072 return (*_env)->NewObject(_env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
1074 case LDKEvent_PaymentSent: {
1075 jbyteArray payment_preimage_arr = (*_env)->NewByteArray(_env, 32);
1076 (*_env)->SetByteArrayRegion(_env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
1077 return (*_env)->NewObject(_env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
1079 case LDKEvent_PaymentFailed: {
1080 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
1081 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
1082 return (*_env)->NewObject(_env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
1084 case LDKEvent_PendingHTLCsForwardable: {
1085 return (*_env)->NewObject(_env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
1087 case LDKEvent_SpendableOutputs: {
1088 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1089 jlongArray outputs_arr = (*_env)->NewLongArray(_env, outputs_var.datalen);
1090 jlong *outputs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, outputs_arr, NULL);
1091 for (size_t b = 0; b < outputs_var.datalen; b++) {
1092 long arr_conv_27_ref = (long)&outputs_var.data[b];
1093 outputs_arr_ptr[b] = arr_conv_27_ref;
1095 (*_env)->ReleasePrimitiveArrayCritical(_env, outputs_arr, outputs_arr_ptr, 0);
1096 return (*_env)->NewObject(_env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
1101 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1102 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1103 static jclass LDKErrorAction_IgnoreError_class = NULL;
1104 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1105 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1106 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
1108 LDKErrorAction_DisconnectPeer_class =
1109 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1110 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1111 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1112 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1113 LDKErrorAction_IgnoreError_class =
1114 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1115 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1116 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1117 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1118 LDKErrorAction_SendErrorMessage_class =
1119 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1120 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1121 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1122 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1124 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1125 LDKErrorAction *obj = (LDKErrorAction*)ptr;
1127 case LDKErrorAction_DisconnectPeer: {
1128 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1129 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1130 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1131 long msg_ref = (long)msg_var.inner & ~1;
1132 return (*_env)->NewObject(_env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1134 case LDKErrorAction_IgnoreError: {
1135 return (*_env)->NewObject(_env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1137 case LDKErrorAction_SendErrorMessage: {
1138 LDKErrorMessage msg_var = obj->send_error_message.msg;
1139 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1140 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1141 long msg_ref = (long)msg_var.inner & ~1;
1142 return (*_env)->NewObject(_env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1147 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1148 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1149 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1150 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1151 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1152 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
1154 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1155 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1156 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1157 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1158 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1159 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1160 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1161 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1162 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1163 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1164 LDKHTLCFailChannelUpdate_NodeFailure_class =
1165 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1166 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1167 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1168 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1170 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1171 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
1173 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1174 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1175 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1176 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1177 long msg_ref = (long)msg_var.inner & ~1;
1178 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1180 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1181 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1183 case LDKHTLCFailChannelUpdate_NodeFailure: {
1184 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1185 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1186 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1191 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1192 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1193 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1194 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1195 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1196 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1197 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1198 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1199 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1200 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1201 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1202 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1203 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1204 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1205 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1206 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1207 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1208 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1209 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1210 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1211 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1212 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1213 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1214 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1215 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1216 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1217 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1218 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1219 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1220 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1221 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1222 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1224 LDKMessageSendEvent_SendAcceptChannel_class =
1225 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1226 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1227 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1228 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1229 LDKMessageSendEvent_SendOpenChannel_class =
1230 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1231 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1232 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1233 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1234 LDKMessageSendEvent_SendFundingCreated_class =
1235 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1236 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1237 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1238 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1239 LDKMessageSendEvent_SendFundingSigned_class =
1240 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1241 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1242 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1243 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1244 LDKMessageSendEvent_SendFundingLocked_class =
1245 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1246 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1247 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1248 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1249 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1250 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1251 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1252 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1253 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1254 LDKMessageSendEvent_UpdateHTLCs_class =
1255 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1256 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1257 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1258 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1259 LDKMessageSendEvent_SendRevokeAndACK_class =
1260 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1261 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1262 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1263 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1264 LDKMessageSendEvent_SendClosingSigned_class =
1265 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1266 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1267 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1268 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1269 LDKMessageSendEvent_SendShutdown_class =
1270 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1271 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1272 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1273 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1274 LDKMessageSendEvent_SendChannelReestablish_class =
1275 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1276 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1277 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1278 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1279 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1280 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1281 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1282 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1283 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1284 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1285 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1286 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1287 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1288 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1289 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1290 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1291 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1292 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1293 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1294 LDKMessageSendEvent_HandleError_class =
1295 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1296 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1297 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1298 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1299 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1300 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1301 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1302 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1303 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1305 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1306 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1308 case LDKMessageSendEvent_SendAcceptChannel: {
1309 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1310 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1311 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1312 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1313 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1314 long msg_ref = (long)msg_var.inner & ~1;
1315 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1317 case LDKMessageSendEvent_SendOpenChannel: {
1318 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1319 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1320 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1321 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1322 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1323 long msg_ref = (long)msg_var.inner & ~1;
1324 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1326 case LDKMessageSendEvent_SendFundingCreated: {
1327 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1328 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1329 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1330 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1331 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1332 long msg_ref = (long)msg_var.inner & ~1;
1333 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1335 case LDKMessageSendEvent_SendFundingSigned: {
1336 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1337 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1338 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1339 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1340 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1341 long msg_ref = (long)msg_var.inner & ~1;
1342 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1344 case LDKMessageSendEvent_SendFundingLocked: {
1345 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1346 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1347 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1348 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1349 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1350 long msg_ref = (long)msg_var.inner & ~1;
1351 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1353 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1354 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1355 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1356 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1357 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1358 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1359 long msg_ref = (long)msg_var.inner & ~1;
1360 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1362 case LDKMessageSendEvent_UpdateHTLCs: {
1363 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1364 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1365 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1366 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1367 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1368 long updates_ref = (long)updates_var.inner & ~1;
1369 return (*_env)->NewObject(_env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1371 case LDKMessageSendEvent_SendRevokeAndACK: {
1372 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1373 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1374 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1375 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1376 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1377 long msg_ref = (long)msg_var.inner & ~1;
1378 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1380 case LDKMessageSendEvent_SendClosingSigned: {
1381 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1382 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1383 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1384 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1385 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1386 long msg_ref = (long)msg_var.inner & ~1;
1387 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1389 case LDKMessageSendEvent_SendShutdown: {
1390 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1391 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1392 LDKShutdown msg_var = obj->send_shutdown.msg;
1393 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1394 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1395 long msg_ref = (long)msg_var.inner & ~1;
1396 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1398 case LDKMessageSendEvent_SendChannelReestablish: {
1399 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1400 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1401 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1402 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1403 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1404 long msg_ref = (long)msg_var.inner & ~1;
1405 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1407 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1408 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1409 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1410 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1411 long msg_ref = (long)msg_var.inner & ~1;
1412 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1413 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1414 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1415 long update_msg_ref = (long)update_msg_var.inner & ~1;
1416 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1418 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1419 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1420 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1421 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1422 long msg_ref = (long)msg_var.inner & ~1;
1423 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1425 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1426 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1427 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1428 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1429 long msg_ref = (long)msg_var.inner & ~1;
1430 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1432 case LDKMessageSendEvent_HandleError: {
1433 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1434 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1435 long action_ref = (long)&obj->handle_error.action;
1436 return (*_env)->NewObject(_env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1438 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1439 long update_ref = (long)&obj->payment_failure_network_update.update;
1440 return (*_env)->NewObject(_env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1445 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1446 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1447 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1449 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1450 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1451 ret->datalen = (*env)->GetArrayLength(env, elems);
1452 if (ret->datalen == 0) {
1455 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1456 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1457 for (size_t i = 0; i < ret->datalen; i++) {
1458 jlong arr_elem = java_elems[i];
1459 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1460 FREE((void*)arr_elem);
1461 ret->data[i] = arr_elem_conv;
1463 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1467 typedef struct LDKMessageSendEventsProvider_JCalls {
1468 atomic_size_t refcnt;
1471 jmethodID get_and_clear_pending_msg_events_meth;
1472 } LDKMessageSendEventsProvider_JCalls;
1473 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1474 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1476 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1477 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1479 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1480 LDKCVec_MessageSendEventZ arg_constr;
1481 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
1482 if (arg_constr.datalen > 0)
1483 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
1485 arg_constr.data = NULL;
1486 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
1487 for (size_t s = 0; s < arg_constr.datalen; s++) {
1488 long arr_conv_18 = arg_vals[s];
1489 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
1490 FREE((void*)arr_conv_18);
1491 arg_constr.data[s] = arr_conv_18_conv;
1493 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
1496 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1497 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1498 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1500 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1501 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1505 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1506 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1507 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1508 return (void*) this_arg;
1510 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1511 jclass c = (*env)->GetObjectClass(env, o);
1513 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1514 atomic_init(&calls->refcnt, 1);
1515 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1516 calls->o = (*env)->NewWeakGlobalRef(env, o);
1517 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
1518 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
1520 LDKMessageSendEventsProvider ret = {
1521 .this_arg = (void*) calls,
1522 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1523 .free = LDKMessageSendEventsProvider_JCalls_free,
1527 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1528 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1529 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1530 return (long)res_ptr;
1532 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1533 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1537 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1538 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1539 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1540 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1541 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1542 for (size_t s = 0; s < ret_var.datalen; s++) {
1543 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
1544 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
1545 long arr_conv_18_ref = (long)arr_conv_18_copy;
1546 ret_arr_ptr[s] = arr_conv_18_ref;
1548 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1549 CVec_MessageSendEventZ_free(ret_var);
1553 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1554 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1555 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1558 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1559 ret->datalen = (*env)->GetArrayLength(env, elems);
1560 if (ret->datalen == 0) {
1563 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1564 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1565 for (size_t i = 0; i < ret->datalen; i++) {
1566 jlong arr_elem = java_elems[i];
1567 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1568 FREE((void*)arr_elem);
1569 ret->data[i] = arr_elem_conv;
1571 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1575 typedef struct LDKEventsProvider_JCalls {
1576 atomic_size_t refcnt;
1579 jmethodID get_and_clear_pending_events_meth;
1580 } LDKEventsProvider_JCalls;
1581 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1582 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1584 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1585 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1587 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_events_meth);
1588 LDKCVec_EventZ arg_constr;
1589 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
1590 if (arg_constr.datalen > 0)
1591 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
1593 arg_constr.data = NULL;
1594 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
1595 for (size_t h = 0; h < arg_constr.datalen; h++) {
1596 long arr_conv_7 = arg_vals[h];
1597 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
1598 FREE((void*)arr_conv_7);
1599 arg_constr.data[h] = arr_conv_7_conv;
1601 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
1604 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1605 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1606 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1608 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1609 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1613 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1614 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1615 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1616 return (void*) this_arg;
1618 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1619 jclass c = (*env)->GetObjectClass(env, o);
1621 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1622 atomic_init(&calls->refcnt, 1);
1623 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1624 calls->o = (*env)->NewWeakGlobalRef(env, o);
1625 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
1626 CHECK(calls->get_and_clear_pending_events_meth != NULL);
1628 LDKEventsProvider ret = {
1629 .this_arg = (void*) calls,
1630 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1631 .free = LDKEventsProvider_JCalls_free,
1635 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1636 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1637 *res_ptr = LDKEventsProvider_init(env, _a, o);
1638 return (long)res_ptr;
1640 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1641 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1645 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1646 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1647 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1648 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1649 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1650 for (size_t h = 0; h < ret_var.datalen; h++) {
1651 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
1652 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
1653 long arr_conv_7_ref = (long)arr_conv_7_copy;
1654 ret_arr_ptr[h] = arr_conv_7_ref;
1656 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1657 CVec_EventZ_free(ret_var);
1661 typedef struct LDKLogger_JCalls {
1662 atomic_size_t refcnt;
1667 void log_jcall(const void* this_arg, const char *record) {
1668 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1670 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1671 jstring record_conv = (*_env)->NewStringUTF(_env, record);
1672 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1674 return (*_env)->CallVoidMethod(_env, obj, j_calls->log_meth, record_conv);
1676 static void LDKLogger_JCalls_free(void* this_arg) {
1677 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1678 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1680 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1681 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1685 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1686 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1687 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1688 return (void*) this_arg;
1690 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1691 jclass c = (*env)->GetObjectClass(env, o);
1693 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1694 atomic_init(&calls->refcnt, 1);
1695 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1696 calls->o = (*env)->NewWeakGlobalRef(env, o);
1697 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1698 CHECK(calls->log_meth != NULL);
1701 .this_arg = (void*) calls,
1703 .free = LDKLogger_JCalls_free,
1707 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1708 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1709 *res_ptr = LDKLogger_init(env, _a, o);
1710 return (long)res_ptr;
1712 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1713 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1717 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1718 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1720 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1721 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1722 CHECK(val->result_ok);
1723 long res_ref = (long)&(*val->contents.result);
1726 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1727 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1728 CHECK(!val->result_ok);
1729 jclass err_conv = LDKAccessError_to_java(_env, (*val->contents.err));
1732 typedef struct LDKAccess_JCalls {
1733 atomic_size_t refcnt;
1736 jmethodID get_utxo_meth;
1738 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1739 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1741 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1742 jbyteArray genesis_hash_arr = (*_env)->NewByteArray(_env, 32);
1743 (*_env)->SetByteArrayRegion(_env, genesis_hash_arr, 0, 32, *genesis_hash);
1744 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1746 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1747 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)ret;
1751 static void LDKAccess_JCalls_free(void* this_arg) {
1752 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1753 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1755 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1756 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1760 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1761 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1762 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1763 return (void*) this_arg;
1765 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1766 jclass c = (*env)->GetObjectClass(env, o);
1768 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1769 atomic_init(&calls->refcnt, 1);
1770 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1771 calls->o = (*env)->NewWeakGlobalRef(env, o);
1772 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1773 CHECK(calls->get_utxo_meth != NULL);
1776 .this_arg = (void*) calls,
1777 .get_utxo = get_utxo_jcall,
1778 .free = LDKAccess_JCalls_free,
1782 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1783 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1784 *res_ptr = LDKAccess_init(env, _a, o);
1785 return (long)res_ptr;
1787 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1788 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1792 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) {
1793 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1794 unsigned char genesis_hash_arr[32];
1795 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
1796 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1797 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1798 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1799 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1800 return (long)ret_conv;
1803 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1804 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1805 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1806 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1807 for (size_t i = 0; i < vec->datalen; i++) {
1808 CHECK((((long)vec->data[i].inner) & 1) == 0);
1809 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1811 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1814 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1815 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1816 ret->datalen = (*env)->GetArrayLength(env, elems);
1817 if (ret->datalen == 0) {
1820 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1821 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1822 for (size_t i = 0; i < ret->datalen; i++) {
1823 jlong arr_elem = java_elems[i];
1824 LDKHTLCOutputInCommitment arr_elem_conv;
1825 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1826 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1827 if (arr_elem_conv.inner != NULL)
1828 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1829 ret->data[i] = arr_elem_conv;
1831 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1835 typedef struct LDKChannelKeys_JCalls {
1836 atomic_size_t refcnt;
1839 jmethodID get_per_commitment_point_meth;
1840 jmethodID release_commitment_secret_meth;
1841 jmethodID key_derivation_params_meth;
1842 jmethodID sign_counterparty_commitment_meth;
1843 jmethodID sign_holder_commitment_meth;
1844 jmethodID sign_holder_commitment_htlc_transactions_meth;
1845 jmethodID sign_justice_transaction_meth;
1846 jmethodID sign_counterparty_htlc_transaction_meth;
1847 jmethodID sign_closing_transaction_meth;
1848 jmethodID sign_channel_announcement_meth;
1849 jmethodID on_accept_meth;
1850 } LDKChannelKeys_JCalls;
1851 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1852 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1854 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1855 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1857 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_per_commitment_point_meth, idx);
1858 LDKPublicKey arg_ref;
1859 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
1860 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
1863 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1864 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1866 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1867 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1869 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_commitment_secret_meth, idx);
1870 LDKThirtyTwoBytes arg_ref;
1871 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
1872 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
1875 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1876 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1878 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1879 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1881 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*_env)->CallLongMethod(_env, obj, j_calls->key_derivation_params_meth);
1882 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)ret;
1886 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) {
1887 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1889 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1890 LDKTransaction *commitment_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1891 *commitment_tx_copy = commitment_tx;
1892 long commitment_tx_ref = (long)commitment_tx_copy;
1893 LDKPreCalculatedTxCreationKeys keys_var = *keys;
1894 if (keys->inner != NULL)
1895 keys_var = PreCalculatedTxCreationKeys_clone(keys);
1896 CHECK((((long)keys_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1897 CHECK((((long)&keys_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1898 long keys_ref = (long)keys_var.inner & ~1;
1899 LDKCVec_HTLCOutputInCommitmentZ htlcs_var = htlcs;
1900 jlongArray htlcs_arr = (*_env)->NewLongArray(_env, htlcs_var.datalen);
1901 jlong *htlcs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, htlcs_arr, NULL);
1902 for (size_t y = 0; y < htlcs_var.datalen; y++) {
1903 LDKHTLCOutputInCommitment arr_conv_24_var = htlcs_var.data[y];
1904 CHECK((((long)arr_conv_24_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1905 CHECK((((long)&arr_conv_24_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1906 long arr_conv_24_ref = (long)arr_conv_24_var.inner;
1907 if (arr_conv_24_var.is_owned) {
1908 arr_conv_24_ref |= 1;
1910 htlcs_arr_ptr[y] = arr_conv_24_ref;
1912 (*_env)->ReleasePrimitiveArrayCritical(_env, htlcs_arr, htlcs_arr_ptr, 0);
1913 FREE(htlcs_var.data);
1914 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1916 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_counterparty_commitment_meth, feerate_per_kw, commitment_tx_ref, keys_ref, htlcs_arr);
1917 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret;
1921 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1922 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1924 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1925 LDKHolderCommitmentTransaction holder_commitment_tx_var = *holder_commitment_tx;
1926 if (holder_commitment_tx->inner != NULL)
1927 holder_commitment_tx_var = HolderCommitmentTransaction_clone(holder_commitment_tx);
1928 CHECK((((long)holder_commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1929 CHECK((((long)&holder_commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1930 long holder_commitment_tx_ref = (long)holder_commitment_tx_var.inner & ~1;
1931 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1933 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx_ref);
1934 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1938 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1939 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1941 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1942 LDKHolderCommitmentTransaction holder_commitment_tx_var = *holder_commitment_tx;
1943 if (holder_commitment_tx->inner != NULL)
1944 holder_commitment_tx_var = HolderCommitmentTransaction_clone(holder_commitment_tx);
1945 CHECK((((long)holder_commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1946 CHECK((((long)&holder_commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1947 long holder_commitment_tx_ref = (long)holder_commitment_tx_var.inner & ~1;
1948 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1950 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx_ref);
1951 LDKCResult_CVec_SignatureZNoneZ ret_conv = *(LDKCResult_CVec_SignatureZNoneZ*)ret;
1955 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) {
1956 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1958 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1959 LDKTransaction *justice_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1960 *justice_tx_copy = justice_tx;
1961 long justice_tx_ref = (long)justice_tx_copy;
1962 jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32);
1963 (*_env)->SetByteArrayRegion(_env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1964 LDKHTLCOutputInCommitment htlc_var = *htlc;
1965 if (htlc->inner != NULL)
1966 htlc_var = HTLCOutputInCommitment_clone(htlc);
1967 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1968 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1969 long htlc_ref = (long)htlc_var.inner & ~1;
1970 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1972 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_justice_transaction_meth, justice_tx_ref, input, amount, per_commitment_key_arr, htlc_ref);
1973 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1977 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) {
1978 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1980 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1981 LDKTransaction *htlc_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1982 *htlc_tx_copy = htlc_tx;
1983 long htlc_tx_ref = (long)htlc_tx_copy;
1984 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
1985 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1986 LDKHTLCOutputInCommitment htlc_var = *htlc;
1987 if (htlc->inner != NULL)
1988 htlc_var = HTLCOutputInCommitment_clone(htlc);
1989 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1990 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1991 long htlc_ref = (long)htlc_var.inner & ~1;
1992 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1994 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_ref, input, amount, per_commitment_point_arr, htlc_ref);
1995 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1999 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
2000 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2002 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2003 LDKTransaction *closing_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
2004 *closing_tx_copy = closing_tx;
2005 long closing_tx_ref = (long)closing_tx_copy;
2006 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2008 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
2009 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
2013 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
2014 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2016 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2017 LDKUnsignedChannelAnnouncement msg_var = *msg;
2018 if (msg->inner != NULL)
2019 msg_var = UnsignedChannelAnnouncement_clone(msg);
2020 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2021 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2022 long msg_ref = (long)msg_var.inner & ~1;
2023 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2025 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2026 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
2030 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
2031 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2033 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2034 LDKChannelPublicKeys channel_points_var = *channel_points;
2035 if (channel_points->inner != NULL)
2036 channel_points_var = ChannelPublicKeys_clone(channel_points);
2037 CHECK((((long)channel_points_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2038 CHECK((((long)&channel_points_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2039 long channel_points_ref = (long)channel_points_var.inner & ~1;
2040 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2042 return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, channel_points_ref, counterparty_selected_contest_delay, holder_selected_contest_delay);
2044 static void LDKChannelKeys_JCalls_free(void* this_arg) {
2045 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2046 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2048 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2049 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2053 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
2054 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2055 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2056 return (void*) this_arg;
2058 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
2059 jclass c = (*env)->GetObjectClass(env, o);
2061 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
2062 atomic_init(&calls->refcnt, 1);
2063 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2064 calls->o = (*env)->NewWeakGlobalRef(env, o);
2065 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2066 CHECK(calls->get_per_commitment_point_meth != NULL);
2067 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2068 CHECK(calls->release_commitment_secret_meth != NULL);
2069 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
2070 CHECK(calls->key_derivation_params_meth != NULL);
2071 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJ[J)J");
2072 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2073 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
2074 CHECK(calls->sign_holder_commitment_meth != NULL);
2075 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
2076 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
2077 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
2078 CHECK(calls->sign_justice_transaction_meth != NULL);
2079 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
2080 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2081 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
2082 CHECK(calls->sign_closing_transaction_meth != NULL);
2083 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2084 CHECK(calls->sign_channel_announcement_meth != NULL);
2085 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
2086 CHECK(calls->on_accept_meth != NULL);
2088 LDKChannelPublicKeys pubkeys_conv;
2089 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2090 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2091 if (pubkeys_conv.inner != NULL)
2092 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2094 LDKChannelKeys ret = {
2095 .this_arg = (void*) calls,
2096 .get_per_commitment_point = get_per_commitment_point_jcall,
2097 .release_commitment_secret = release_commitment_secret_jcall,
2098 .key_derivation_params = key_derivation_params_jcall,
2099 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
2100 .sign_holder_commitment = sign_holder_commitment_jcall,
2101 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
2102 .sign_justice_transaction = sign_justice_transaction_jcall,
2103 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
2104 .sign_closing_transaction = sign_closing_transaction_jcall,
2105 .sign_channel_announcement = sign_channel_announcement_jcall,
2106 .on_accept = on_accept_jcall,
2107 .clone = LDKChannelKeys_JCalls_clone,
2108 .free = LDKChannelKeys_JCalls_free,
2109 .pubkeys = pubkeys_conv,
2110 .set_pubkeys = NULL,
2114 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
2115 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2116 *res_ptr = LDKChannelKeys_init(env, _a, o, pubkeys);
2117 return (long)res_ptr;
2119 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2120 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
2124 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2125 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2126 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2127 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2131 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2132 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2133 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2134 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2138 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
2139 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2140 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2141 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
2142 return (long)ret_ref;
2145 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jint feerate_per_kw, jlong commitment_tx, jlong keys, jlongArray htlcs) {
2146 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2147 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
2148 LDKPreCalculatedTxCreationKeys keys_conv;
2149 keys_conv.inner = (void*)(keys & (~1));
2150 keys_conv.is_owned = false;
2151 LDKCVec_HTLCOutputInCommitmentZ htlcs_constr;
2152 htlcs_constr.datalen = (*_env)->GetArrayLength (_env, htlcs);
2153 if (htlcs_constr.datalen > 0)
2154 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
2156 htlcs_constr.data = NULL;
2157 long* htlcs_vals = (*_env)->GetLongArrayElements (_env, htlcs, NULL);
2158 for (size_t y = 0; y < htlcs_constr.datalen; y++) {
2159 long arr_conv_24 = htlcs_vals[y];
2160 LDKHTLCOutputInCommitment arr_conv_24_conv;
2161 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
2162 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
2163 if (arr_conv_24_conv.inner != NULL)
2164 arr_conv_24_conv = HTLCOutputInCommitment_clone(&arr_conv_24_conv);
2165 htlcs_constr.data[y] = arr_conv_24_conv;
2167 (*_env)->ReleaseLongArrayElements (_env, htlcs, htlcs_vals, 0);
2168 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2169 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_constr);
2170 return (long)ret_conv;
2173 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
2174 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2175 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2176 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2177 holder_commitment_tx_conv.is_owned = false;
2178 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2179 *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2180 return (long)ret_conv;
2183 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) {
2184 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2185 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2186 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2187 holder_commitment_tx_conv.is_owned = false;
2188 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
2189 *ret_conv = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2190 return (long)ret_conv;
2193 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1justice_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong justice_tx, jlong input, jlong amount, jbyteArray per_commitment_key, jlong htlc) {
2194 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2195 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
2196 unsigned char per_commitment_key_arr[32];
2197 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
2198 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
2199 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2200 LDKHTLCOutputInCommitment htlc_conv;
2201 htlc_conv.inner = (void*)(htlc & (~1));
2202 htlc_conv.is_owned = false;
2203 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2204 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
2205 return (long)ret_conv;
2208 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1htlc_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong htlc_tx, jlong input, jlong amount, jbyteArray per_commitment_point, jlong htlc) {
2209 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2210 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
2211 LDKPublicKey per_commitment_point_ref;
2212 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
2213 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2214 LDKHTLCOutputInCommitment htlc_conv;
2215 htlc_conv.inner = (void*)(htlc & (~1));
2216 htlc_conv.is_owned = false;
2217 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2218 *ret_conv = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv);
2219 return (long)ret_conv;
2222 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) {
2223 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2224 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
2225 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2226 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv);
2227 return (long)ret_conv;
2230 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
2231 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2232 LDKUnsignedChannelAnnouncement msg_conv;
2233 msg_conv.inner = (void*)(msg & (~1));
2234 msg_conv.is_owned = false;
2235 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2236 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2237 return (long)ret_conv;
2240 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) {
2241 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2242 LDKChannelPublicKeys channel_points_conv;
2243 channel_points_conv.inner = (void*)(channel_points & (~1));
2244 channel_points_conv.is_owned = false;
2245 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2248 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
2249 if (this_arg->set_pubkeys != NULL)
2250 this_arg->set_pubkeys(this_arg);
2251 return this_arg->pubkeys;
2253 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
2254 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2255 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
2256 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2257 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2258 long ret_ref = (long)ret_var.inner;
2259 if (ret_var.is_owned) {
2265 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2266 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2267 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2268 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2269 for (size_t i = 0; i < vec->datalen; i++) {
2270 CHECK((((long)vec->data[i].inner) & 1) == 0);
2271 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2273 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2276 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2277 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2278 ret->datalen = (*env)->GetArrayLength(env, elems);
2279 if (ret->datalen == 0) {
2282 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2283 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2284 for (size_t i = 0; i < ret->datalen; i++) {
2285 jlong arr_elem = java_elems[i];
2286 LDKMonitorEvent arr_elem_conv;
2287 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2288 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2289 if (arr_elem_conv.inner != NULL)
2290 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
2291 ret->data[i] = arr_elem_conv;
2293 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2297 typedef struct LDKWatch_JCalls {
2298 atomic_size_t refcnt;
2301 jmethodID watch_channel_meth;
2302 jmethodID update_channel_meth;
2303 jmethodID release_pending_monitor_events_meth;
2305 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2306 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2308 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2309 LDKOutPoint funding_txo_var = funding_txo;
2310 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2311 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2312 long funding_txo_ref = (long)funding_txo_var.inner;
2313 if (funding_txo_var.is_owned) {
2314 funding_txo_ref |= 1;
2316 LDKChannelMonitor monitor_var = monitor;
2317 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2318 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2319 long monitor_ref = (long)monitor_var.inner;
2320 if (monitor_var.is_owned) {
2323 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2325 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2326 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2330 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2331 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2333 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2334 LDKOutPoint funding_txo_var = funding_txo;
2335 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2336 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2337 long funding_txo_ref = (long)funding_txo_var.inner;
2338 if (funding_txo_var.is_owned) {
2339 funding_txo_ref |= 1;
2341 LDKChannelMonitorUpdate update_var = update;
2342 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2343 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2344 long update_ref = (long)update_var.inner;
2345 if (update_var.is_owned) {
2348 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2350 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2351 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2355 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2356 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2358 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2359 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2361 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_pending_monitor_events_meth);
2362 LDKCVec_MonitorEventZ arg_constr;
2363 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
2364 if (arg_constr.datalen > 0)
2365 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2367 arg_constr.data = NULL;
2368 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
2369 for (size_t o = 0; o < arg_constr.datalen; o++) {
2370 long arr_conv_14 = arg_vals[o];
2371 LDKMonitorEvent arr_conv_14_conv;
2372 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2373 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2374 if (arr_conv_14_conv.inner != NULL)
2375 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2376 arg_constr.data[o] = arr_conv_14_conv;
2378 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
2381 static void LDKWatch_JCalls_free(void* this_arg) {
2382 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2383 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2385 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2386 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2390 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2391 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2392 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2393 return (void*) this_arg;
2395 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2396 jclass c = (*env)->GetObjectClass(env, o);
2398 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2399 atomic_init(&calls->refcnt, 1);
2400 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2401 calls->o = (*env)->NewWeakGlobalRef(env, o);
2402 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2403 CHECK(calls->watch_channel_meth != NULL);
2404 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2405 CHECK(calls->update_channel_meth != NULL);
2406 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2407 CHECK(calls->release_pending_monitor_events_meth != NULL);
2410 .this_arg = (void*) calls,
2411 .watch_channel = watch_channel_jcall,
2412 .update_channel = update_channel_jcall,
2413 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2414 .free = LDKWatch_JCalls_free,
2418 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2419 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2420 *res_ptr = LDKWatch_init(env, _a, o);
2421 return (long)res_ptr;
2423 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2424 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2428 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2429 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2430 LDKOutPoint funding_txo_conv;
2431 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2432 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2433 if (funding_txo_conv.inner != NULL)
2434 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2435 LDKChannelMonitor monitor_conv;
2436 monitor_conv.inner = (void*)(monitor & (~1));
2437 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2438 // Warning: we may need a move here but can't clone!
2439 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2440 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2441 return (long)ret_conv;
2444 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2445 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2446 LDKOutPoint funding_txo_conv;
2447 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2448 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2449 if (funding_txo_conv.inner != NULL)
2450 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2451 LDKChannelMonitorUpdate update_conv;
2452 update_conv.inner = (void*)(update & (~1));
2453 update_conv.is_owned = (update & 1) || (update == 0);
2454 if (update_conv.inner != NULL)
2455 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2456 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2457 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2458 return (long)ret_conv;
2461 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2462 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2463 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2464 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
2465 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
2466 for (size_t o = 0; o < ret_var.datalen; o++) {
2467 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2468 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2469 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2470 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2471 if (arr_conv_14_var.is_owned) {
2472 arr_conv_14_ref |= 1;
2474 ret_arr_ptr[o] = arr_conv_14_ref;
2476 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
2481 typedef struct LDKFilter_JCalls {
2482 atomic_size_t refcnt;
2485 jmethodID register_tx_meth;
2486 jmethodID register_output_meth;
2488 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2489 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2491 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2492 jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
2493 (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
2494 LDKu8slice script_pubkey_var = script_pubkey;
2495 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2496 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2497 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2499 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2501 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2502 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2504 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2505 LDKOutPoint outpoint_var = *outpoint;
2506 if (outpoint->inner != NULL)
2507 outpoint_var = OutPoint_clone(outpoint);
2508 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2509 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2510 long outpoint_ref = (long)outpoint_var.inner & ~1;
2511 LDKu8slice script_pubkey_var = script_pubkey;
2512 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2513 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2514 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2516 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
2518 static void LDKFilter_JCalls_free(void* this_arg) {
2519 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2520 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2522 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2523 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2527 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2528 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2529 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2530 return (void*) this_arg;
2532 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2533 jclass c = (*env)->GetObjectClass(env, o);
2535 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2536 atomic_init(&calls->refcnt, 1);
2537 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2538 calls->o = (*env)->NewWeakGlobalRef(env, o);
2539 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2540 CHECK(calls->register_tx_meth != NULL);
2541 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2542 CHECK(calls->register_output_meth != NULL);
2545 .this_arg = (void*) calls,
2546 .register_tx = register_tx_jcall,
2547 .register_output = register_output_jcall,
2548 .free = LDKFilter_JCalls_free,
2552 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2553 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2554 *res_ptr = LDKFilter_init(env, _a, o);
2555 return (long)res_ptr;
2557 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2558 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2563 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2564 unsigned char txid_arr[32];
2565 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2566 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2567 unsigned char (*txid_ref)[32] = &txid_arr;
2568 LDKu8slice script_pubkey_ref;
2569 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2570 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2571 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2572 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2576 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2577 LDKOutPoint outpoint_conv;
2578 outpoint_conv.inner = (void*)(outpoint & (~1));
2579 outpoint_conv.is_owned = false;
2580 LDKu8slice script_pubkey_ref;
2581 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2582 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2583 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2584 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2587 typedef struct LDKBroadcasterInterface_JCalls {
2588 atomic_size_t refcnt;
2591 jmethodID broadcast_transaction_meth;
2592 } LDKBroadcasterInterface_JCalls;
2593 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2594 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2596 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2597 LDKTransaction *tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
2599 long tx_ref = (long)tx_copy;
2600 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2602 return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2604 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2605 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2606 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2608 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2609 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2613 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2614 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2615 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2616 return (void*) this_arg;
2618 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2619 jclass c = (*env)->GetObjectClass(env, o);
2621 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2622 atomic_init(&calls->refcnt, 1);
2623 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2624 calls->o = (*env)->NewWeakGlobalRef(env, o);
2625 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2626 CHECK(calls->broadcast_transaction_meth != NULL);
2628 LDKBroadcasterInterface ret = {
2629 .this_arg = (void*) calls,
2630 .broadcast_transaction = broadcast_transaction_jcall,
2631 .free = LDKBroadcasterInterface_JCalls_free,
2635 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2636 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2637 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2638 return (long)res_ptr;
2640 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2641 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2646 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2647 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2648 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv);
2651 typedef struct LDKFeeEstimator_JCalls {
2652 atomic_size_t refcnt;
2655 jmethodID get_est_sat_per_1000_weight_meth;
2656 } LDKFeeEstimator_JCalls;
2657 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2658 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2660 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2661 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target);
2662 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2664 return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2666 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2667 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2668 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2670 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2671 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2675 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2676 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2677 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2678 return (void*) this_arg;
2680 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2681 jclass c = (*env)->GetObjectClass(env, o);
2683 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2684 atomic_init(&calls->refcnt, 1);
2685 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2686 calls->o = (*env)->NewWeakGlobalRef(env, o);
2687 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2688 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2690 LDKFeeEstimator ret = {
2691 .this_arg = (void*) calls,
2692 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2693 .free = LDKFeeEstimator_JCalls_free,
2697 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2698 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2699 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2700 return (long)res_ptr;
2702 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2703 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2707 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) {
2708 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2709 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2710 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2714 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2715 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2716 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2718 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2719 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2720 ret->datalen = (*env)->GetArrayLength(env, elems);
2721 if (ret->datalen == 0) {
2724 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2725 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2726 for (size_t i = 0; i < ret->datalen; i++) {
2727 jlong arr_elem = java_elems[i];
2728 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2729 FREE((void*)arr_elem);
2730 ret->data[i] = arr_elem_conv;
2732 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2736 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2737 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2738 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2740 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2741 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2742 ret->datalen = (*env)->GetArrayLength(env, elems);
2743 if (ret->datalen == 0) {
2746 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2747 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2748 for (size_t i = 0; i < ret->datalen; i++) {
2749 jlong arr_elem = java_elems[i];
2750 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2751 ret->data[i] = arr_elem_conv;
2753 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2757 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2758 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2759 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2761 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2762 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2763 ret->datalen = (*env)->GetArrayLength(env, elems);
2764 if (ret->datalen == 0) {
2767 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2768 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2769 for (size_t i = 0; i < ret->datalen; i++) {
2770 jlong arr_elem = java_elems[i];
2771 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2772 FREE((void*)arr_elem);
2773 ret->data[i] = arr_elem_conv;
2775 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2779 typedef struct LDKKeysInterface_JCalls {
2780 atomic_size_t refcnt;
2783 jmethodID get_node_secret_meth;
2784 jmethodID get_destination_script_meth;
2785 jmethodID get_shutdown_pubkey_meth;
2786 jmethodID get_channel_keys_meth;
2787 jmethodID get_secure_random_bytes_meth;
2788 } LDKKeysInterface_JCalls;
2789 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2790 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2792 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2793 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2795 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth);
2796 LDKSecretKey arg_ref;
2797 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2798 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
2801 LDKCVec_u8Z get_destination_script_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_destination_script_meth);
2808 LDKCVec_u8Z arg_ref;
2809 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
2810 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
2813 LDKPublicKey get_shutdown_pubkey_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_shutdown_pubkey_meth);
2820 LDKPublicKey arg_ref;
2821 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
2822 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
2825 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2826 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2828 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2829 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2831 LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2832 LDKChannelKeys ret_conv = *(LDKChannelKeys*)ret;
2833 if (ret_conv.free == LDKChannelKeys_JCalls_free) {
2834 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2835 LDKChannelKeys_JCalls_clone(ret_conv.this_arg);
2839 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2840 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2842 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2843 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2845 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth);
2846 LDKThirtyTwoBytes arg_ref;
2847 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2848 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
2851 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2852 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2853 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2855 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2856 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2860 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2861 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2862 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2863 return (void*) this_arg;
2865 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2866 jclass c = (*env)->GetObjectClass(env, o);
2868 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2869 atomic_init(&calls->refcnt, 1);
2870 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2871 calls->o = (*env)->NewWeakGlobalRef(env, o);
2872 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2873 CHECK(calls->get_node_secret_meth != NULL);
2874 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2875 CHECK(calls->get_destination_script_meth != NULL);
2876 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2877 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2878 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2879 CHECK(calls->get_channel_keys_meth != NULL);
2880 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2881 CHECK(calls->get_secure_random_bytes_meth != NULL);
2883 LDKKeysInterface ret = {
2884 .this_arg = (void*) calls,
2885 .get_node_secret = get_node_secret_jcall,
2886 .get_destination_script = get_destination_script_jcall,
2887 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2888 .get_channel_keys = get_channel_keys_jcall,
2889 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2890 .free = LDKKeysInterface_JCalls_free,
2894 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2895 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2896 *res_ptr = LDKKeysInterface_init(env, _a, o);
2897 return (long)res_ptr;
2899 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2900 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2904 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2905 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2906 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2907 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2911 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2912 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2913 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2914 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2915 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2916 CVec_u8Z_free(arg_var);
2920 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2921 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2922 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2923 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2927 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) {
2928 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2929 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2930 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2934 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2935 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2936 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2937 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2941 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2942 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2943 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2944 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2945 for (size_t i = 0; i < vec->datalen; i++) {
2946 CHECK((((long)vec->data[i].inner) & 1) == 0);
2947 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2949 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2952 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2953 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2954 ret->datalen = (*env)->GetArrayLength(env, elems);
2955 if (ret->datalen == 0) {
2958 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2959 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2960 for (size_t i = 0; i < ret->datalen; i++) {
2961 jlong arr_elem = java_elems[i];
2962 LDKChannelDetails arr_elem_conv;
2963 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2964 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2965 if (arr_elem_conv.inner != NULL)
2966 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2967 ret->data[i] = arr_elem_conv;
2969 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2973 static jclass LDKNetAddress_IPv4_class = NULL;
2974 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2975 static jclass LDKNetAddress_IPv6_class = NULL;
2976 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2977 static jclass LDKNetAddress_OnionV2_class = NULL;
2978 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2979 static jclass LDKNetAddress_OnionV3_class = NULL;
2980 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2982 LDKNetAddress_IPv4_class =
2983 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2984 CHECK(LDKNetAddress_IPv4_class != NULL);
2985 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2986 CHECK(LDKNetAddress_IPv4_meth != NULL);
2987 LDKNetAddress_IPv6_class =
2988 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2989 CHECK(LDKNetAddress_IPv6_class != NULL);
2990 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2991 CHECK(LDKNetAddress_IPv6_meth != NULL);
2992 LDKNetAddress_OnionV2_class =
2993 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2994 CHECK(LDKNetAddress_OnionV2_class != NULL);
2995 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2996 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2997 LDKNetAddress_OnionV3_class =
2998 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2999 CHECK(LDKNetAddress_OnionV3_class != NULL);
3000 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3001 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3003 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
3004 LDKNetAddress *obj = (LDKNetAddress*)ptr;
3006 case LDKNetAddress_IPv4: {
3007 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 4);
3008 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3009 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3011 case LDKNetAddress_IPv6: {
3012 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 16);
3013 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3014 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3016 case LDKNetAddress_OnionV2: {
3017 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 10);
3018 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3019 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3021 case LDKNetAddress_OnionV3: {
3022 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
3023 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3024 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);
3029 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3030 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
3031 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
3033 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
3034 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
3035 ret->datalen = (*env)->GetArrayLength(env, elems);
3036 if (ret->datalen == 0) {
3039 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
3040 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3041 for (size_t i = 0; i < ret->datalen; i++) {
3042 jlong arr_elem = java_elems[i];
3043 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
3044 FREE((void*)arr_elem);
3045 ret->data[i] = arr_elem_conv;
3047 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3051 typedef struct LDKChannelMessageHandler_JCalls {
3052 atomic_size_t refcnt;
3055 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
3056 jmethodID handle_open_channel_meth;
3057 jmethodID handle_accept_channel_meth;
3058 jmethodID handle_funding_created_meth;
3059 jmethodID handle_funding_signed_meth;
3060 jmethodID handle_funding_locked_meth;
3061 jmethodID handle_shutdown_meth;
3062 jmethodID handle_closing_signed_meth;
3063 jmethodID handle_update_add_htlc_meth;
3064 jmethodID handle_update_fulfill_htlc_meth;
3065 jmethodID handle_update_fail_htlc_meth;
3066 jmethodID handle_update_fail_malformed_htlc_meth;
3067 jmethodID handle_commitment_signed_meth;
3068 jmethodID handle_revoke_and_ack_meth;
3069 jmethodID handle_update_fee_meth;
3070 jmethodID handle_announcement_signatures_meth;
3071 jmethodID peer_disconnected_meth;
3072 jmethodID peer_connected_meth;
3073 jmethodID handle_channel_reestablish_meth;
3074 jmethodID handle_error_meth;
3075 } LDKChannelMessageHandler_JCalls;
3076 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
3077 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3079 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3080 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3081 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3082 LDKInitFeatures their_features_var = their_features;
3083 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3084 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3085 long their_features_ref = (long)their_features_var.inner;
3086 if (their_features_var.is_owned) {
3087 their_features_ref |= 1;
3089 LDKOpenChannel msg_var = *msg;
3090 if (msg->inner != NULL)
3091 msg_var = OpenChannel_clone(msg);
3092 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3093 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3094 long msg_ref = (long)msg_var.inner & ~1;
3095 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3097 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
3099 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
3100 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3102 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3103 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3104 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3105 LDKInitFeatures their_features_var = their_features;
3106 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3107 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3108 long their_features_ref = (long)their_features_var.inner;
3109 if (their_features_var.is_owned) {
3110 their_features_ref |= 1;
3112 LDKAcceptChannel msg_var = *msg;
3113 if (msg->inner != NULL)
3114 msg_var = AcceptChannel_clone(msg);
3115 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3116 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3117 long msg_ref = (long)msg_var.inner & ~1;
3118 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3120 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
3122 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
3123 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3125 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3126 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3127 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3128 LDKFundingCreated msg_var = *msg;
3129 if (msg->inner != NULL)
3130 msg_var = FundingCreated_clone(msg);
3131 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3132 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3133 long msg_ref = (long)msg_var.inner & ~1;
3134 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3136 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
3138 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
3139 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3141 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3142 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3143 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3144 LDKFundingSigned msg_var = *msg;
3145 if (msg->inner != NULL)
3146 msg_var = FundingSigned_clone(msg);
3147 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3148 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3149 long msg_ref = (long)msg_var.inner & ~1;
3150 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3152 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
3154 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
3155 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3157 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3158 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3159 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3160 LDKFundingLocked msg_var = *msg;
3161 if (msg->inner != NULL)
3162 msg_var = FundingLocked_clone(msg);
3163 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3164 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3165 long msg_ref = (long)msg_var.inner & ~1;
3166 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3168 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
3170 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
3171 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3173 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3174 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3175 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3176 LDKShutdown msg_var = *msg;
3177 if (msg->inner != NULL)
3178 msg_var = Shutdown_clone(msg);
3179 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3180 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3181 long msg_ref = (long)msg_var.inner & ~1;
3182 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3184 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
3186 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
3187 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3189 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3190 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3191 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3192 LDKClosingSigned msg_var = *msg;
3193 if (msg->inner != NULL)
3194 msg_var = ClosingSigned_clone(msg);
3195 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3196 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3197 long msg_ref = (long)msg_var.inner & ~1;
3198 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3200 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
3202 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
3203 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3205 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3206 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3207 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3208 LDKUpdateAddHTLC msg_var = *msg;
3209 if (msg->inner != NULL)
3210 msg_var = UpdateAddHTLC_clone(msg);
3211 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3212 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3213 long msg_ref = (long)msg_var.inner & ~1;
3214 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3216 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
3218 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
3219 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3221 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3222 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3223 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3224 LDKUpdateFulfillHTLC msg_var = *msg;
3225 if (msg->inner != NULL)
3226 msg_var = UpdateFulfillHTLC_clone(msg);
3227 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3228 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3229 long msg_ref = (long)msg_var.inner & ~1;
3230 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3232 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
3234 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
3235 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3237 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3238 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3239 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3240 LDKUpdateFailHTLC msg_var = *msg;
3241 if (msg->inner != NULL)
3242 msg_var = UpdateFailHTLC_clone(msg);
3243 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3244 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3245 long msg_ref = (long)msg_var.inner & ~1;
3246 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3248 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
3250 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
3251 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3253 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3254 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3255 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3256 LDKUpdateFailMalformedHTLC msg_var = *msg;
3257 if (msg->inner != NULL)
3258 msg_var = UpdateFailMalformedHTLC_clone(msg);
3259 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3260 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3261 long msg_ref = (long)msg_var.inner & ~1;
3262 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3264 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
3266 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
3267 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3269 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3270 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3271 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3272 LDKCommitmentSigned msg_var = *msg;
3273 if (msg->inner != NULL)
3274 msg_var = CommitmentSigned_clone(msg);
3275 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3276 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3277 long msg_ref = (long)msg_var.inner & ~1;
3278 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3280 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
3282 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
3283 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3285 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3286 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3287 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3288 LDKRevokeAndACK msg_var = *msg;
3289 if (msg->inner != NULL)
3290 msg_var = RevokeAndACK_clone(msg);
3291 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3292 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3293 long msg_ref = (long)msg_var.inner & ~1;
3294 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3296 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
3298 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
3299 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3301 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3302 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3303 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3304 LDKUpdateFee msg_var = *msg;
3305 if (msg->inner != NULL)
3306 msg_var = UpdateFee_clone(msg);
3307 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3308 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3309 long msg_ref = (long)msg_var.inner & ~1;
3310 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3312 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
3314 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
3315 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3317 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3318 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3319 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3320 LDKAnnouncementSignatures msg_var = *msg;
3321 if (msg->inner != NULL)
3322 msg_var = AnnouncementSignatures_clone(msg);
3323 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3324 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3325 long msg_ref = (long)msg_var.inner & ~1;
3326 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3328 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
3330 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3331 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3333 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3334 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3335 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3336 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3338 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
3340 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
3341 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3343 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3344 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3345 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3346 LDKInit msg_var = *msg;
3347 if (msg->inner != NULL)
3348 msg_var = Init_clone(msg);
3349 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3350 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3351 long msg_ref = (long)msg_var.inner & ~1;
3352 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3354 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
3356 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3357 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3359 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3360 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3361 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3362 LDKChannelReestablish msg_var = *msg;
3363 if (msg->inner != NULL)
3364 msg_var = ChannelReestablish_clone(msg);
3365 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3366 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3367 long msg_ref = (long)msg_var.inner & ~1;
3368 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3370 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
3372 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
3373 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3375 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3376 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3377 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3378 LDKErrorMessage msg_var = *msg;
3379 if (msg->inner != NULL)
3380 msg_var = ErrorMessage_clone(msg);
3381 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3382 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3383 long msg_ref = (long)msg_var.inner & ~1;
3384 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3386 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
3388 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3389 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3390 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3392 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3393 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3397 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3398 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3399 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3400 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3401 return (void*) this_arg;
3403 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3404 jclass c = (*env)->GetObjectClass(env, o);
3406 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3407 atomic_init(&calls->refcnt, 1);
3408 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3409 calls->o = (*env)->NewWeakGlobalRef(env, o);
3410 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3411 CHECK(calls->handle_open_channel_meth != NULL);
3412 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3413 CHECK(calls->handle_accept_channel_meth != NULL);
3414 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3415 CHECK(calls->handle_funding_created_meth != NULL);
3416 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3417 CHECK(calls->handle_funding_signed_meth != NULL);
3418 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3419 CHECK(calls->handle_funding_locked_meth != NULL);
3420 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3421 CHECK(calls->handle_shutdown_meth != NULL);
3422 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3423 CHECK(calls->handle_closing_signed_meth != NULL);
3424 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3425 CHECK(calls->handle_update_add_htlc_meth != NULL);
3426 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3427 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3428 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3429 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3430 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3431 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3432 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3433 CHECK(calls->handle_commitment_signed_meth != NULL);
3434 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3435 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3436 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3437 CHECK(calls->handle_update_fee_meth != NULL);
3438 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3439 CHECK(calls->handle_announcement_signatures_meth != NULL);
3440 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3441 CHECK(calls->peer_disconnected_meth != NULL);
3442 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3443 CHECK(calls->peer_connected_meth != NULL);
3444 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3445 CHECK(calls->handle_channel_reestablish_meth != NULL);
3446 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3447 CHECK(calls->handle_error_meth != NULL);
3449 LDKChannelMessageHandler ret = {
3450 .this_arg = (void*) calls,
3451 .handle_open_channel = handle_open_channel_jcall,
3452 .handle_accept_channel = handle_accept_channel_jcall,
3453 .handle_funding_created = handle_funding_created_jcall,
3454 .handle_funding_signed = handle_funding_signed_jcall,
3455 .handle_funding_locked = handle_funding_locked_jcall,
3456 .handle_shutdown = handle_shutdown_jcall,
3457 .handle_closing_signed = handle_closing_signed_jcall,
3458 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3459 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3460 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3461 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3462 .handle_commitment_signed = handle_commitment_signed_jcall,
3463 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3464 .handle_update_fee = handle_update_fee_jcall,
3465 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3466 .peer_disconnected = peer_disconnected_jcall,
3467 .peer_connected = peer_connected_jcall,
3468 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3469 .handle_error = handle_error_jcall,
3470 .free = LDKChannelMessageHandler_JCalls_free,
3471 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3473 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3476 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3477 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3478 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3479 return (long)res_ptr;
3481 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3482 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3486 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) {
3487 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3488 LDKPublicKey their_node_id_ref;
3489 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3490 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3491 LDKInitFeatures their_features_conv;
3492 their_features_conv.inner = (void*)(their_features & (~1));
3493 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3494 // Warning: we may need a move here but can't clone!
3495 LDKOpenChannel msg_conv;
3496 msg_conv.inner = (void*)(msg & (~1));
3497 msg_conv.is_owned = false;
3498 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3501 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) {
3502 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3503 LDKPublicKey their_node_id_ref;
3504 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3505 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3506 LDKInitFeatures their_features_conv;
3507 their_features_conv.inner = (void*)(their_features & (~1));
3508 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3509 // Warning: we may need a move here but can't clone!
3510 LDKAcceptChannel msg_conv;
3511 msg_conv.inner = (void*)(msg & (~1));
3512 msg_conv.is_owned = false;
3513 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3516 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) {
3517 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3518 LDKPublicKey their_node_id_ref;
3519 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3520 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3521 LDKFundingCreated msg_conv;
3522 msg_conv.inner = (void*)(msg & (~1));
3523 msg_conv.is_owned = false;
3524 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3527 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) {
3528 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3529 LDKPublicKey their_node_id_ref;
3530 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3531 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3532 LDKFundingSigned msg_conv;
3533 msg_conv.inner = (void*)(msg & (~1));
3534 msg_conv.is_owned = false;
3535 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3538 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) {
3539 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3540 LDKPublicKey their_node_id_ref;
3541 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3542 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3543 LDKFundingLocked msg_conv;
3544 msg_conv.inner = (void*)(msg & (~1));
3545 msg_conv.is_owned = false;
3546 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3550 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3551 LDKPublicKey their_node_id_ref;
3552 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3553 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3554 LDKShutdown msg_conv;
3555 msg_conv.inner = (void*)(msg & (~1));
3556 msg_conv.is_owned = false;
3557 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3560 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) {
3561 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3562 LDKPublicKey their_node_id_ref;
3563 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3564 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3565 LDKClosingSigned msg_conv;
3566 msg_conv.inner = (void*)(msg & (~1));
3567 msg_conv.is_owned = false;
3568 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3571 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) {
3572 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3573 LDKPublicKey their_node_id_ref;
3574 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3575 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3576 LDKUpdateAddHTLC msg_conv;
3577 msg_conv.inner = (void*)(msg & (~1));
3578 msg_conv.is_owned = false;
3579 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3582 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) {
3583 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3584 LDKPublicKey their_node_id_ref;
3585 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3586 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3587 LDKUpdateFulfillHTLC msg_conv;
3588 msg_conv.inner = (void*)(msg & (~1));
3589 msg_conv.is_owned = false;
3590 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3593 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) {
3594 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3595 LDKPublicKey their_node_id_ref;
3596 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3597 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3598 LDKUpdateFailHTLC msg_conv;
3599 msg_conv.inner = (void*)(msg & (~1));
3600 msg_conv.is_owned = false;
3601 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3604 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) {
3605 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3606 LDKPublicKey their_node_id_ref;
3607 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3608 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3609 LDKUpdateFailMalformedHTLC msg_conv;
3610 msg_conv.inner = (void*)(msg & (~1));
3611 msg_conv.is_owned = false;
3612 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3615 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) {
3616 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3617 LDKPublicKey their_node_id_ref;
3618 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3619 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3620 LDKCommitmentSigned msg_conv;
3621 msg_conv.inner = (void*)(msg & (~1));
3622 msg_conv.is_owned = false;
3623 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3626 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) {
3627 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3628 LDKPublicKey their_node_id_ref;
3629 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3630 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3631 LDKRevokeAndACK msg_conv;
3632 msg_conv.inner = (void*)(msg & (~1));
3633 msg_conv.is_owned = false;
3634 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3637 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) {
3638 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3639 LDKPublicKey their_node_id_ref;
3640 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3641 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3642 LDKUpdateFee msg_conv;
3643 msg_conv.inner = (void*)(msg & (~1));
3644 msg_conv.is_owned = false;
3645 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3648 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) {
3649 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3650 LDKPublicKey their_node_id_ref;
3651 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3652 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3653 LDKAnnouncementSignatures msg_conv;
3654 msg_conv.inner = (void*)(msg & (~1));
3655 msg_conv.is_owned = false;
3656 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3659 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) {
3660 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3661 LDKPublicKey their_node_id_ref;
3662 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3663 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3664 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3668 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3669 LDKPublicKey their_node_id_ref;
3670 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3671 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3673 msg_conv.inner = (void*)(msg & (~1));
3674 msg_conv.is_owned = false;
3675 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3678 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) {
3679 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3680 LDKPublicKey their_node_id_ref;
3681 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3682 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3683 LDKChannelReestablish msg_conv;
3684 msg_conv.inner = (void*)(msg & (~1));
3685 msg_conv.is_owned = false;
3686 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3690 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3691 LDKPublicKey their_node_id_ref;
3692 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3693 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3694 LDKErrorMessage msg_conv;
3695 msg_conv.inner = (void*)(msg & (~1));
3696 msg_conv.is_owned = false;
3697 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3700 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3701 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3702 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3703 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3704 for (size_t i = 0; i < vec->datalen; i++) {
3705 CHECK((((long)vec->data[i].inner) & 1) == 0);
3706 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3708 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3711 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3712 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3713 ret->datalen = (*env)->GetArrayLength(env, elems);
3714 if (ret->datalen == 0) {
3717 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3718 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3719 for (size_t i = 0; i < ret->datalen; i++) {
3720 jlong arr_elem = java_elems[i];
3721 LDKChannelMonitor arr_elem_conv;
3722 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3723 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3724 // Warning: we may need a move here but can't clone!
3725 ret->data[i] = arr_elem_conv;
3727 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3731 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3732 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3733 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3735 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3736 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3737 ret->datalen = (*env)->GetArrayLength(env, elems);
3738 if (ret->datalen == 0) {
3741 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3742 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3743 for (size_t i = 0; i < ret->datalen; i++) {
3744 ret->data[i] = java_elems[i];
3746 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3750 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3751 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3752 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3753 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3754 for (size_t i = 0; i < vec->datalen; i++) {
3755 CHECK((((long)vec->data[i].inner) & 1) == 0);
3756 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3758 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3761 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3762 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3763 ret->datalen = (*env)->GetArrayLength(env, elems);
3764 if (ret->datalen == 0) {
3767 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3768 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3769 for (size_t i = 0; i < ret->datalen; i++) {
3770 jlong arr_elem = java_elems[i];
3771 LDKUpdateAddHTLC arr_elem_conv;
3772 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3773 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3774 if (arr_elem_conv.inner != NULL)
3775 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3776 ret->data[i] = arr_elem_conv;
3778 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3782 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3783 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3784 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3785 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3786 for (size_t i = 0; i < vec->datalen; i++) {
3787 CHECK((((long)vec->data[i].inner) & 1) == 0);
3788 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3790 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3793 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3794 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3795 ret->datalen = (*env)->GetArrayLength(env, elems);
3796 if (ret->datalen == 0) {
3799 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3800 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3801 for (size_t i = 0; i < ret->datalen; i++) {
3802 jlong arr_elem = java_elems[i];
3803 LDKUpdateFulfillHTLC arr_elem_conv;
3804 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3805 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3806 if (arr_elem_conv.inner != NULL)
3807 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3808 ret->data[i] = arr_elem_conv;
3810 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3814 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3815 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3816 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3817 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3818 for (size_t i = 0; i < vec->datalen; i++) {
3819 CHECK((((long)vec->data[i].inner) & 1) == 0);
3820 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3822 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3825 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3826 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3827 ret->datalen = (*env)->GetArrayLength(env, elems);
3828 if (ret->datalen == 0) {
3831 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3832 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3833 for (size_t i = 0; i < ret->datalen; i++) {
3834 jlong arr_elem = java_elems[i];
3835 LDKUpdateFailHTLC arr_elem_conv;
3836 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3837 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3838 if (arr_elem_conv.inner != NULL)
3839 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3840 ret->data[i] = arr_elem_conv;
3842 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3846 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3847 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3848 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3849 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3850 for (size_t i = 0; i < vec->datalen; i++) {
3851 CHECK((((long)vec->data[i].inner) & 1) == 0);
3852 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3854 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3857 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3858 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3859 ret->datalen = (*env)->GetArrayLength(env, elems);
3860 if (ret->datalen == 0) {
3863 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3864 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3865 for (size_t i = 0; i < ret->datalen; i++) {
3866 jlong arr_elem = java_elems[i];
3867 LDKUpdateFailMalformedHTLC arr_elem_conv;
3868 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3869 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3870 if (arr_elem_conv.inner != NULL)
3871 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3872 ret->data[i] = arr_elem_conv;
3874 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3878 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3879 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3881 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3882 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3883 CHECK(val->result_ok);
3884 return *val->contents.result;
3886 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3887 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3888 CHECK(!val->result_ok);
3889 LDKLightningError err_var = (*val->contents.err);
3890 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3891 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3892 long err_ref = (long)err_var.inner & ~1;
3895 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3896 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3897 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3900 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3901 ret->datalen = (*env)->GetArrayLength(env, elems);
3902 if (ret->datalen == 0) {
3905 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3906 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3907 for (size_t i = 0; i < ret->datalen; i++) {
3908 jlong arr_elem = java_elems[i];
3909 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3910 FREE((void*)arr_elem);
3911 ret->data[i] = arr_elem_conv;
3913 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3917 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3918 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3919 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3920 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3921 for (size_t i = 0; i < vec->datalen; i++) {
3922 CHECK((((long)vec->data[i].inner) & 1) == 0);
3923 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3925 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3928 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3929 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3930 ret->datalen = (*env)->GetArrayLength(env, elems);
3931 if (ret->datalen == 0) {
3934 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3935 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3936 for (size_t i = 0; i < ret->datalen; i++) {
3937 jlong arr_elem = java_elems[i];
3938 LDKNodeAnnouncement arr_elem_conv;
3939 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3940 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3941 if (arr_elem_conv.inner != NULL)
3942 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3943 ret->data[i] = arr_elem_conv;
3945 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3949 typedef struct LDKRoutingMessageHandler_JCalls {
3950 atomic_size_t refcnt;
3953 jmethodID handle_node_announcement_meth;
3954 jmethodID handle_channel_announcement_meth;
3955 jmethodID handle_channel_update_meth;
3956 jmethodID handle_htlc_fail_channel_update_meth;
3957 jmethodID get_next_channel_announcements_meth;
3958 jmethodID get_next_node_announcements_meth;
3959 jmethodID should_request_full_sync_meth;
3960 } LDKRoutingMessageHandler_JCalls;
3961 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3962 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3964 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3965 LDKNodeAnnouncement msg_var = *msg;
3966 if (msg->inner != NULL)
3967 msg_var = NodeAnnouncement_clone(msg);
3968 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3969 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3970 long msg_ref = (long)msg_var.inner & ~1;
3971 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3973 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, msg_ref);
3974 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
3978 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3979 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3981 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3982 LDKChannelAnnouncement msg_var = *msg;
3983 if (msg->inner != NULL)
3984 msg_var = ChannelAnnouncement_clone(msg);
3985 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3986 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3987 long msg_ref = (long)msg_var.inner & ~1;
3988 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3990 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
3991 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
3995 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3996 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3998 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3999 LDKChannelUpdate msg_var = *msg;
4000 if (msg->inner != NULL)
4001 msg_var = ChannelUpdate_clone(msg);
4002 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4003 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4004 long msg_ref = (long)msg_var.inner & ~1;
4005 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4007 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, msg_ref);
4008 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4012 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
4013 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4015 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4016 long ret_update = (long)update;
4017 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4019 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
4021 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
4022 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4024 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4025 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4027 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
4028 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4029 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4030 if (arg_constr.datalen > 0)
4031 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4033 arg_constr.data = NULL;
4034 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4035 for (size_t l = 0; l < arg_constr.datalen; l++) {
4036 long arr_conv_63 = arg_vals[l];
4037 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4038 FREE((void*)arr_conv_63);
4039 arg_constr.data[l] = arr_conv_63_conv;
4041 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4044 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
4045 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4047 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4048 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
4049 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
4050 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4052 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
4053 LDKCVec_NodeAnnouncementZ arg_constr;
4054 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4055 if (arg_constr.datalen > 0)
4056 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4058 arg_constr.data = NULL;
4059 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4060 for (size_t s = 0; s < arg_constr.datalen; s++) {
4061 long arr_conv_18 = arg_vals[s];
4062 LDKNodeAnnouncement arr_conv_18_conv;
4063 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4064 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4065 if (arr_conv_18_conv.inner != NULL)
4066 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
4067 arg_constr.data[s] = arr_conv_18_conv;
4069 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4072 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
4073 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4075 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4076 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
4077 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form);
4078 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4080 return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
4082 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4083 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4084 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4086 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4087 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4091 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
4092 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4093 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4094 return (void*) this_arg;
4096 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
4097 jclass c = (*env)->GetObjectClass(env, o);
4099 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
4100 atomic_init(&calls->refcnt, 1);
4101 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4102 calls->o = (*env)->NewWeakGlobalRef(env, o);
4103 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
4104 CHECK(calls->handle_node_announcement_meth != NULL);
4105 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
4106 CHECK(calls->handle_channel_announcement_meth != NULL);
4107 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
4108 CHECK(calls->handle_channel_update_meth != NULL);
4109 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
4110 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
4111 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
4112 CHECK(calls->get_next_channel_announcements_meth != NULL);
4113 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
4114 CHECK(calls->get_next_node_announcements_meth != NULL);
4115 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
4116 CHECK(calls->should_request_full_sync_meth != NULL);
4118 LDKRoutingMessageHandler ret = {
4119 .this_arg = (void*) calls,
4120 .handle_node_announcement = handle_node_announcement_jcall,
4121 .handle_channel_announcement = handle_channel_announcement_jcall,
4122 .handle_channel_update = handle_channel_update_jcall,
4123 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
4124 .get_next_channel_announcements = get_next_channel_announcements_jcall,
4125 .get_next_node_announcements = get_next_node_announcements_jcall,
4126 .should_request_full_sync = should_request_full_sync_jcall,
4127 .free = LDKRoutingMessageHandler_JCalls_free,
4131 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
4132 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
4133 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
4134 return (long)res_ptr;
4136 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4137 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
4141 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4142 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4143 LDKNodeAnnouncement msg_conv;
4144 msg_conv.inner = (void*)(msg & (~1));
4145 msg_conv.is_owned = false;
4146 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4147 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
4148 return (long)ret_conv;
4151 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4152 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4153 LDKChannelAnnouncement msg_conv;
4154 msg_conv.inner = (void*)(msg & (~1));
4155 msg_conv.is_owned = false;
4156 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4157 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4158 return (long)ret_conv;
4161 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4162 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4163 LDKChannelUpdate msg_conv;
4164 msg_conv.inner = (void*)(msg & (~1));
4165 msg_conv.is_owned = false;
4166 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4167 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
4168 return (long)ret_conv;
4171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
4172 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4173 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
4174 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
4177 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) {
4178 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4179 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
4180 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
4181 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
4182 for (size_t l = 0; l < ret_var.datalen; l++) {
4183 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4184 *arr_conv_63_ref = ret_var.data[l];
4185 ret_arr_ptr[l] = (long)arr_conv_63_ref;
4187 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4188 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(ret_var);
4192 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) {
4193 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4194 LDKPublicKey starting_point_ref;
4195 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
4196 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
4197 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
4198 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
4199 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
4200 for (size_t s = 0; s < ret_var.datalen; s++) {
4201 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
4202 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4203 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4204 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
4205 if (arr_conv_18_var.is_owned) {
4206 arr_conv_18_ref |= 1;
4208 ret_arr_ptr[s] = arr_conv_18_ref;
4210 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
4216 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4217 LDKPublicKey node_id_ref;
4218 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
4219 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
4220 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
4224 typedef struct LDKSocketDescriptor_JCalls {
4225 atomic_size_t refcnt;
4228 jmethodID send_data_meth;
4229 jmethodID disconnect_socket_meth;
4231 jmethodID hash_meth;
4232 } LDKSocketDescriptor_JCalls;
4233 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
4234 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4236 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4237 LDKu8slice data_var = data;
4238 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
4239 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
4240 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4242 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
4244 void disconnect_socket_jcall(void* this_arg) {
4245 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4247 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4248 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4250 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
4252 bool eq_jcall(const void* this_arg, const void *other_arg) {
4253 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4255 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4256 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4258 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, other_arg);
4260 uint64_t hash_jcall(const void* this_arg) {
4261 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4263 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4264 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4266 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
4268 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
4269 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4270 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4272 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4273 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4277 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
4278 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4279 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4280 return (void*) this_arg;
4282 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
4283 jclass c = (*env)->GetObjectClass(env, o);
4285 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
4286 atomic_init(&calls->refcnt, 1);
4287 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4288 calls->o = (*env)->NewWeakGlobalRef(env, o);
4289 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
4290 CHECK(calls->send_data_meth != NULL);
4291 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
4292 CHECK(calls->disconnect_socket_meth != NULL);
4293 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
4294 CHECK(calls->eq_meth != NULL);
4295 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
4296 CHECK(calls->hash_meth != NULL);
4298 LDKSocketDescriptor ret = {
4299 .this_arg = (void*) calls,
4300 .send_data = send_data_jcall,
4301 .disconnect_socket = disconnect_socket_jcall,
4304 .clone = LDKSocketDescriptor_JCalls_clone,
4305 .free = LDKSocketDescriptor_JCalls_free,
4309 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
4310 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4311 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
4312 return (long)res_ptr;
4314 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4315 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
4319 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
4320 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4321 LDKu8slice data_ref;
4322 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
4323 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
4324 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4325 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
4329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
4330 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4331 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4334 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
4335 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4336 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4340 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4341 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
4342 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
4344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4345 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4347 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4348 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4349 CHECK(val->result_ok);
4350 LDKCVecTempl_u8 res_var = (*val->contents.result);
4351 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
4352 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
4355 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4356 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4357 CHECK(!val->result_ok);
4358 LDKPeerHandleError err_var = (*val->contents.err);
4359 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4360 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4361 long err_ref = (long)err_var.inner & ~1;
4364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4365 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4368 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4369 CHECK(val->result_ok);
4370 return *val->contents.result;
4372 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4373 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4374 CHECK(!val->result_ok);
4375 LDKPeerHandleError err_var = (*val->contents.err);
4376 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4377 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4378 long err_ref = (long)err_var.inner & ~1;
4381 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4382 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
4384 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4385 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4386 CHECK(val->result_ok);
4387 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
4388 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
4391 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4392 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4393 CHECK(!val->result_ok);
4394 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4397 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4398 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
4400 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4401 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4402 CHECK(val->result_ok);
4403 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
4404 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
4407 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4408 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4409 CHECK(!val->result_ok);
4410 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4413 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4414 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
4416 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4417 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4418 CHECK(val->result_ok);
4419 LDKTxCreationKeys res_var = (*val->contents.result);
4420 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4421 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4422 long res_ref = (long)res_var.inner & ~1;
4425 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4426 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4427 CHECK(!val->result_ok);
4428 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4431 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4432 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4433 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4435 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4436 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4437 ret->datalen = (*env)->GetArrayLength(env, elems);
4438 if (ret->datalen == 0) {
4441 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4442 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4443 for (size_t i = 0; i < ret->datalen; i++) {
4444 jlong arr_elem = java_elems[i];
4445 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4446 FREE((void*)arr_elem);
4447 ret->data[i] = arr_elem_conv;
4449 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4453 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4454 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4455 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4456 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4457 for (size_t i = 0; i < vec->datalen; i++) {
4458 CHECK((((long)vec->data[i].inner) & 1) == 0);
4459 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4461 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4465 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4466 ret->datalen = (*env)->GetArrayLength(env, elems);
4467 if (ret->datalen == 0) {
4470 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4471 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4472 for (size_t i = 0; i < ret->datalen; i++) {
4473 jlong arr_elem = java_elems[i];
4474 LDKRouteHop arr_elem_conv;
4475 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4476 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4477 if (arr_elem_conv.inner != NULL)
4478 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4479 ret->data[i] = arr_elem_conv;
4481 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4485 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4486 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4487 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4489 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4490 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4492 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4493 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4494 CHECK(val->result_ok);
4495 LDKRoute res_var = (*val->contents.result);
4496 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4497 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4498 long res_ref = (long)res_var.inner & ~1;
4501 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4502 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4503 CHECK(!val->result_ok);
4504 LDKLightningError err_var = (*val->contents.err);
4505 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4506 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4507 long err_ref = (long)err_var.inner & ~1;
4510 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4511 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4512 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4513 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4514 for (size_t i = 0; i < vec->datalen; i++) {
4515 CHECK((((long)vec->data[i].inner) & 1) == 0);
4516 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4518 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4521 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4522 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4523 ret->datalen = (*env)->GetArrayLength(env, elems);
4524 if (ret->datalen == 0) {
4527 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4528 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4529 for (size_t i = 0; i < ret->datalen; i++) {
4530 jlong arr_elem = java_elems[i];
4531 LDKRouteHint arr_elem_conv;
4532 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4533 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4534 if (arr_elem_conv.inner != NULL)
4535 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4536 ret->data[i] = arr_elem_conv;
4538 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4543 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4545 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4549 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4551 C2Tuple_OutPointScriptZ_free(arg_conv);
4554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4555 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4557 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4561 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4563 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4567 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4569 C2Tuple_u64u64Z_free(arg_conv);
4572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4573 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4575 C2Tuple_usizeTransactionZ_free(arg_conv);
4578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4579 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4581 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4585 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4587 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4590 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4591 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4593 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4594 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4595 return (long)ret_conv;
4598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4599 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4601 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4604 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray arg) {
4605 LDKCVec_SignatureZ arg_constr;
4606 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4607 if (arg_constr.datalen > 0)
4608 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4610 arg_constr.data = NULL;
4611 for (size_t i = 0; i < arg_constr.datalen; i++) {
4612 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4613 LDKSignature arr_conv_8_ref;
4614 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4615 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4616 arg_constr.data[i] = arr_conv_8_ref;
4618 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4619 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(arg_constr);
4620 return (long)ret_conv;
4623 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4624 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4626 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4627 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4628 return (long)ret_conv;
4631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4632 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4634 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4637 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4638 LDKCVec_u8Z arg_ref;
4639 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
4640 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4641 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4642 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4643 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
4644 return (long)ret_conv;
4647 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4648 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4650 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4651 *ret_conv = CResult_NoneAPIErrorZ_err(arg_conv);
4652 return (long)ret_conv;
4655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4656 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4658 CResult_NoneAPIErrorZ_free(arg_conv);
4661 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4662 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4664 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4665 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4666 return (long)ret_conv;
4669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4670 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4672 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4675 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4676 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4678 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4679 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4680 return (long)ret_conv;
4683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4684 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4686 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4689 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4690 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4692 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4693 *ret_conv = CResult_NonePaymentSendFailureZ_err(arg_conv);
4694 return (long)ret_conv;
4697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4698 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4700 CResult_NonePaymentSendFailureZ_free(arg_conv);
4703 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4704 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4706 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4707 *ret_conv = CResult_NonePeerHandleErrorZ_err(arg_conv);
4708 return (long)ret_conv;
4711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4712 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4714 CResult_NonePeerHandleErrorZ_free(arg_conv);
4717 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4718 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4720 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4721 *ret_conv = CResult_PublicKeySecpErrorZ_err(arg_conv);
4722 return (long)ret_conv;
4725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4726 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4728 CResult_PublicKeySecpErrorZ_free(arg_conv);
4731 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4732 LDKPublicKey arg_ref;
4733 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4734 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4735 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4736 *ret_conv = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4737 return (long)ret_conv;
4740 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4741 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4743 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4744 *ret_conv = CResult_RouteLightningErrorZ_err(arg_conv);
4745 return (long)ret_conv;
4748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4749 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4751 CResult_RouteLightningErrorZ_free(arg_conv);
4754 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4755 LDKRoute arg_conv = *(LDKRoute*)arg;
4757 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4758 *ret_conv = CResult_RouteLightningErrorZ_ok(arg_conv);
4759 return (long)ret_conv;
4762 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4763 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4765 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4766 *ret_conv = CResult_SecretKeySecpErrorZ_err(arg_conv);
4767 return (long)ret_conv;
4770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4771 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4773 CResult_SecretKeySecpErrorZ_free(arg_conv);
4776 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4777 LDKSecretKey arg_ref;
4778 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4779 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4780 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4781 *ret_conv = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4782 return (long)ret_conv;
4785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4786 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4788 CResult_SignatureNoneZ_free(arg_conv);
4791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4792 LDKSignature arg_ref;
4793 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4794 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4795 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4796 *ret_conv = CResult_SignatureNoneZ_ok(arg_ref);
4797 return (long)ret_conv;
4800 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4801 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4803 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4804 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4805 return (long)ret_conv;
4808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4809 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4811 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4814 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4815 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4817 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4818 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4819 return (long)ret_conv;
4822 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4823 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4825 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4826 *ret_conv = CResult_TxOutAccessErrorZ_err(arg_conv);
4827 return (long)ret_conv;
4830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4831 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4833 CResult_TxOutAccessErrorZ_free(arg_conv);
4836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4837 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4839 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4840 *ret_conv = CResult_TxOutAccessErrorZ_ok(arg_conv);
4841 return (long)ret_conv;
4844 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4845 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4847 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4848 *ret_conv = CResult_boolLightningErrorZ_err(arg_conv);
4849 return (long)ret_conv;
4852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4853 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4855 CResult_boolLightningErrorZ_free(arg_conv);
4858 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4859 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4860 *ret_conv = CResult_boolLightningErrorZ_ok(arg);
4861 return (long)ret_conv;
4864 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4865 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4867 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4868 *ret_conv = CResult_boolPeerHandleErrorZ_err(arg_conv);
4869 return (long)ret_conv;
4872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4873 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4875 CResult_boolPeerHandleErrorZ_free(arg_conv);
4878 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4879 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4880 *ret_conv = CResult_boolPeerHandleErrorZ_ok(arg);
4881 return (long)ret_conv;
4884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4885 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_constr;
4886 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4887 if (arg_constr.datalen > 0)
4888 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
4890 arg_constr.data = NULL;
4891 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4892 for (size_t q = 0; q < arg_constr.datalen; q++) {
4893 long arr_conv_42 = arg_vals[q];
4894 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
4895 FREE((void*)arr_conv_42);
4896 arg_constr.data[q] = arr_conv_42_conv;
4898 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4899 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_constr);
4902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4903 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_constr;
4904 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4905 if (arg_constr.datalen > 0)
4906 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ Elements");
4908 arg_constr.data = NULL;
4909 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4910 for (size_t b = 0; b < arg_constr.datalen; b++) {
4911 long arr_conv_27 = arg_vals[b];
4912 LDKC2Tuple_TxidCVec_TxOutZZ arr_conv_27_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arr_conv_27;
4913 FREE((void*)arr_conv_27);
4914 arg_constr.data[b] = arr_conv_27_conv;
4916 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4917 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_constr);
4920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4921 LDKCVec_C2Tuple_usizeTransactionZZ arg_constr;
4922 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4923 if (arg_constr.datalen > 0)
4924 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
4926 arg_constr.data = NULL;
4927 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4928 for (size_t d = 0; d < arg_constr.datalen; d++) {
4929 long arr_conv_29 = arg_vals[d];
4930 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
4931 FREE((void*)arr_conv_29);
4932 arg_constr.data[d] = arr_conv_29_conv;
4934 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4935 CVec_C2Tuple_usizeTransactionZZ_free(arg_constr);
4938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4939 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4940 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4941 if (arg_constr.datalen > 0)
4942 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4944 arg_constr.data = NULL;
4945 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4946 for (size_t l = 0; l < arg_constr.datalen; l++) {
4947 long arr_conv_63 = arg_vals[l];
4948 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4949 FREE((void*)arr_conv_63);
4950 arg_constr.data[l] = arr_conv_63_conv;
4952 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4953 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_constr);
4956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4957 LDKCVec_CVec_RouteHopZZ arg_constr;
4958 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4959 if (arg_constr.datalen > 0)
4960 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
4962 arg_constr.data = NULL;
4963 for (size_t m = 0; m < arg_constr.datalen; m++) {
4964 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, arg, m);
4965 LDKCVec_RouteHopZ arr_conv_12_constr;
4966 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
4967 if (arr_conv_12_constr.datalen > 0)
4968 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4970 arr_conv_12_constr.data = NULL;
4971 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
4972 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
4973 long arr_conv_10 = arr_conv_12_vals[k];
4974 LDKRouteHop arr_conv_10_conv;
4975 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4976 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4977 arr_conv_12_constr.data[k] = arr_conv_10_conv;
4979 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
4980 arg_constr.data[m] = arr_conv_12_constr;
4982 CVec_CVec_RouteHopZZ_free(arg_constr);
4985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4986 LDKCVec_ChannelDetailsZ arg_constr;
4987 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4988 if (arg_constr.datalen > 0)
4989 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
4991 arg_constr.data = NULL;
4992 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4993 for (size_t q = 0; q < arg_constr.datalen; q++) {
4994 long arr_conv_16 = arg_vals[q];
4995 LDKChannelDetails arr_conv_16_conv;
4996 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4997 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4998 arg_constr.data[q] = arr_conv_16_conv;
5000 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5001 CVec_ChannelDetailsZ_free(arg_constr);
5004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5005 LDKCVec_ChannelMonitorZ arg_constr;
5006 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5007 if (arg_constr.datalen > 0)
5008 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
5010 arg_constr.data = NULL;
5011 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5012 for (size_t q = 0; q < arg_constr.datalen; q++) {
5013 long arr_conv_16 = arg_vals[q];
5014 LDKChannelMonitor arr_conv_16_conv;
5015 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5016 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5017 arg_constr.data[q] = arr_conv_16_conv;
5019 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5020 CVec_ChannelMonitorZ_free(arg_constr);
5023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5024 LDKCVec_EventZ arg_constr;
5025 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5026 if (arg_constr.datalen > 0)
5027 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
5029 arg_constr.data = NULL;
5030 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5031 for (size_t h = 0; h < arg_constr.datalen; h++) {
5032 long arr_conv_7 = arg_vals[h];
5033 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
5034 FREE((void*)arr_conv_7);
5035 arg_constr.data[h] = arr_conv_7_conv;
5037 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5038 CVec_EventZ_free(arg_constr);
5041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5042 LDKCVec_HTLCOutputInCommitmentZ arg_constr;
5043 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5044 if (arg_constr.datalen > 0)
5045 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
5047 arg_constr.data = NULL;
5048 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5049 for (size_t y = 0; y < arg_constr.datalen; y++) {
5050 long arr_conv_24 = arg_vals[y];
5051 LDKHTLCOutputInCommitment arr_conv_24_conv;
5052 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
5053 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
5054 arg_constr.data[y] = arr_conv_24_conv;
5056 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5057 CVec_HTLCOutputInCommitmentZ_free(arg_constr);
5060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5061 LDKCVec_MessageSendEventZ arg_constr;
5062 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5063 if (arg_constr.datalen > 0)
5064 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5066 arg_constr.data = NULL;
5067 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5068 for (size_t s = 0; s < arg_constr.datalen; s++) {
5069 long arr_conv_18 = arg_vals[s];
5070 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
5071 FREE((void*)arr_conv_18);
5072 arg_constr.data[s] = arr_conv_18_conv;
5074 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5075 CVec_MessageSendEventZ_free(arg_constr);
5078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5079 LDKCVec_MonitorEventZ arg_constr;
5080 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5081 if (arg_constr.datalen > 0)
5082 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5084 arg_constr.data = NULL;
5085 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5086 for (size_t o = 0; o < arg_constr.datalen; o++) {
5087 long arr_conv_14 = arg_vals[o];
5088 LDKMonitorEvent arr_conv_14_conv;
5089 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
5090 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
5091 arg_constr.data[o] = arr_conv_14_conv;
5093 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5094 CVec_MonitorEventZ_free(arg_constr);
5097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5098 LDKCVec_NetAddressZ arg_constr;
5099 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5100 if (arg_constr.datalen > 0)
5101 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
5103 arg_constr.data = NULL;
5104 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5105 for (size_t m = 0; m < arg_constr.datalen; m++) {
5106 long arr_conv_12 = arg_vals[m];
5107 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
5108 FREE((void*)arr_conv_12);
5109 arg_constr.data[m] = arr_conv_12_conv;
5111 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5112 CVec_NetAddressZ_free(arg_constr);
5115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5116 LDKCVec_NodeAnnouncementZ arg_constr;
5117 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5118 if (arg_constr.datalen > 0)
5119 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5121 arg_constr.data = NULL;
5122 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5123 for (size_t s = 0; s < arg_constr.datalen; s++) {
5124 long arr_conv_18 = arg_vals[s];
5125 LDKNodeAnnouncement arr_conv_18_conv;
5126 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
5127 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
5128 arg_constr.data[s] = arr_conv_18_conv;
5130 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5131 CVec_NodeAnnouncementZ_free(arg_constr);
5134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5135 LDKCVec_PublicKeyZ arg_constr;
5136 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5137 if (arg_constr.datalen > 0)
5138 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
5140 arg_constr.data = NULL;
5141 for (size_t i = 0; i < arg_constr.datalen; i++) {
5142 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5143 LDKPublicKey arr_conv_8_ref;
5144 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
5145 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
5146 arg_constr.data[i] = arr_conv_8_ref;
5148 CVec_PublicKeyZ_free(arg_constr);
5151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5152 LDKCVec_RouteHintZ arg_constr;
5153 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5154 if (arg_constr.datalen > 0)
5155 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
5157 arg_constr.data = NULL;
5158 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5159 for (size_t l = 0; l < arg_constr.datalen; l++) {
5160 long arr_conv_11 = arg_vals[l];
5161 LDKRouteHint arr_conv_11_conv;
5162 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
5163 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
5164 arg_constr.data[l] = arr_conv_11_conv;
5166 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5167 CVec_RouteHintZ_free(arg_constr);
5170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5171 LDKCVec_RouteHopZ arg_constr;
5172 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5173 if (arg_constr.datalen > 0)
5174 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
5176 arg_constr.data = NULL;
5177 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5178 for (size_t k = 0; k < arg_constr.datalen; k++) {
5179 long arr_conv_10 = arg_vals[k];
5180 LDKRouteHop arr_conv_10_conv;
5181 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
5182 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
5183 arg_constr.data[k] = arr_conv_10_conv;
5185 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5186 CVec_RouteHopZ_free(arg_constr);
5189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5190 LDKCVec_SignatureZ arg_constr;
5191 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5192 if (arg_constr.datalen > 0)
5193 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5195 arg_constr.data = NULL;
5196 for (size_t i = 0; i < arg_constr.datalen; i++) {
5197 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5198 LDKSignature arr_conv_8_ref;
5199 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5200 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5201 arg_constr.data[i] = arr_conv_8_ref;
5203 CVec_SignatureZ_free(arg_constr);
5206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5207 LDKCVec_SpendableOutputDescriptorZ arg_constr;
5208 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5209 if (arg_constr.datalen > 0)
5210 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
5212 arg_constr.data = NULL;
5213 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5214 for (size_t b = 0; b < arg_constr.datalen; b++) {
5215 long arr_conv_27 = arg_vals[b];
5216 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
5217 FREE((void*)arr_conv_27);
5218 arg_constr.data[b] = arr_conv_27_conv;
5220 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5221 CVec_SpendableOutputDescriptorZ_free(arg_constr);
5224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5225 LDKCVec_TransactionZ arg_constr;
5226 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5227 if (arg_constr.datalen > 0)
5228 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5230 arg_constr.data = NULL;
5231 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5232 for (size_t n = 0; n < arg_constr.datalen; n++) {
5233 long arr_conv_13 = arg_vals[n];
5234 LDKTransaction arr_conv_13_conv = *(LDKTransaction*)arr_conv_13;
5235 arg_constr.data[n] = arr_conv_13_conv;
5237 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5238 CVec_TransactionZ_free(arg_constr);
5241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5242 LDKCVec_TxOutZ arg_constr;
5243 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5244 if (arg_constr.datalen > 0)
5245 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5247 arg_constr.data = NULL;
5248 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5249 for (size_t h = 0; h < arg_constr.datalen; h++) {
5250 long arr_conv_7 = arg_vals[h];
5251 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5252 FREE((void*)arr_conv_7);
5253 arg_constr.data[h] = arr_conv_7_conv;
5255 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5256 CVec_TxOutZ_free(arg_constr);
5259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5260 LDKCVec_UpdateAddHTLCZ arg_constr;
5261 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5262 if (arg_constr.datalen > 0)
5263 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
5265 arg_constr.data = NULL;
5266 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5267 for (size_t p = 0; p < arg_constr.datalen; p++) {
5268 long arr_conv_15 = arg_vals[p];
5269 LDKUpdateAddHTLC arr_conv_15_conv;
5270 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
5271 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
5272 arg_constr.data[p] = arr_conv_15_conv;
5274 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5275 CVec_UpdateAddHTLCZ_free(arg_constr);
5278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5279 LDKCVec_UpdateFailHTLCZ arg_constr;
5280 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5281 if (arg_constr.datalen > 0)
5282 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
5284 arg_constr.data = NULL;
5285 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5286 for (size_t q = 0; q < arg_constr.datalen; q++) {
5287 long arr_conv_16 = arg_vals[q];
5288 LDKUpdateFailHTLC arr_conv_16_conv;
5289 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5290 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5291 arg_constr.data[q] = arr_conv_16_conv;
5293 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5294 CVec_UpdateFailHTLCZ_free(arg_constr);
5297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5298 LDKCVec_UpdateFailMalformedHTLCZ arg_constr;
5299 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5300 if (arg_constr.datalen > 0)
5301 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
5303 arg_constr.data = NULL;
5304 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5305 for (size_t z = 0; z < arg_constr.datalen; z++) {
5306 long arr_conv_25 = arg_vals[z];
5307 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
5308 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
5309 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
5310 arg_constr.data[z] = arr_conv_25_conv;
5312 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5313 CVec_UpdateFailMalformedHTLCZ_free(arg_constr);
5316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5317 LDKCVec_UpdateFulfillHTLCZ arg_constr;
5318 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5319 if (arg_constr.datalen > 0)
5320 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
5322 arg_constr.data = NULL;
5323 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5324 for (size_t t = 0; t < arg_constr.datalen; t++) {
5325 long arr_conv_19 = arg_vals[t];
5326 LDKUpdateFulfillHTLC arr_conv_19_conv;
5327 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5328 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5329 arg_constr.data[t] = arr_conv_19_conv;
5331 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5332 CVec_UpdateFulfillHTLCZ_free(arg_constr);
5335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5336 LDKCVec_u64Z arg_constr;
5337 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5338 if (arg_constr.datalen > 0)
5339 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
5341 arg_constr.data = NULL;
5342 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5343 for (size_t g = 0; g < arg_constr.datalen; g++) {
5344 long arr_conv_6 = arg_vals[g];
5345 arg_constr.data[g] = arr_conv_6;
5347 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5348 CVec_u64Z_free(arg_constr);
5351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
5352 LDKCVec_u8Z arg_ref;
5353 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
5354 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
5355 CVec_u8Z_free(arg_ref);
5356 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
5359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
5360 LDKTransaction _res_conv = *(LDKTransaction*)_res;
5361 Transaction_free(_res_conv);
5364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5365 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5367 TxOut_free(_res_conv);
5370 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5371 LDKTransaction b_conv = *(LDKTransaction*)b;
5372 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5373 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_conv);
5374 return (long)ret_ref;
5377 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5378 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5379 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
5380 return (long)ret_conv;
5383 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5384 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5385 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
5386 return (long)ret_conv;
5389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5391 a_conv.inner = (void*)(a & (~1));
5392 a_conv.is_owned = (a & 1) || (a == 0);
5393 if (a_conv.inner != NULL)
5394 a_conv = OutPoint_clone(&a_conv);
5396 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
5397 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5398 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5399 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5400 (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0);
5401 return (long)ret_ref;
5404 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5405 LDKThirtyTwoBytes a_ref;
5406 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5407 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5408 LDKCVec_TxOutZ b_constr;
5409 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5410 if (b_constr.datalen > 0)
5411 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5413 b_constr.data = NULL;
5414 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5415 for (size_t h = 0; h < b_constr.datalen; h++) {
5416 long arr_conv_7 = b_vals[h];
5417 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5418 FREE((void*)arr_conv_7);
5419 b_constr.data[h] = arr_conv_7_conv;
5421 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5422 LDKC2Tuple_TxidCVec_TxOutZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
5423 *ret_ref = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_constr);
5424 return (long)ret_ref;
5427 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5428 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5429 *ret_ref = C2Tuple_u64u64Z_new(a, b);
5430 return (long)ret_ref;
5433 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5435 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5436 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5437 LDKCVec_SignatureZ b_constr;
5438 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5439 if (b_constr.datalen > 0)
5440 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5442 b_constr.data = NULL;
5443 for (size_t i = 0; i < b_constr.datalen; i++) {
5444 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5445 LDKSignature arr_conv_8_ref;
5446 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5447 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5448 b_constr.data[i] = arr_conv_8_ref;
5450 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5451 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5452 return (long)ret_ref;
5455 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
5456 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5457 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5458 return (long)ret_conv;
5461 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
5462 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5463 *ret_conv = CResult_SignatureNoneZ_err();
5464 return (long)ret_conv;
5467 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
5468 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5469 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5470 return (long)ret_conv;
5473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
5474 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5475 *ret_conv = CResult_NoneAPIErrorZ_ok();
5476 return (long)ret_conv;
5479 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
5480 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5481 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
5482 return (long)ret_conv;
5485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
5486 LDKChannelAnnouncement a_conv;
5487 a_conv.inner = (void*)(a & (~1));
5488 a_conv.is_owned = (a & 1) || (a == 0);
5489 if (a_conv.inner != NULL)
5490 a_conv = ChannelAnnouncement_clone(&a_conv);
5491 LDKChannelUpdate b_conv;
5492 b_conv.inner = (void*)(b & (~1));
5493 b_conv.is_owned = (b & 1) || (b == 0);
5494 if (b_conv.inner != NULL)
5495 b_conv = ChannelUpdate_clone(&b_conv);
5496 LDKChannelUpdate c_conv;
5497 c_conv.inner = (void*)(c & (~1));
5498 c_conv.is_owned = (c & 1) || (c == 0);
5499 if (c_conv.inner != NULL)
5500 c_conv = ChannelUpdate_clone(&c_conv);
5501 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5502 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5503 return (long)ret_ref;
5506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
5507 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5508 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5509 return (long)ret_conv;
5512 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5513 LDKHTLCOutputInCommitment a_conv;
5514 a_conv.inner = (void*)(a & (~1));
5515 a_conv.is_owned = (a & 1) || (a == 0);
5516 if (a_conv.inner != NULL)
5517 a_conv = HTLCOutputInCommitment_clone(&a_conv);
5519 CHECK((*_env)->GetArrayLength (_env, b) == 64);
5520 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
5521 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
5522 *ret_ref = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
5523 return (long)ret_ref;
5526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5527 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
5528 FREE((void*)this_ptr);
5529 Event_free(this_ptr_conv);
5532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5533 LDKEvent* orig_conv = (LDKEvent*)orig;
5534 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
5535 *ret_copy = Event_clone(orig_conv);
5536 long ret_ref = (long)ret_copy;
5540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5541 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
5542 FREE((void*)this_ptr);
5543 MessageSendEvent_free(this_ptr_conv);
5546 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5547 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
5548 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5549 *ret_copy = MessageSendEvent_clone(orig_conv);
5550 long ret_ref = (long)ret_copy;
5554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5555 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
5556 FREE((void*)this_ptr);
5557 MessageSendEventsProvider_free(this_ptr_conv);
5560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5561 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
5562 FREE((void*)this_ptr);
5563 EventsProvider_free(this_ptr_conv);
5566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5567 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
5568 FREE((void*)this_ptr);
5569 APIError_free(this_ptr_conv);
5572 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5573 LDKAPIError* orig_conv = (LDKAPIError*)orig;
5574 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5575 *ret_copy = APIError_clone(orig_conv);
5576 long ret_ref = (long)ret_copy;
5580 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5581 LDKLevel* orig_conv = (LDKLevel*)orig;
5582 jclass ret_conv = LDKLevel_to_java(_env, Level_clone(orig_conv));
5586 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
5587 jclass ret_conv = LDKLevel_to_java(_env, Level_max());
5591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5592 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
5593 FREE((void*)this_ptr);
5594 Logger_free(this_ptr_conv);
5597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5598 LDKChannelHandshakeConfig this_ptr_conv;
5599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5600 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5601 ChannelHandshakeConfig_free(this_ptr_conv);
5604 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5605 LDKChannelHandshakeConfig orig_conv;
5606 orig_conv.inner = (void*)(orig & (~1));
5607 orig_conv.is_owned = false;
5608 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
5609 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5610 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5611 long ret_ref = (long)ret_var.inner;
5612 if (ret_var.is_owned) {
5618 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5619 LDKChannelHandshakeConfig this_ptr_conv;
5620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5621 this_ptr_conv.is_owned = false;
5622 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
5626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5627 LDKChannelHandshakeConfig this_ptr_conv;
5628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5629 this_ptr_conv.is_owned = false;
5630 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
5633 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5634 LDKChannelHandshakeConfig this_ptr_conv;
5635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5636 this_ptr_conv.is_owned = false;
5637 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
5641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5642 LDKChannelHandshakeConfig this_ptr_conv;
5643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5644 this_ptr_conv.is_owned = false;
5645 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
5648 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5649 LDKChannelHandshakeConfig this_ptr_conv;
5650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5651 this_ptr_conv.is_owned = false;
5652 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
5656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5657 LDKChannelHandshakeConfig this_ptr_conv;
5658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5659 this_ptr_conv.is_owned = false;
5660 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
5663 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) {
5664 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
5665 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5666 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5667 long ret_ref = (long)ret_var.inner;
5668 if (ret_var.is_owned) {
5674 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
5675 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
5676 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5677 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5678 long ret_ref = (long)ret_var.inner;
5679 if (ret_var.is_owned) {
5685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5686 LDKChannelHandshakeLimits this_ptr_conv;
5687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5688 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5689 ChannelHandshakeLimits_free(this_ptr_conv);
5692 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5693 LDKChannelHandshakeLimits orig_conv;
5694 orig_conv.inner = (void*)(orig & (~1));
5695 orig_conv.is_owned = false;
5696 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
5697 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5698 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5699 long ret_ref = (long)ret_var.inner;
5700 if (ret_var.is_owned) {
5706 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5707 LDKChannelHandshakeLimits this_ptr_conv;
5708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5709 this_ptr_conv.is_owned = false;
5710 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
5714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5715 LDKChannelHandshakeLimits this_ptr_conv;
5716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5717 this_ptr_conv.is_owned = false;
5718 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
5721 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5722 LDKChannelHandshakeLimits this_ptr_conv;
5723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5724 this_ptr_conv.is_owned = false;
5725 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
5729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5730 LDKChannelHandshakeLimits this_ptr_conv;
5731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5732 this_ptr_conv.is_owned = false;
5733 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
5736 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5737 LDKChannelHandshakeLimits this_ptr_conv;
5738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5739 this_ptr_conv.is_owned = false;
5740 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
5744 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) {
5745 LDKChannelHandshakeLimits this_ptr_conv;
5746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5747 this_ptr_conv.is_owned = false;
5748 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
5751 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5752 LDKChannelHandshakeLimits this_ptr_conv;
5753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5754 this_ptr_conv.is_owned = false;
5755 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
5759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5760 LDKChannelHandshakeLimits this_ptr_conv;
5761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5762 this_ptr_conv.is_owned = false;
5763 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
5766 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
5767 LDKChannelHandshakeLimits this_ptr_conv;
5768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5769 this_ptr_conv.is_owned = false;
5770 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
5774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5775 LDKChannelHandshakeLimits this_ptr_conv;
5776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5777 this_ptr_conv.is_owned = false;
5778 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
5781 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5782 LDKChannelHandshakeLimits this_ptr_conv;
5783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5784 this_ptr_conv.is_owned = false;
5785 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
5789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5790 LDKChannelHandshakeLimits this_ptr_conv;
5791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5792 this_ptr_conv.is_owned = false;
5793 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
5796 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5797 LDKChannelHandshakeLimits this_ptr_conv;
5798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5799 this_ptr_conv.is_owned = false;
5800 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
5804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5805 LDKChannelHandshakeLimits this_ptr_conv;
5806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5807 this_ptr_conv.is_owned = false;
5808 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
5811 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5812 LDKChannelHandshakeLimits this_ptr_conv;
5813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5814 this_ptr_conv.is_owned = false;
5815 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
5819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5820 LDKChannelHandshakeLimits this_ptr_conv;
5821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5822 this_ptr_conv.is_owned = false;
5823 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
5827 LDKChannelHandshakeLimits this_ptr_conv;
5828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5829 this_ptr_conv.is_owned = false;
5830 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5835 LDKChannelHandshakeLimits this_ptr_conv;
5836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5837 this_ptr_conv.is_owned = false;
5838 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5841 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5842 LDKChannelHandshakeLimits this_ptr_conv;
5843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5844 this_ptr_conv.is_owned = false;
5845 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5850 LDKChannelHandshakeLimits this_ptr_conv;
5851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5852 this_ptr_conv.is_owned = false;
5853 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5856 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) {
5857 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);
5858 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5859 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5860 long ret_ref = (long)ret_var.inner;
5861 if (ret_var.is_owned) {
5867 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5868 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
5869 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5870 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5871 long ret_ref = (long)ret_var.inner;
5872 if (ret_var.is_owned) {
5878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5879 LDKChannelConfig this_ptr_conv;
5880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5881 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5882 ChannelConfig_free(this_ptr_conv);
5885 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5886 LDKChannelConfig orig_conv;
5887 orig_conv.inner = (void*)(orig & (~1));
5888 orig_conv.is_owned = false;
5889 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
5890 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5891 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5892 long ret_ref = (long)ret_var.inner;
5893 if (ret_var.is_owned) {
5899 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
5900 LDKChannelConfig this_ptr_conv;
5901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5902 this_ptr_conv.is_owned = false;
5903 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
5907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5908 LDKChannelConfig this_ptr_conv;
5909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5910 this_ptr_conv.is_owned = false;
5911 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
5914 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
5915 LDKChannelConfig this_ptr_conv;
5916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5917 this_ptr_conv.is_owned = false;
5918 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
5922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5923 LDKChannelConfig this_ptr_conv;
5924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5925 this_ptr_conv.is_owned = false;
5926 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5929 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5930 LDKChannelConfig this_ptr_conv;
5931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5932 this_ptr_conv.is_owned = false;
5933 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5938 LDKChannelConfig this_ptr_conv;
5939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5940 this_ptr_conv.is_owned = false;
5941 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5944 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) {
5945 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5946 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5947 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5948 long ret_ref = (long)ret_var.inner;
5949 if (ret_var.is_owned) {
5955 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
5956 LDKChannelConfig ret_var = ChannelConfig_default();
5957 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5958 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5959 long ret_ref = (long)ret_var.inner;
5960 if (ret_var.is_owned) {
5966 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
5967 LDKChannelConfig obj_conv;
5968 obj_conv.inner = (void*)(obj & (~1));
5969 obj_conv.is_owned = false;
5970 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
5971 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5972 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5973 CVec_u8Z_free(arg_var);
5977 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5979 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5980 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5981 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
5982 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5983 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5984 long ret_ref = (long)ret_var.inner;
5985 if (ret_var.is_owned) {
5988 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5993 LDKUserConfig this_ptr_conv;
5994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5995 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5996 UserConfig_free(this_ptr_conv);
5999 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6000 LDKUserConfig orig_conv;
6001 orig_conv.inner = (void*)(orig & (~1));
6002 orig_conv.is_owned = false;
6003 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
6004 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6005 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6006 long ret_ref = (long)ret_var.inner;
6007 if (ret_var.is_owned) {
6013 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
6014 LDKUserConfig this_ptr_conv;
6015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6016 this_ptr_conv.is_owned = false;
6017 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
6018 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6019 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6020 long ret_ref = (long)ret_var.inner;
6021 if (ret_var.is_owned) {
6027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6028 LDKUserConfig this_ptr_conv;
6029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6030 this_ptr_conv.is_owned = false;
6031 LDKChannelHandshakeConfig val_conv;
6032 val_conv.inner = (void*)(val & (~1));
6033 val_conv.is_owned = (val & 1) || (val == 0);
6034 if (val_conv.inner != NULL)
6035 val_conv = ChannelHandshakeConfig_clone(&val_conv);
6036 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
6039 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
6040 LDKUserConfig this_ptr_conv;
6041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6042 this_ptr_conv.is_owned = false;
6043 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
6044 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6045 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6046 long ret_ref = (long)ret_var.inner;
6047 if (ret_var.is_owned) {
6053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6054 LDKUserConfig this_ptr_conv;
6055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6056 this_ptr_conv.is_owned = false;
6057 LDKChannelHandshakeLimits val_conv;
6058 val_conv.inner = (void*)(val & (~1));
6059 val_conv.is_owned = (val & 1) || (val == 0);
6060 if (val_conv.inner != NULL)
6061 val_conv = ChannelHandshakeLimits_clone(&val_conv);
6062 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
6065 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
6066 LDKUserConfig this_ptr_conv;
6067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6068 this_ptr_conv.is_owned = false;
6069 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
6070 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6071 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6072 long ret_ref = (long)ret_var.inner;
6073 if (ret_var.is_owned) {
6079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6080 LDKUserConfig this_ptr_conv;
6081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6082 this_ptr_conv.is_owned = false;
6083 LDKChannelConfig val_conv;
6084 val_conv.inner = (void*)(val & (~1));
6085 val_conv.is_owned = (val & 1) || (val == 0);
6086 if (val_conv.inner != NULL)
6087 val_conv = ChannelConfig_clone(&val_conv);
6088 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
6091 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) {
6092 LDKChannelHandshakeConfig own_channel_config_arg_conv;
6093 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
6094 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
6095 if (own_channel_config_arg_conv.inner != NULL)
6096 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
6097 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
6098 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
6099 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
6100 if (peer_channel_config_limits_arg_conv.inner != NULL)
6101 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
6102 LDKChannelConfig channel_options_arg_conv;
6103 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
6104 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
6105 if (channel_options_arg_conv.inner != NULL)
6106 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
6107 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
6108 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6109 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6110 long ret_ref = (long)ret_var.inner;
6111 if (ret_var.is_owned) {
6117 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
6118 LDKUserConfig ret_var = UserConfig_default();
6119 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6120 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6121 long ret_ref = (long)ret_var.inner;
6122 if (ret_var.is_owned) {
6128 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6129 LDKAccessError* orig_conv = (LDKAccessError*)orig;
6130 jclass ret_conv = LDKAccessError_to_java(_env, AccessError_clone(orig_conv));
6134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6135 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
6136 FREE((void*)this_ptr);
6137 Access_free(this_ptr_conv);
6140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6141 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
6142 FREE((void*)this_ptr);
6143 Watch_free(this_ptr_conv);
6146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6147 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
6148 FREE((void*)this_ptr);
6149 Filter_free(this_ptr_conv);
6152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6153 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
6154 FREE((void*)this_ptr);
6155 BroadcasterInterface_free(this_ptr_conv);
6158 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6159 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
6160 jclass ret_conv = LDKConfirmationTarget_to_java(_env, ConfirmationTarget_clone(orig_conv));
6164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6165 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
6166 FREE((void*)this_ptr);
6167 FeeEstimator_free(this_ptr_conv);
6170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6171 LDKChainMonitor this_ptr_conv;
6172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6173 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6174 ChainMonitor_free(this_ptr_conv);
6177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
6178 LDKChainMonitor this_arg_conv;
6179 this_arg_conv.inner = (void*)(this_arg & (~1));
6180 this_arg_conv.is_owned = false;
6181 unsigned char header_arr[80];
6182 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6183 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6184 unsigned char (*header_ref)[80] = &header_arr;
6185 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6186 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6187 if (txdata_constr.datalen > 0)
6188 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6190 txdata_constr.data = NULL;
6191 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6192 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6193 long arr_conv_29 = txdata_vals[d];
6194 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6195 FREE((void*)arr_conv_29);
6196 txdata_constr.data[d] = arr_conv_29_conv;
6198 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6199 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
6203 LDKChainMonitor this_arg_conv;
6204 this_arg_conv.inner = (void*)(this_arg & (~1));
6205 this_arg_conv.is_owned = false;
6206 unsigned char header_arr[80];
6207 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6208 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6209 unsigned char (*header_ref)[80] = &header_arr;
6210 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
6213 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
6214 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
6215 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6216 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6217 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6218 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6220 LDKLogger logger_conv = *(LDKLogger*)logger;
6221 if (logger_conv.free == LDKLogger_JCalls_free) {
6222 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6223 LDKLogger_JCalls_clone(logger_conv.this_arg);
6225 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
6226 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
6227 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6228 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
6230 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
6231 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6232 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6233 long ret_ref = (long)ret_var.inner;
6234 if (ret_var.is_owned) {
6240 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
6241 LDKChainMonitor this_arg_conv;
6242 this_arg_conv.inner = (void*)(this_arg & (~1));
6243 this_arg_conv.is_owned = false;
6244 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
6245 *ret = ChainMonitor_as_Watch(&this_arg_conv);
6249 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6250 LDKChainMonitor this_arg_conv;
6251 this_arg_conv.inner = (void*)(this_arg & (~1));
6252 this_arg_conv.is_owned = false;
6253 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6254 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
6258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6259 LDKChannelMonitorUpdate this_ptr_conv;
6260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6261 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6262 ChannelMonitorUpdate_free(this_ptr_conv);
6265 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6266 LDKChannelMonitorUpdate orig_conv;
6267 orig_conv.inner = (void*)(orig & (~1));
6268 orig_conv.is_owned = false;
6269 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
6270 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6271 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6272 long ret_ref = (long)ret_var.inner;
6273 if (ret_var.is_owned) {
6279 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6280 LDKChannelMonitorUpdate this_ptr_conv;
6281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6282 this_ptr_conv.is_owned = false;
6283 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
6287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6288 LDKChannelMonitorUpdate this_ptr_conv;
6289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6290 this_ptr_conv.is_owned = false;
6291 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
6294 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6295 LDKChannelMonitorUpdate obj_conv;
6296 obj_conv.inner = (void*)(obj & (~1));
6297 obj_conv.is_owned = false;
6298 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
6299 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6300 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6301 CVec_u8Z_free(arg_var);
6305 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6307 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6308 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6309 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_read(ser_ref);
6310 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6311 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6312 long ret_ref = (long)ret_var.inner;
6313 if (ret_var.is_owned) {
6316 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6320 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6321 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
6322 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(_env, ChannelMonitorUpdateErr_clone(orig_conv));
6326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6327 LDKMonitorUpdateError this_ptr_conv;
6328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6329 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6330 MonitorUpdateError_free(this_ptr_conv);
6333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6334 LDKMonitorEvent this_ptr_conv;
6335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6336 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6337 MonitorEvent_free(this_ptr_conv);
6340 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6341 LDKMonitorEvent orig_conv;
6342 orig_conv.inner = (void*)(orig & (~1));
6343 orig_conv.is_owned = false;
6344 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
6345 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6346 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6347 long ret_ref = (long)ret_var.inner;
6348 if (ret_var.is_owned) {
6354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6355 LDKHTLCUpdate this_ptr_conv;
6356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6357 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6358 HTLCUpdate_free(this_ptr_conv);
6361 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6362 LDKHTLCUpdate orig_conv;
6363 orig_conv.inner = (void*)(orig & (~1));
6364 orig_conv.is_owned = false;
6365 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
6366 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6367 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6368 long ret_ref = (long)ret_var.inner;
6369 if (ret_var.is_owned) {
6375 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6376 LDKHTLCUpdate obj_conv;
6377 obj_conv.inner = (void*)(obj & (~1));
6378 obj_conv.is_owned = false;
6379 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
6380 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6381 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6382 CVec_u8Z_free(arg_var);
6386 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6388 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6389 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6390 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
6391 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6392 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6393 long ret_ref = (long)ret_var.inner;
6394 if (ret_var.is_owned) {
6397 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6402 LDKChannelMonitor this_ptr_conv;
6403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6404 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6405 ChannelMonitor_free(this_ptr_conv);
6408 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
6409 LDKChannelMonitor this_arg_conv;
6410 this_arg_conv.inner = (void*)(this_arg & (~1));
6411 this_arg_conv.is_owned = false;
6412 LDKChannelMonitorUpdate updates_conv;
6413 updates_conv.inner = (void*)(updates & (~1));
6414 updates_conv.is_owned = (updates & 1) || (updates == 0);
6415 if (updates_conv.inner != NULL)
6416 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
6417 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
6418 LDKLogger* logger_conv = (LDKLogger*)logger;
6419 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6420 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
6421 return (long)ret_conv;
6424 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6425 LDKChannelMonitor this_arg_conv;
6426 this_arg_conv.inner = (void*)(this_arg & (~1));
6427 this_arg_conv.is_owned = false;
6428 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
6432 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
6433 LDKChannelMonitor this_arg_conv;
6434 this_arg_conv.inner = (void*)(this_arg & (~1));
6435 this_arg_conv.is_owned = false;
6436 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6437 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
6438 return (long)ret_ref;
6441 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6442 LDKChannelMonitor this_arg_conv;
6443 this_arg_conv.inner = (void*)(this_arg & (~1));
6444 this_arg_conv.is_owned = false;
6445 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
6446 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6447 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6448 for (size_t o = 0; o < ret_var.datalen; o++) {
6449 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
6450 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6451 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6452 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
6453 if (arr_conv_14_var.is_owned) {
6454 arr_conv_14_ref |= 1;
6456 ret_arr_ptr[o] = arr_conv_14_ref;
6458 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6463 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6464 LDKChannelMonitor this_arg_conv;
6465 this_arg_conv.inner = (void*)(this_arg & (~1));
6466 this_arg_conv.is_owned = false;
6467 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
6468 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6469 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6470 for (size_t h = 0; h < ret_var.datalen; h++) {
6471 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6472 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
6473 long arr_conv_7_ref = (long)arr_conv_7_copy;
6474 ret_arr_ptr[h] = arr_conv_7_ref;
6476 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6477 CVec_EventZ_free(ret_var);
6481 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
6482 LDKChannelMonitor this_arg_conv;
6483 this_arg_conv.inner = (void*)(this_arg & (~1));
6484 this_arg_conv.is_owned = false;
6485 LDKLogger* logger_conv = (LDKLogger*)logger;
6486 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
6487 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6488 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6489 for (size_t n = 0; n < ret_var.datalen; n++) {
6490 LDKTransaction *arr_conv_13_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
6491 *arr_conv_13_copy = ret_var.data[n];
6492 long arr_conv_13_ref = (long)arr_conv_13_copy;
6493 ret_arr_ptr[n] = arr_conv_13_ref;
6495 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6496 CVec_TransactionZ_free(ret_var);
6500 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) {
6501 LDKChannelMonitor this_arg_conv;
6502 this_arg_conv.inner = (void*)(this_arg & (~1));
6503 this_arg_conv.is_owned = false;
6504 unsigned char header_arr[80];
6505 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6506 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6507 unsigned char (*header_ref)[80] = &header_arr;
6508 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6509 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6510 if (txdata_constr.datalen > 0)
6511 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6513 txdata_constr.data = NULL;
6514 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6515 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6516 long arr_conv_29 = txdata_vals[d];
6517 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6518 FREE((void*)arr_conv_29);
6519 txdata_constr.data[d] = arr_conv_29_conv;
6521 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6522 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6523 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6524 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6525 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6527 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6528 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6529 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6530 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6532 LDKLogger logger_conv = *(LDKLogger*)logger;
6533 if (logger_conv.free == LDKLogger_JCalls_free) {
6534 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6535 LDKLogger_JCalls_clone(logger_conv.this_arg);
6537 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6538 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6539 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6540 for (size_t b = 0; b < ret_var.datalen; b++) {
6541 LDKC2Tuple_TxidCVec_TxOutZZ* arr_conv_27_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
6542 *arr_conv_27_ref = ret_var.data[b];
6543 ret_arr_ptr[b] = (long)arr_conv_27_ref;
6545 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6546 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(ret_var);
6550 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) {
6551 LDKChannelMonitor this_arg_conv;
6552 this_arg_conv.inner = (void*)(this_arg & (~1));
6553 this_arg_conv.is_owned = false;
6554 unsigned char header_arr[80];
6555 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6556 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6557 unsigned char (*header_ref)[80] = &header_arr;
6558 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6559 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6560 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6561 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6563 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6564 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6565 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6566 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6568 LDKLogger logger_conv = *(LDKLogger*)logger;
6569 if (logger_conv.free == LDKLogger_JCalls_free) {
6570 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6571 LDKLogger_JCalls_clone(logger_conv.this_arg);
6573 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6577 LDKOutPoint this_ptr_conv;
6578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6579 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6580 OutPoint_free(this_ptr_conv);
6583 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6584 LDKOutPoint orig_conv;
6585 orig_conv.inner = (void*)(orig & (~1));
6586 orig_conv.is_owned = false;
6587 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
6588 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6589 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6590 long ret_ref = (long)ret_var.inner;
6591 if (ret_var.is_owned) {
6597 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6598 LDKOutPoint this_ptr_conv;
6599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6600 this_ptr_conv.is_owned = false;
6601 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6602 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
6606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6607 LDKOutPoint this_ptr_conv;
6608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6609 this_ptr_conv.is_owned = false;
6610 LDKThirtyTwoBytes val_ref;
6611 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6612 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6613 OutPoint_set_txid(&this_ptr_conv, val_ref);
6616 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6617 LDKOutPoint this_ptr_conv;
6618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6619 this_ptr_conv.is_owned = false;
6620 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
6624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6625 LDKOutPoint this_ptr_conv;
6626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6627 this_ptr_conv.is_owned = false;
6628 OutPoint_set_index(&this_ptr_conv, val);
6631 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
6632 LDKThirtyTwoBytes txid_arg_ref;
6633 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
6634 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
6635 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
6636 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6637 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6638 long ret_ref = (long)ret_var.inner;
6639 if (ret_var.is_owned) {
6645 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6646 LDKOutPoint this_arg_conv;
6647 this_arg_conv.inner = (void*)(this_arg & (~1));
6648 this_arg_conv.is_owned = false;
6649 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
6650 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
6654 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
6655 LDKOutPoint obj_conv;
6656 obj_conv.inner = (void*)(obj & (~1));
6657 obj_conv.is_owned = false;
6658 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
6659 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6660 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6661 CVec_u8Z_free(arg_var);
6665 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6667 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6668 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6669 LDKOutPoint ret_var = OutPoint_read(ser_ref);
6670 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6671 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6672 long ret_ref = (long)ret_var.inner;
6673 if (ret_var.is_owned) {
6676 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6681 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
6682 FREE((void*)this_ptr);
6683 SpendableOutputDescriptor_free(this_ptr_conv);
6686 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6687 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
6688 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
6689 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
6690 long ret_ref = (long)ret_copy;
6694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6695 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
6696 FREE((void*)this_ptr);
6697 ChannelKeys_free(this_ptr_conv);
6700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6701 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
6702 FREE((void*)this_ptr);
6703 KeysInterface_free(this_ptr_conv);
6706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6707 LDKInMemoryChannelKeys this_ptr_conv;
6708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6710 InMemoryChannelKeys_free(this_ptr_conv);
6713 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6714 LDKInMemoryChannelKeys orig_conv;
6715 orig_conv.inner = (void*)(orig & (~1));
6716 orig_conv.is_owned = false;
6717 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
6718 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6719 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6720 long ret_ref = (long)ret_var.inner;
6721 if (ret_var.is_owned) {
6727 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6728 LDKInMemoryChannelKeys this_ptr_conv;
6729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6730 this_ptr_conv.is_owned = false;
6731 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6732 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
6736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6737 LDKInMemoryChannelKeys this_ptr_conv;
6738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6739 this_ptr_conv.is_owned = false;
6740 LDKSecretKey val_ref;
6741 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6742 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6743 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
6746 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6747 LDKInMemoryChannelKeys this_ptr_conv;
6748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6749 this_ptr_conv.is_owned = false;
6750 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6751 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
6755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6756 LDKInMemoryChannelKeys this_ptr_conv;
6757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6758 this_ptr_conv.is_owned = false;
6759 LDKSecretKey val_ref;
6760 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6761 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6762 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
6765 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6766 LDKInMemoryChannelKeys this_ptr_conv;
6767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6768 this_ptr_conv.is_owned = false;
6769 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6770 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
6774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6775 LDKInMemoryChannelKeys this_ptr_conv;
6776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6777 this_ptr_conv.is_owned = false;
6778 LDKSecretKey val_ref;
6779 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6780 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6781 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
6784 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6785 LDKInMemoryChannelKeys this_ptr_conv;
6786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6787 this_ptr_conv.is_owned = false;
6788 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6789 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
6793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6794 LDKInMemoryChannelKeys this_ptr_conv;
6795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6796 this_ptr_conv.is_owned = false;
6797 LDKSecretKey val_ref;
6798 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6799 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6800 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
6803 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6804 LDKInMemoryChannelKeys this_ptr_conv;
6805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6806 this_ptr_conv.is_owned = false;
6807 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6808 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
6812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6813 LDKInMemoryChannelKeys this_ptr_conv;
6814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6815 this_ptr_conv.is_owned = false;
6816 LDKSecretKey val_ref;
6817 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6818 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6819 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6822 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
6823 LDKInMemoryChannelKeys this_ptr_conv;
6824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6825 this_ptr_conv.is_owned = false;
6826 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6827 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
6831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6832 LDKInMemoryChannelKeys this_ptr_conv;
6833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6834 this_ptr_conv.is_owned = false;
6835 LDKThirtyTwoBytes val_ref;
6836 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6837 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6838 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6841 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) {
6842 LDKSecretKey funding_key_ref;
6843 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
6844 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
6845 LDKSecretKey revocation_base_key_ref;
6846 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
6847 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
6848 LDKSecretKey payment_key_ref;
6849 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
6850 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
6851 LDKSecretKey delayed_payment_base_key_ref;
6852 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
6853 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
6854 LDKSecretKey htlc_base_key_ref;
6855 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
6856 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
6857 LDKThirtyTwoBytes commitment_seed_ref;
6858 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
6859 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
6860 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
6861 FREE((void*)key_derivation_params);
6862 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);
6863 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6864 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6865 long ret_ref = (long)ret_var.inner;
6866 if (ret_var.is_owned) {
6872 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6873 LDKInMemoryChannelKeys this_arg_conv;
6874 this_arg_conv.inner = (void*)(this_arg & (~1));
6875 this_arg_conv.is_owned = false;
6876 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
6877 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6878 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6879 long ret_ref = (long)ret_var.inner;
6880 if (ret_var.is_owned) {
6886 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6887 LDKInMemoryChannelKeys this_arg_conv;
6888 this_arg_conv.inner = (void*)(this_arg & (~1));
6889 this_arg_conv.is_owned = false;
6890 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
6894 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(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 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
6902 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6903 LDKInMemoryChannelKeys this_arg_conv;
6904 this_arg_conv.inner = (void*)(this_arg & (~1));
6905 this_arg_conv.is_owned = false;
6906 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6907 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
6911 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
6912 LDKInMemoryChannelKeys obj_conv;
6913 obj_conv.inner = (void*)(obj & (~1));
6914 obj_conv.is_owned = false;
6915 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
6916 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6917 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6918 CVec_u8Z_free(arg_var);
6922 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6924 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6925 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6926 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_read(ser_ref);
6927 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6928 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6929 long ret_ref = (long)ret_var.inner;
6930 if (ret_var.is_owned) {
6933 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6938 LDKKeysManager this_ptr_conv;
6939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6940 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6941 KeysManager_free(this_ptr_conv);
6944 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) {
6945 unsigned char seed_arr[32];
6946 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
6947 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
6948 unsigned char (*seed_ref)[32] = &seed_arr;
6949 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6950 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
6951 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6952 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6953 long ret_ref = (long)ret_var.inner;
6954 if (ret_var.is_owned) {
6960 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) {
6961 LDKKeysManager this_arg_conv;
6962 this_arg_conv.inner = (void*)(this_arg & (~1));
6963 this_arg_conv.is_owned = false;
6964 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
6965 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6966 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6967 long ret_ref = (long)ret_var.inner;
6968 if (ret_var.is_owned) {
6974 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
6975 LDKKeysManager this_arg_conv;
6976 this_arg_conv.inner = (void*)(this_arg & (~1));
6977 this_arg_conv.is_owned = false;
6978 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6979 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
6983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6984 LDKChannelManager this_ptr_conv;
6985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6986 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6987 ChannelManager_free(this_ptr_conv);
6990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6991 LDKChannelDetails this_ptr_conv;
6992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6993 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6994 ChannelDetails_free(this_ptr_conv);
6997 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6998 LDKChannelDetails orig_conv;
6999 orig_conv.inner = (void*)(orig & (~1));
7000 orig_conv.is_owned = false;
7001 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
7002 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7003 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7004 long ret_ref = (long)ret_var.inner;
7005 if (ret_var.is_owned) {
7011 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7012 LDKChannelDetails this_ptr_conv;
7013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7014 this_ptr_conv.is_owned = false;
7015 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7016 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
7020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7021 LDKChannelDetails this_ptr_conv;
7022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7023 this_ptr_conv.is_owned = false;
7024 LDKThirtyTwoBytes val_ref;
7025 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7026 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7027 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
7030 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7031 LDKChannelDetails this_ptr_conv;
7032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7033 this_ptr_conv.is_owned = false;
7034 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7035 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
7039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7040 LDKChannelDetails this_ptr_conv;
7041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7042 this_ptr_conv.is_owned = false;
7043 LDKPublicKey val_ref;
7044 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7045 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7046 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
7049 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
7050 LDKChannelDetails this_ptr_conv;
7051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7052 this_ptr_conv.is_owned = false;
7053 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
7054 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7055 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7056 long ret_ref = (long)ret_var.inner;
7057 if (ret_var.is_owned) {
7063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7064 LDKChannelDetails this_ptr_conv;
7065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7066 this_ptr_conv.is_owned = false;
7067 LDKInitFeatures val_conv;
7068 val_conv.inner = (void*)(val & (~1));
7069 val_conv.is_owned = (val & 1) || (val == 0);
7070 // Warning: we may need a move here but can't clone!
7071 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
7074 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7075 LDKChannelDetails this_ptr_conv;
7076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7077 this_ptr_conv.is_owned = false;
7078 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
7082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7083 LDKChannelDetails this_ptr_conv;
7084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7085 this_ptr_conv.is_owned = false;
7086 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
7089 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7090 LDKChannelDetails this_ptr_conv;
7091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7092 this_ptr_conv.is_owned = false;
7093 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
7097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7098 LDKChannelDetails this_ptr_conv;
7099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7100 this_ptr_conv.is_owned = false;
7101 ChannelDetails_set_user_id(&this_ptr_conv, val);
7104 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7105 LDKChannelDetails this_ptr_conv;
7106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7107 this_ptr_conv.is_owned = false;
7108 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
7112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7113 LDKChannelDetails this_ptr_conv;
7114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7115 this_ptr_conv.is_owned = false;
7116 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
7119 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7120 LDKChannelDetails this_ptr_conv;
7121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7122 this_ptr_conv.is_owned = false;
7123 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
7127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7128 LDKChannelDetails this_ptr_conv;
7129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7130 this_ptr_conv.is_owned = false;
7131 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
7134 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
7135 LDKChannelDetails this_ptr_conv;
7136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7137 this_ptr_conv.is_owned = false;
7138 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
7142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
7143 LDKChannelDetails this_ptr_conv;
7144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7145 this_ptr_conv.is_owned = false;
7146 ChannelDetails_set_is_live(&this_ptr_conv, val);
7149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7150 LDKPaymentSendFailure this_ptr_conv;
7151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7152 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7153 PaymentSendFailure_free(this_ptr_conv);
7156 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) {
7157 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
7158 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
7159 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
7160 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7161 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
7163 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7164 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7165 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7166 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7168 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7169 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7170 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7171 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7173 LDKLogger logger_conv = *(LDKLogger*)logger;
7174 if (logger_conv.free == LDKLogger_JCalls_free) {
7175 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7176 LDKLogger_JCalls_clone(logger_conv.this_arg);
7178 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7179 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7180 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7181 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7183 LDKUserConfig config_conv;
7184 config_conv.inner = (void*)(config & (~1));
7185 config_conv.is_owned = (config & 1) || (config == 0);
7186 if (config_conv.inner != NULL)
7187 config_conv = UserConfig_clone(&config_conv);
7188 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);
7189 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7190 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7191 long ret_ref = (long)ret_var.inner;
7192 if (ret_var.is_owned) {
7198 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) {
7199 LDKChannelManager this_arg_conv;
7200 this_arg_conv.inner = (void*)(this_arg & (~1));
7201 this_arg_conv.is_owned = false;
7202 LDKPublicKey their_network_key_ref;
7203 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
7204 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
7205 LDKUserConfig override_config_conv;
7206 override_config_conv.inner = (void*)(override_config & (~1));
7207 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
7208 if (override_config_conv.inner != NULL)
7209 override_config_conv = UserConfig_clone(&override_config_conv);
7210 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7211 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
7212 return (long)ret_conv;
7215 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7216 LDKChannelManager this_arg_conv;
7217 this_arg_conv.inner = (void*)(this_arg & (~1));
7218 this_arg_conv.is_owned = false;
7219 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
7220 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7221 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7222 for (size_t q = 0; q < ret_var.datalen; q++) {
7223 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7224 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7225 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7226 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7227 if (arr_conv_16_var.is_owned) {
7228 arr_conv_16_ref |= 1;
7230 ret_arr_ptr[q] = arr_conv_16_ref;
7232 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7237 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_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_usable_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 jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7260 LDKChannelManager this_arg_conv;
7261 this_arg_conv.inner = (void*)(this_arg & (~1));
7262 this_arg_conv.is_owned = false;
7263 unsigned char channel_id_arr[32];
7264 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7265 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7266 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7267 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7268 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
7269 return (long)ret_conv;
7272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7273 LDKChannelManager this_arg_conv;
7274 this_arg_conv.inner = (void*)(this_arg & (~1));
7275 this_arg_conv.is_owned = false;
7276 unsigned char channel_id_arr[32];
7277 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7278 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7279 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7280 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
7283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7284 LDKChannelManager this_arg_conv;
7285 this_arg_conv.inner = (void*)(this_arg & (~1));
7286 this_arg_conv.is_owned = false;
7287 ChannelManager_force_close_all_channels(&this_arg_conv);
7290 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) {
7291 LDKChannelManager this_arg_conv;
7292 this_arg_conv.inner = (void*)(this_arg & (~1));
7293 this_arg_conv.is_owned = false;
7294 LDKRoute route_conv;
7295 route_conv.inner = (void*)(route & (~1));
7296 route_conv.is_owned = false;
7297 LDKThirtyTwoBytes payment_hash_ref;
7298 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7299 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
7300 LDKThirtyTwoBytes payment_secret_ref;
7301 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7302 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7303 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7304 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
7305 return (long)ret_conv;
7308 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) {
7309 LDKChannelManager this_arg_conv;
7310 this_arg_conv.inner = (void*)(this_arg & (~1));
7311 this_arg_conv.is_owned = false;
7312 unsigned char temporary_channel_id_arr[32];
7313 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
7314 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
7315 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
7316 LDKOutPoint funding_txo_conv;
7317 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7318 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
7319 if (funding_txo_conv.inner != NULL)
7320 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7321 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
7324 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) {
7325 LDKChannelManager this_arg_conv;
7326 this_arg_conv.inner = (void*)(this_arg & (~1));
7327 this_arg_conv.is_owned = false;
7328 LDKThreeBytes rgb_ref;
7329 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
7330 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
7331 LDKThirtyTwoBytes alias_ref;
7332 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
7333 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
7334 LDKCVec_NetAddressZ addresses_constr;
7335 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
7336 if (addresses_constr.datalen > 0)
7337 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7339 addresses_constr.data = NULL;
7340 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
7341 for (size_t m = 0; m < addresses_constr.datalen; m++) {
7342 long arr_conv_12 = addresses_vals[m];
7343 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
7344 FREE((void*)arr_conv_12);
7345 addresses_constr.data[m] = arr_conv_12_conv;
7347 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
7348 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
7351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
7352 LDKChannelManager this_arg_conv;
7353 this_arg_conv.inner = (void*)(this_arg & (~1));
7354 this_arg_conv.is_owned = false;
7355 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
7358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
7359 LDKChannelManager this_arg_conv;
7360 this_arg_conv.inner = (void*)(this_arg & (~1));
7361 this_arg_conv.is_owned = false;
7362 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
7365 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) {
7366 LDKChannelManager this_arg_conv;
7367 this_arg_conv.inner = (void*)(this_arg & (~1));
7368 this_arg_conv.is_owned = false;
7369 unsigned char payment_hash_arr[32];
7370 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7371 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
7372 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
7373 LDKThirtyTwoBytes payment_secret_ref;
7374 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7375 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7376 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
7380 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) {
7381 LDKChannelManager this_arg_conv;
7382 this_arg_conv.inner = (void*)(this_arg & (~1));
7383 this_arg_conv.is_owned = false;
7384 LDKThirtyTwoBytes payment_preimage_ref;
7385 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
7386 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
7387 LDKThirtyTwoBytes payment_secret_ref;
7388 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7389 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7390 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
7394 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
7395 LDKChannelManager this_arg_conv;
7396 this_arg_conv.inner = (void*)(this_arg & (~1));
7397 this_arg_conv.is_owned = false;
7398 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7399 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
7403 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) {
7404 LDKChannelManager this_arg_conv;
7405 this_arg_conv.inner = (void*)(this_arg & (~1));
7406 this_arg_conv.is_owned = false;
7407 LDKOutPoint funding_txo_conv;
7408 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7409 funding_txo_conv.is_owned = false;
7410 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
7413 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7414 LDKChannelManager this_arg_conv;
7415 this_arg_conv.inner = (void*)(this_arg & (~1));
7416 this_arg_conv.is_owned = false;
7417 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7418 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
7422 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7423 LDKChannelManager this_arg_conv;
7424 this_arg_conv.inner = (void*)(this_arg & (~1));
7425 this_arg_conv.is_owned = false;
7426 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7427 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
7431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
7432 LDKChannelManager this_arg_conv;
7433 this_arg_conv.inner = (void*)(this_arg & (~1));
7434 this_arg_conv.is_owned = false;
7435 unsigned char header_arr[80];
7436 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7437 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7438 unsigned char (*header_ref)[80] = &header_arr;
7439 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7440 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
7441 if (txdata_constr.datalen > 0)
7442 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7444 txdata_constr.data = NULL;
7445 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
7446 for (size_t d = 0; d < txdata_constr.datalen; d++) {
7447 long arr_conv_29 = txdata_vals[d];
7448 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
7449 FREE((void*)arr_conv_29);
7450 txdata_constr.data[d] = arr_conv_29_conv;
7452 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
7453 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
7456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
7457 LDKChannelManager this_arg_conv;
7458 this_arg_conv.inner = (void*)(this_arg & (~1));
7459 this_arg_conv.is_owned = false;
7460 unsigned char header_arr[80];
7461 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7462 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7463 unsigned char (*header_ref)[80] = &header_arr;
7464 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
7467 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
7468 LDKChannelManager this_arg_conv;
7469 this_arg_conv.inner = (void*)(this_arg & (~1));
7470 this_arg_conv.is_owned = false;
7471 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7472 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
7476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7477 LDKChannelManagerReadArgs this_ptr_conv;
7478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7479 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7480 ChannelManagerReadArgs_free(this_ptr_conv);
7483 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
7484 LDKChannelManagerReadArgs this_ptr_conv;
7485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7486 this_ptr_conv.is_owned = false;
7487 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
7491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7492 LDKChannelManagerReadArgs this_ptr_conv;
7493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7494 this_ptr_conv.is_owned = false;
7495 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
7496 if (val_conv.free == LDKKeysInterface_JCalls_free) {
7497 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7498 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
7500 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
7503 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
7504 LDKChannelManagerReadArgs this_ptr_conv;
7505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7506 this_ptr_conv.is_owned = false;
7507 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
7511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7512 LDKChannelManagerReadArgs this_ptr_conv;
7513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7514 this_ptr_conv.is_owned = false;
7515 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
7516 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
7517 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7518 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
7520 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
7523 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
7524 LDKChannelManagerReadArgs this_ptr_conv;
7525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7526 this_ptr_conv.is_owned = false;
7527 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
7531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7532 LDKChannelManagerReadArgs this_ptr_conv;
7533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7534 this_ptr_conv.is_owned = false;
7535 LDKWatch val_conv = *(LDKWatch*)val;
7536 if (val_conv.free == LDKWatch_JCalls_free) {
7537 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7538 LDKWatch_JCalls_clone(val_conv.this_arg);
7540 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
7543 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
7544 LDKChannelManagerReadArgs this_ptr_conv;
7545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7546 this_ptr_conv.is_owned = false;
7547 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
7551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7552 LDKChannelManagerReadArgs this_ptr_conv;
7553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7554 this_ptr_conv.is_owned = false;
7555 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
7556 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
7557 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7558 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
7560 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
7563 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
7564 LDKChannelManagerReadArgs this_ptr_conv;
7565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7566 this_ptr_conv.is_owned = false;
7567 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
7571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7572 LDKChannelManagerReadArgs this_ptr_conv;
7573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7574 this_ptr_conv.is_owned = false;
7575 LDKLogger val_conv = *(LDKLogger*)val;
7576 if (val_conv.free == LDKLogger_JCalls_free) {
7577 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7578 LDKLogger_JCalls_clone(val_conv.this_arg);
7580 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
7583 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
7584 LDKChannelManagerReadArgs this_ptr_conv;
7585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7586 this_ptr_conv.is_owned = false;
7587 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
7588 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7589 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7590 long ret_ref = (long)ret_var.inner;
7591 if (ret_var.is_owned) {
7597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7598 LDKChannelManagerReadArgs this_ptr_conv;
7599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7600 this_ptr_conv.is_owned = false;
7601 LDKUserConfig val_conv;
7602 val_conv.inner = (void*)(val & (~1));
7603 val_conv.is_owned = (val & 1) || (val == 0);
7604 if (val_conv.inner != NULL)
7605 val_conv = UserConfig_clone(&val_conv);
7606 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
7609 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) {
7610 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7611 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7612 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7613 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7615 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7616 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
7617 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7618 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
7620 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7621 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7622 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7623 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7625 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7626 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7627 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7628 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7630 LDKLogger logger_conv = *(LDKLogger*)logger;
7631 if (logger_conv.free == LDKLogger_JCalls_free) {
7632 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7633 LDKLogger_JCalls_clone(logger_conv.this_arg);
7635 LDKUserConfig default_config_conv;
7636 default_config_conv.inner = (void*)(default_config & (~1));
7637 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
7638 if (default_config_conv.inner != NULL)
7639 default_config_conv = UserConfig_clone(&default_config_conv);
7640 LDKCVec_ChannelMonitorZ channel_monitors_constr;
7641 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
7642 if (channel_monitors_constr.datalen > 0)
7643 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7645 channel_monitors_constr.data = NULL;
7646 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
7647 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
7648 long arr_conv_16 = channel_monitors_vals[q];
7649 LDKChannelMonitor arr_conv_16_conv;
7650 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7651 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7652 channel_monitors_constr.data[q] = arr_conv_16_conv;
7654 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
7655 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);
7656 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7657 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7658 long ret_ref = (long)ret_var.inner;
7659 if (ret_var.is_owned) {
7665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7666 LDKDecodeError this_ptr_conv;
7667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7668 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7669 DecodeError_free(this_ptr_conv);
7672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7673 LDKInit this_ptr_conv;
7674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7675 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7676 Init_free(this_ptr_conv);
7679 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7681 orig_conv.inner = (void*)(orig & (~1));
7682 orig_conv.is_owned = false;
7683 LDKInit ret_var = Init_clone(&orig_conv);
7684 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7685 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7686 long ret_ref = (long)ret_var.inner;
7687 if (ret_var.is_owned) {
7693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7694 LDKErrorMessage this_ptr_conv;
7695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7696 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7697 ErrorMessage_free(this_ptr_conv);
7700 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7701 LDKErrorMessage orig_conv;
7702 orig_conv.inner = (void*)(orig & (~1));
7703 orig_conv.is_owned = false;
7704 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
7705 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7706 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7707 long ret_ref = (long)ret_var.inner;
7708 if (ret_var.is_owned) {
7714 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7715 LDKErrorMessage this_ptr_conv;
7716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7717 this_ptr_conv.is_owned = false;
7718 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7719 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
7723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7724 LDKErrorMessage this_ptr_conv;
7725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7726 this_ptr_conv.is_owned = false;
7727 LDKThirtyTwoBytes val_ref;
7728 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7729 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7730 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
7733 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
7734 LDKErrorMessage this_ptr_conv;
7735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7736 this_ptr_conv.is_owned = false;
7737 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
7738 char* _buf = MALLOC(_str.len + 1, "str conv buf");
7739 memcpy(_buf, _str.chars, _str.len);
7741 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
7746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7747 LDKErrorMessage this_ptr_conv;
7748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7749 this_ptr_conv.is_owned = false;
7750 LDKCVec_u8Z val_ref;
7751 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
7752 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7753 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7754 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
7757 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
7758 LDKThirtyTwoBytes channel_id_arg_ref;
7759 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7760 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7761 LDKCVec_u8Z data_arg_ref;
7762 data_arg_ref.data = (*_env)->GetByteArrayElements (_env, data_arg, NULL);
7763 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
7764 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7765 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7766 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7767 long ret_ref = (long)ret_var.inner;
7768 if (ret_var.is_owned) {
7771 (*_env)->ReleaseByteArrayElements(_env, data_arg, (int8_t*)data_arg_ref.data, 0);
7775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7776 LDKPing this_ptr_conv;
7777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7778 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7779 Ping_free(this_ptr_conv);
7782 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7784 orig_conv.inner = (void*)(orig & (~1));
7785 orig_conv.is_owned = false;
7786 LDKPing ret_var = Ping_clone(&orig_conv);
7787 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7788 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7789 long ret_ref = (long)ret_var.inner;
7790 if (ret_var.is_owned) {
7796 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7797 LDKPing this_ptr_conv;
7798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7799 this_ptr_conv.is_owned = false;
7800 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7805 LDKPing this_ptr_conv;
7806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7807 this_ptr_conv.is_owned = false;
7808 Ping_set_ponglen(&this_ptr_conv, val);
7811 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7812 LDKPing this_ptr_conv;
7813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7814 this_ptr_conv.is_owned = false;
7815 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7820 LDKPing this_ptr_conv;
7821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7822 this_ptr_conv.is_owned = false;
7823 Ping_set_byteslen(&this_ptr_conv, val);
7826 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
7827 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
7828 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7829 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7830 long ret_ref = (long)ret_var.inner;
7831 if (ret_var.is_owned) {
7837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7838 LDKPong this_ptr_conv;
7839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7840 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7841 Pong_free(this_ptr_conv);
7844 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7846 orig_conv.inner = (void*)(orig & (~1));
7847 orig_conv.is_owned = false;
7848 LDKPong ret_var = Pong_clone(&orig_conv);
7849 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7850 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7851 long ret_ref = (long)ret_var.inner;
7852 if (ret_var.is_owned) {
7858 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7859 LDKPong this_ptr_conv;
7860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7861 this_ptr_conv.is_owned = false;
7862 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
7866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7867 LDKPong this_ptr_conv;
7868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7869 this_ptr_conv.is_owned = false;
7870 Pong_set_byteslen(&this_ptr_conv, val);
7873 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
7874 LDKPong ret_var = Pong_new(byteslen_arg);
7875 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7876 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7877 long ret_ref = (long)ret_var.inner;
7878 if (ret_var.is_owned) {
7884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7885 LDKOpenChannel this_ptr_conv;
7886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7887 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7888 OpenChannel_free(this_ptr_conv);
7891 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7892 LDKOpenChannel orig_conv;
7893 orig_conv.inner = (void*)(orig & (~1));
7894 orig_conv.is_owned = false;
7895 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
7896 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7897 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7898 long ret_ref = (long)ret_var.inner;
7899 if (ret_var.is_owned) {
7905 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7906 LDKOpenChannel this_ptr_conv;
7907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7908 this_ptr_conv.is_owned = false;
7909 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7910 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
7914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7915 LDKOpenChannel this_ptr_conv;
7916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7917 this_ptr_conv.is_owned = false;
7918 LDKThirtyTwoBytes val_ref;
7919 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7920 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7921 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
7924 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7925 LDKOpenChannel this_ptr_conv;
7926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7927 this_ptr_conv.is_owned = false;
7928 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7929 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
7933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7934 LDKOpenChannel this_ptr_conv;
7935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7936 this_ptr_conv.is_owned = false;
7937 LDKThirtyTwoBytes val_ref;
7938 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7939 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7940 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7943 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7944 LDKOpenChannel this_ptr_conv;
7945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7946 this_ptr_conv.is_owned = false;
7947 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
7951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7952 LDKOpenChannel this_ptr_conv;
7953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7954 this_ptr_conv.is_owned = false;
7955 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
7958 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7959 LDKOpenChannel this_ptr_conv;
7960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7961 this_ptr_conv.is_owned = false;
7962 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
7966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7967 LDKOpenChannel this_ptr_conv;
7968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7969 this_ptr_conv.is_owned = false;
7970 OpenChannel_set_push_msat(&this_ptr_conv, val);
7973 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7974 LDKOpenChannel this_ptr_conv;
7975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7976 this_ptr_conv.is_owned = false;
7977 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
7981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7982 LDKOpenChannel this_ptr_conv;
7983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7984 this_ptr_conv.is_owned = false;
7985 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7988 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7989 LDKOpenChannel this_ptr_conv;
7990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7991 this_ptr_conv.is_owned = false;
7992 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7996 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) {
7997 LDKOpenChannel this_ptr_conv;
7998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7999 this_ptr_conv.is_owned = false;
8000 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8003 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8004 LDKOpenChannel this_ptr_conv;
8005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8006 this_ptr_conv.is_owned = false;
8007 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8012 LDKOpenChannel this_ptr_conv;
8013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8014 this_ptr_conv.is_owned = false;
8015 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8018 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8019 LDKOpenChannel this_ptr_conv;
8020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8021 this_ptr_conv.is_owned = false;
8022 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
8026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8027 LDKOpenChannel this_ptr_conv;
8028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8029 this_ptr_conv.is_owned = false;
8030 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8033 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
8034 LDKOpenChannel this_ptr_conv;
8035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8036 this_ptr_conv.is_owned = false;
8037 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
8041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8042 LDKOpenChannel this_ptr_conv;
8043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8044 this_ptr_conv.is_owned = false;
8045 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
8048 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
8049 LDKOpenChannel this_ptr_conv;
8050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8051 this_ptr_conv.is_owned = false;
8052 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
8056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8057 LDKOpenChannel this_ptr_conv;
8058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8059 this_ptr_conv.is_owned = false;
8060 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
8063 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
8064 LDKOpenChannel this_ptr_conv;
8065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8066 this_ptr_conv.is_owned = false;
8067 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
8071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8072 LDKOpenChannel this_ptr_conv;
8073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8074 this_ptr_conv.is_owned = false;
8075 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8078 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8079 LDKOpenChannel this_ptr_conv;
8080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8081 this_ptr_conv.is_owned = false;
8082 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8083 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8088 LDKOpenChannel this_ptr_conv;
8089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8090 this_ptr_conv.is_owned = false;
8091 LDKPublicKey val_ref;
8092 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8093 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8094 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8097 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8098 LDKOpenChannel this_ptr_conv;
8099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8100 this_ptr_conv.is_owned = false;
8101 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8102 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8107 LDKOpenChannel this_ptr_conv;
8108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8109 this_ptr_conv.is_owned = false;
8110 LDKPublicKey val_ref;
8111 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8112 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8113 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8116 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8117 LDKOpenChannel this_ptr_conv;
8118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8119 this_ptr_conv.is_owned = false;
8120 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8121 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
8125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8126 LDKOpenChannel this_ptr_conv;
8127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8128 this_ptr_conv.is_owned = false;
8129 LDKPublicKey val_ref;
8130 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8131 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8132 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
8135 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8136 LDKOpenChannel this_ptr_conv;
8137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8138 this_ptr_conv.is_owned = false;
8139 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8140 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8145 LDKOpenChannel this_ptr_conv;
8146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8147 this_ptr_conv.is_owned = false;
8148 LDKPublicKey val_ref;
8149 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8150 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8151 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8154 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8155 LDKOpenChannel this_ptr_conv;
8156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8157 this_ptr_conv.is_owned = false;
8158 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8159 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8164 LDKOpenChannel this_ptr_conv;
8165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8166 this_ptr_conv.is_owned = false;
8167 LDKPublicKey val_ref;
8168 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8169 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8170 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8173 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8174 LDKOpenChannel this_ptr_conv;
8175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8176 this_ptr_conv.is_owned = false;
8177 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8178 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8183 LDKOpenChannel this_ptr_conv;
8184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8185 this_ptr_conv.is_owned = false;
8186 LDKPublicKey val_ref;
8187 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8188 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8189 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8192 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8193 LDKOpenChannel this_ptr_conv;
8194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8195 this_ptr_conv.is_owned = false;
8196 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
8200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8201 LDKOpenChannel this_ptr_conv;
8202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8203 this_ptr_conv.is_owned = false;
8204 OpenChannel_set_channel_flags(&this_ptr_conv, val);
8207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8208 LDKAcceptChannel this_ptr_conv;
8209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8210 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8211 AcceptChannel_free(this_ptr_conv);
8214 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8215 LDKAcceptChannel orig_conv;
8216 orig_conv.inner = (void*)(orig & (~1));
8217 orig_conv.is_owned = false;
8218 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
8219 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8220 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8221 long ret_ref = (long)ret_var.inner;
8222 if (ret_var.is_owned) {
8228 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8229 LDKAcceptChannel this_ptr_conv;
8230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8231 this_ptr_conv.is_owned = false;
8232 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8233 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
8237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8238 LDKAcceptChannel this_ptr_conv;
8239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8240 this_ptr_conv.is_owned = false;
8241 LDKThirtyTwoBytes val_ref;
8242 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8243 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8244 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8247 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8248 LDKAcceptChannel this_ptr_conv;
8249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8250 this_ptr_conv.is_owned = false;
8251 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
8255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8256 LDKAcceptChannel this_ptr_conv;
8257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8258 this_ptr_conv.is_owned = false;
8259 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8262 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8263 LDKAcceptChannel this_ptr_conv;
8264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8265 this_ptr_conv.is_owned = false;
8266 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8270 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) {
8271 LDKAcceptChannel this_ptr_conv;
8272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8273 this_ptr_conv.is_owned = false;
8274 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8277 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8278 LDKAcceptChannel this_ptr_conv;
8279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8280 this_ptr_conv.is_owned = false;
8281 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8286 LDKAcceptChannel this_ptr_conv;
8287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8288 this_ptr_conv.is_owned = false;
8289 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8292 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8293 LDKAcceptChannel this_ptr_conv;
8294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8295 this_ptr_conv.is_owned = false;
8296 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
8300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8301 LDKAcceptChannel this_ptr_conv;
8302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8303 this_ptr_conv.is_owned = false;
8304 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8307 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
8308 LDKAcceptChannel this_ptr_conv;
8309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8310 this_ptr_conv.is_owned = false;
8311 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
8315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8316 LDKAcceptChannel this_ptr_conv;
8317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8318 this_ptr_conv.is_owned = false;
8319 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
8322 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
8323 LDKAcceptChannel this_ptr_conv;
8324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8325 this_ptr_conv.is_owned = false;
8326 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
8330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8331 LDKAcceptChannel this_ptr_conv;
8332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8333 this_ptr_conv.is_owned = false;
8334 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
8337 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
8338 LDKAcceptChannel this_ptr_conv;
8339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8340 this_ptr_conv.is_owned = false;
8341 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
8345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8346 LDKAcceptChannel this_ptr_conv;
8347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8348 this_ptr_conv.is_owned = false;
8349 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8352 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8353 LDKAcceptChannel this_ptr_conv;
8354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8355 this_ptr_conv.is_owned = false;
8356 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8357 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8362 LDKAcceptChannel this_ptr_conv;
8363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8364 this_ptr_conv.is_owned = false;
8365 LDKPublicKey val_ref;
8366 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8367 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8368 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8371 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8372 LDKAcceptChannel this_ptr_conv;
8373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8374 this_ptr_conv.is_owned = false;
8375 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8376 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8381 LDKAcceptChannel this_ptr_conv;
8382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8383 this_ptr_conv.is_owned = false;
8384 LDKPublicKey val_ref;
8385 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8386 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8387 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8390 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8391 LDKAcceptChannel this_ptr_conv;
8392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8393 this_ptr_conv.is_owned = false;
8394 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8395 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
8399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8400 LDKAcceptChannel this_ptr_conv;
8401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8402 this_ptr_conv.is_owned = false;
8403 LDKPublicKey val_ref;
8404 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8405 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8406 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
8409 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8410 LDKAcceptChannel this_ptr_conv;
8411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8412 this_ptr_conv.is_owned = false;
8413 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8414 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8419 LDKAcceptChannel this_ptr_conv;
8420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8421 this_ptr_conv.is_owned = false;
8422 LDKPublicKey val_ref;
8423 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8424 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8425 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8428 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8429 LDKAcceptChannel this_ptr_conv;
8430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8431 this_ptr_conv.is_owned = false;
8432 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8433 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8438 LDKAcceptChannel this_ptr_conv;
8439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8440 this_ptr_conv.is_owned = false;
8441 LDKPublicKey val_ref;
8442 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8443 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8444 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8447 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8448 LDKAcceptChannel this_ptr_conv;
8449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8450 this_ptr_conv.is_owned = false;
8451 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8452 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8457 LDKAcceptChannel this_ptr_conv;
8458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8459 this_ptr_conv.is_owned = false;
8460 LDKPublicKey val_ref;
8461 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8462 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8463 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8467 LDKFundingCreated this_ptr_conv;
8468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8469 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8470 FundingCreated_free(this_ptr_conv);
8473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8474 LDKFundingCreated orig_conv;
8475 orig_conv.inner = (void*)(orig & (~1));
8476 orig_conv.is_owned = false;
8477 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
8478 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8479 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8480 long ret_ref = (long)ret_var.inner;
8481 if (ret_var.is_owned) {
8487 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8488 LDKFundingCreated this_ptr_conv;
8489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8490 this_ptr_conv.is_owned = false;
8491 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8492 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
8496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8497 LDKFundingCreated this_ptr_conv;
8498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8499 this_ptr_conv.is_owned = false;
8500 LDKThirtyTwoBytes val_ref;
8501 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8502 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8503 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
8506 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
8507 LDKFundingCreated this_ptr_conv;
8508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8509 this_ptr_conv.is_owned = false;
8510 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8511 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
8515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8516 LDKFundingCreated this_ptr_conv;
8517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8518 this_ptr_conv.is_owned = false;
8519 LDKThirtyTwoBytes val_ref;
8520 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8521 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8522 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
8525 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
8526 LDKFundingCreated this_ptr_conv;
8527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8528 this_ptr_conv.is_owned = false;
8529 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
8533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8534 LDKFundingCreated this_ptr_conv;
8535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8536 this_ptr_conv.is_owned = false;
8537 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
8540 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8541 LDKFundingCreated this_ptr_conv;
8542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8543 this_ptr_conv.is_owned = false;
8544 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8545 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
8549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8550 LDKFundingCreated this_ptr_conv;
8551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8552 this_ptr_conv.is_owned = false;
8553 LDKSignature val_ref;
8554 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8555 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8556 FundingCreated_set_signature(&this_ptr_conv, val_ref);
8559 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) {
8560 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
8561 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
8562 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
8563 LDKThirtyTwoBytes funding_txid_arg_ref;
8564 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
8565 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
8566 LDKSignature signature_arg_ref;
8567 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8568 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8569 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
8570 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8571 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8572 long ret_ref = (long)ret_var.inner;
8573 if (ret_var.is_owned) {
8579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8580 LDKFundingSigned this_ptr_conv;
8581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8582 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8583 FundingSigned_free(this_ptr_conv);
8586 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8587 LDKFundingSigned orig_conv;
8588 orig_conv.inner = (void*)(orig & (~1));
8589 orig_conv.is_owned = false;
8590 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
8591 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8592 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8593 long ret_ref = (long)ret_var.inner;
8594 if (ret_var.is_owned) {
8600 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8601 LDKFundingSigned this_ptr_conv;
8602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8603 this_ptr_conv.is_owned = false;
8604 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8605 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
8609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8610 LDKFundingSigned this_ptr_conv;
8611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8612 this_ptr_conv.is_owned = false;
8613 LDKThirtyTwoBytes val_ref;
8614 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8615 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8616 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
8619 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8620 LDKFundingSigned this_ptr_conv;
8621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8622 this_ptr_conv.is_owned = false;
8623 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8624 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
8628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8629 LDKFundingSigned this_ptr_conv;
8630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8631 this_ptr_conv.is_owned = false;
8632 LDKSignature val_ref;
8633 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8634 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8635 FundingSigned_set_signature(&this_ptr_conv, val_ref);
8638 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
8639 LDKThirtyTwoBytes channel_id_arg_ref;
8640 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8641 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8642 LDKSignature signature_arg_ref;
8643 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8644 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8645 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
8646 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8647 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8648 long ret_ref = (long)ret_var.inner;
8649 if (ret_var.is_owned) {
8655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8656 LDKFundingLocked this_ptr_conv;
8657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8658 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8659 FundingLocked_free(this_ptr_conv);
8662 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8663 LDKFundingLocked orig_conv;
8664 orig_conv.inner = (void*)(orig & (~1));
8665 orig_conv.is_owned = false;
8666 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
8667 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8668 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8669 long ret_ref = (long)ret_var.inner;
8670 if (ret_var.is_owned) {
8676 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8677 LDKFundingLocked this_ptr_conv;
8678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8679 this_ptr_conv.is_owned = false;
8680 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8681 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
8685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8686 LDKFundingLocked this_ptr_conv;
8687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8688 this_ptr_conv.is_owned = false;
8689 LDKThirtyTwoBytes val_ref;
8690 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8691 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8692 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
8695 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8696 LDKFundingLocked this_ptr_conv;
8697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8698 this_ptr_conv.is_owned = false;
8699 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8700 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8705 LDKFundingLocked this_ptr_conv;
8706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8707 this_ptr_conv.is_owned = false;
8708 LDKPublicKey val_ref;
8709 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8710 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8711 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8714 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
8715 LDKThirtyTwoBytes channel_id_arg_ref;
8716 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8717 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8718 LDKPublicKey next_per_commitment_point_arg_ref;
8719 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8720 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8721 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
8722 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8723 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8724 long ret_ref = (long)ret_var.inner;
8725 if (ret_var.is_owned) {
8731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8732 LDKShutdown this_ptr_conv;
8733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8734 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8735 Shutdown_free(this_ptr_conv);
8738 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8739 LDKShutdown orig_conv;
8740 orig_conv.inner = (void*)(orig & (~1));
8741 orig_conv.is_owned = false;
8742 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
8743 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8744 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8745 long ret_ref = (long)ret_var.inner;
8746 if (ret_var.is_owned) {
8752 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8753 LDKShutdown this_ptr_conv;
8754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8755 this_ptr_conv.is_owned = false;
8756 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8757 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
8761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8762 LDKShutdown this_ptr_conv;
8763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8764 this_ptr_conv.is_owned = false;
8765 LDKThirtyTwoBytes val_ref;
8766 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8767 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8768 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8771 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8772 LDKShutdown this_ptr_conv;
8773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8774 this_ptr_conv.is_owned = false;
8775 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8776 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8777 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8782 LDKShutdown this_ptr_conv;
8783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8784 this_ptr_conv.is_owned = false;
8785 LDKCVec_u8Z val_ref;
8786 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
8787 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
8788 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8789 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
8792 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
8793 LDKThirtyTwoBytes channel_id_arg_ref;
8794 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8795 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8796 LDKCVec_u8Z scriptpubkey_arg_ref;
8797 scriptpubkey_arg_ref.data = (*_env)->GetByteArrayElements (_env, scriptpubkey_arg, NULL);
8798 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
8799 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8800 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8801 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8802 long ret_ref = (long)ret_var.inner;
8803 if (ret_var.is_owned) {
8806 (*_env)->ReleaseByteArrayElements(_env, scriptpubkey_arg, (int8_t*)scriptpubkey_arg_ref.data, 0);
8810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8811 LDKClosingSigned this_ptr_conv;
8812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8813 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8814 ClosingSigned_free(this_ptr_conv);
8817 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8818 LDKClosingSigned orig_conv;
8819 orig_conv.inner = (void*)(orig & (~1));
8820 orig_conv.is_owned = false;
8821 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
8822 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8823 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8824 long ret_ref = (long)ret_var.inner;
8825 if (ret_var.is_owned) {
8831 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8832 LDKClosingSigned this_ptr_conv;
8833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8834 this_ptr_conv.is_owned = false;
8835 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8836 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
8840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8841 LDKClosingSigned this_ptr_conv;
8842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8843 this_ptr_conv.is_owned = false;
8844 LDKThirtyTwoBytes val_ref;
8845 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8846 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8847 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
8850 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8851 LDKClosingSigned this_ptr_conv;
8852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8853 this_ptr_conv.is_owned = false;
8854 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
8858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8859 LDKClosingSigned this_ptr_conv;
8860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8861 this_ptr_conv.is_owned = false;
8862 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
8865 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8866 LDKClosingSigned this_ptr_conv;
8867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8868 this_ptr_conv.is_owned = false;
8869 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8870 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
8874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8875 LDKClosingSigned this_ptr_conv;
8876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8877 this_ptr_conv.is_owned = false;
8878 LDKSignature val_ref;
8879 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8880 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8881 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
8884 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) {
8885 LDKThirtyTwoBytes channel_id_arg_ref;
8886 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8887 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8888 LDKSignature signature_arg_ref;
8889 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8890 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8891 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
8892 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8893 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8894 long ret_ref = (long)ret_var.inner;
8895 if (ret_var.is_owned) {
8901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8902 LDKUpdateAddHTLC this_ptr_conv;
8903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8905 UpdateAddHTLC_free(this_ptr_conv);
8908 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8909 LDKUpdateAddHTLC orig_conv;
8910 orig_conv.inner = (void*)(orig & (~1));
8911 orig_conv.is_owned = false;
8912 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
8913 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8914 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8915 long ret_ref = (long)ret_var.inner;
8916 if (ret_var.is_owned) {
8922 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8923 LDKUpdateAddHTLC this_ptr_conv;
8924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8925 this_ptr_conv.is_owned = false;
8926 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8927 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
8931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8932 LDKUpdateAddHTLC this_ptr_conv;
8933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8934 this_ptr_conv.is_owned = false;
8935 LDKThirtyTwoBytes val_ref;
8936 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8937 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8938 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
8941 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8942 LDKUpdateAddHTLC this_ptr_conv;
8943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8944 this_ptr_conv.is_owned = false;
8945 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
8949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8950 LDKUpdateAddHTLC this_ptr_conv;
8951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8952 this_ptr_conv.is_owned = false;
8953 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
8956 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8957 LDKUpdateAddHTLC this_ptr_conv;
8958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8959 this_ptr_conv.is_owned = false;
8960 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
8964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8965 LDKUpdateAddHTLC this_ptr_conv;
8966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8967 this_ptr_conv.is_owned = false;
8968 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
8971 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8972 LDKUpdateAddHTLC this_ptr_conv;
8973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8974 this_ptr_conv.is_owned = false;
8975 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8976 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
8980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8981 LDKUpdateAddHTLC this_ptr_conv;
8982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8983 this_ptr_conv.is_owned = false;
8984 LDKThirtyTwoBytes val_ref;
8985 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8986 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8987 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
8990 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
8991 LDKUpdateAddHTLC this_ptr_conv;
8992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8993 this_ptr_conv.is_owned = false;
8994 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
8998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8999 LDKUpdateAddHTLC this_ptr_conv;
9000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9001 this_ptr_conv.is_owned = false;
9002 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
9005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9006 LDKUpdateFulfillHTLC this_ptr_conv;
9007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9008 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9009 UpdateFulfillHTLC_free(this_ptr_conv);
9012 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9013 LDKUpdateFulfillHTLC orig_conv;
9014 orig_conv.inner = (void*)(orig & (~1));
9015 orig_conv.is_owned = false;
9016 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
9017 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9018 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9019 long ret_ref = (long)ret_var.inner;
9020 if (ret_var.is_owned) {
9026 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9027 LDKUpdateFulfillHTLC this_ptr_conv;
9028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9029 this_ptr_conv.is_owned = false;
9030 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9031 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
9035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9036 LDKUpdateFulfillHTLC this_ptr_conv;
9037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9038 this_ptr_conv.is_owned = false;
9039 LDKThirtyTwoBytes val_ref;
9040 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9041 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9042 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
9045 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9046 LDKUpdateFulfillHTLC this_ptr_conv;
9047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9048 this_ptr_conv.is_owned = false;
9049 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
9053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9054 LDKUpdateFulfillHTLC this_ptr_conv;
9055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9056 this_ptr_conv.is_owned = false;
9057 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
9060 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
9061 LDKUpdateFulfillHTLC this_ptr_conv;
9062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9063 this_ptr_conv.is_owned = false;
9064 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9065 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
9069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9070 LDKUpdateFulfillHTLC this_ptr_conv;
9071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9072 this_ptr_conv.is_owned = false;
9073 LDKThirtyTwoBytes val_ref;
9074 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9075 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9076 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
9079 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) {
9080 LDKThirtyTwoBytes channel_id_arg_ref;
9081 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9082 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9083 LDKThirtyTwoBytes payment_preimage_arg_ref;
9084 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
9085 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
9086 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
9087 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9088 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9089 long ret_ref = (long)ret_var.inner;
9090 if (ret_var.is_owned) {
9096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9097 LDKUpdateFailHTLC this_ptr_conv;
9098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9099 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9100 UpdateFailHTLC_free(this_ptr_conv);
9103 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9104 LDKUpdateFailHTLC orig_conv;
9105 orig_conv.inner = (void*)(orig & (~1));
9106 orig_conv.is_owned = false;
9107 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
9108 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9109 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9110 long ret_ref = (long)ret_var.inner;
9111 if (ret_var.is_owned) {
9117 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9118 LDKUpdateFailHTLC this_ptr_conv;
9119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9120 this_ptr_conv.is_owned = false;
9121 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9122 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
9126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9127 LDKUpdateFailHTLC this_ptr_conv;
9128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9129 this_ptr_conv.is_owned = false;
9130 LDKThirtyTwoBytes val_ref;
9131 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9132 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9133 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
9136 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9137 LDKUpdateFailHTLC this_ptr_conv;
9138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9139 this_ptr_conv.is_owned = false;
9140 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
9144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9145 LDKUpdateFailHTLC this_ptr_conv;
9146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9147 this_ptr_conv.is_owned = false;
9148 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
9151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9152 LDKUpdateFailMalformedHTLC this_ptr_conv;
9153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9154 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9155 UpdateFailMalformedHTLC_free(this_ptr_conv);
9158 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9159 LDKUpdateFailMalformedHTLC orig_conv;
9160 orig_conv.inner = (void*)(orig & (~1));
9161 orig_conv.is_owned = false;
9162 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
9163 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9164 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9165 long ret_ref = (long)ret_var.inner;
9166 if (ret_var.is_owned) {
9172 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9173 LDKUpdateFailMalformedHTLC this_ptr_conv;
9174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9175 this_ptr_conv.is_owned = false;
9176 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9177 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
9181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9182 LDKUpdateFailMalformedHTLC this_ptr_conv;
9183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9184 this_ptr_conv.is_owned = false;
9185 LDKThirtyTwoBytes val_ref;
9186 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9187 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9188 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
9191 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9192 LDKUpdateFailMalformedHTLC this_ptr_conv;
9193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9194 this_ptr_conv.is_owned = false;
9195 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
9199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9200 LDKUpdateFailMalformedHTLC this_ptr_conv;
9201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9202 this_ptr_conv.is_owned = false;
9203 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
9206 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
9207 LDKUpdateFailMalformedHTLC this_ptr_conv;
9208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9209 this_ptr_conv.is_owned = false;
9210 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
9214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9215 LDKUpdateFailMalformedHTLC this_ptr_conv;
9216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9217 this_ptr_conv.is_owned = false;
9218 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
9221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9222 LDKCommitmentSigned this_ptr_conv;
9223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9224 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9225 CommitmentSigned_free(this_ptr_conv);
9228 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9229 LDKCommitmentSigned orig_conv;
9230 orig_conv.inner = (void*)(orig & (~1));
9231 orig_conv.is_owned = false;
9232 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
9233 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9234 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9235 long ret_ref = (long)ret_var.inner;
9236 if (ret_var.is_owned) {
9242 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9243 LDKCommitmentSigned this_ptr_conv;
9244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9245 this_ptr_conv.is_owned = false;
9246 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9247 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
9251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9252 LDKCommitmentSigned this_ptr_conv;
9253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9254 this_ptr_conv.is_owned = false;
9255 LDKThirtyTwoBytes val_ref;
9256 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9257 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9258 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
9261 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9262 LDKCommitmentSigned this_ptr_conv;
9263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9264 this_ptr_conv.is_owned = false;
9265 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9266 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
9270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9271 LDKCommitmentSigned this_ptr_conv;
9272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9273 this_ptr_conv.is_owned = false;
9274 LDKSignature val_ref;
9275 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9276 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9277 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
9280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
9281 LDKCommitmentSigned this_ptr_conv;
9282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9283 this_ptr_conv.is_owned = false;
9284 LDKCVec_SignatureZ val_constr;
9285 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9286 if (val_constr.datalen > 0)
9287 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9289 val_constr.data = NULL;
9290 for (size_t i = 0; i < val_constr.datalen; i++) {
9291 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
9292 LDKSignature arr_conv_8_ref;
9293 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9294 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9295 val_constr.data[i] = arr_conv_8_ref;
9297 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
9300 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) {
9301 LDKThirtyTwoBytes channel_id_arg_ref;
9302 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9303 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9304 LDKSignature signature_arg_ref;
9305 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9306 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9307 LDKCVec_SignatureZ htlc_signatures_arg_constr;
9308 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
9309 if (htlc_signatures_arg_constr.datalen > 0)
9310 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9312 htlc_signatures_arg_constr.data = NULL;
9313 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
9314 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
9315 LDKSignature arr_conv_8_ref;
9316 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9317 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9318 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
9320 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
9321 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9322 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9323 long ret_ref = (long)ret_var.inner;
9324 if (ret_var.is_owned) {
9330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9331 LDKRevokeAndACK this_ptr_conv;
9332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9333 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9334 RevokeAndACK_free(this_ptr_conv);
9337 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9338 LDKRevokeAndACK orig_conv;
9339 orig_conv.inner = (void*)(orig & (~1));
9340 orig_conv.is_owned = false;
9341 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
9342 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9343 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9344 long ret_ref = (long)ret_var.inner;
9345 if (ret_var.is_owned) {
9351 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9352 LDKRevokeAndACK this_ptr_conv;
9353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9354 this_ptr_conv.is_owned = false;
9355 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9356 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
9360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9361 LDKRevokeAndACK this_ptr_conv;
9362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9363 this_ptr_conv.is_owned = false;
9364 LDKThirtyTwoBytes val_ref;
9365 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9366 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9367 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
9370 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9371 LDKRevokeAndACK this_ptr_conv;
9372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9373 this_ptr_conv.is_owned = false;
9374 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9375 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
9379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9380 LDKRevokeAndACK this_ptr_conv;
9381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9382 this_ptr_conv.is_owned = false;
9383 LDKThirtyTwoBytes val_ref;
9384 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9385 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9386 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
9389 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9390 LDKRevokeAndACK this_ptr_conv;
9391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9392 this_ptr_conv.is_owned = false;
9393 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9394 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
9398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9399 LDKRevokeAndACK this_ptr_conv;
9400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9401 this_ptr_conv.is_owned = false;
9402 LDKPublicKey val_ref;
9403 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9404 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9405 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
9408 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) {
9409 LDKThirtyTwoBytes channel_id_arg_ref;
9410 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9411 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9412 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
9413 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
9414 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
9415 LDKPublicKey next_per_commitment_point_arg_ref;
9416 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
9417 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
9418 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
9419 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9420 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9421 long ret_ref = (long)ret_var.inner;
9422 if (ret_var.is_owned) {
9428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9429 LDKUpdateFee this_ptr_conv;
9430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9431 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9432 UpdateFee_free(this_ptr_conv);
9435 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9436 LDKUpdateFee orig_conv;
9437 orig_conv.inner = (void*)(orig & (~1));
9438 orig_conv.is_owned = false;
9439 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
9440 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9441 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9442 long ret_ref = (long)ret_var.inner;
9443 if (ret_var.is_owned) {
9449 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9450 LDKUpdateFee this_ptr_conv;
9451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9452 this_ptr_conv.is_owned = false;
9453 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9454 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
9458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9459 LDKUpdateFee this_ptr_conv;
9460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9461 this_ptr_conv.is_owned = false;
9462 LDKThirtyTwoBytes val_ref;
9463 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9464 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9465 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
9468 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
9469 LDKUpdateFee this_ptr_conv;
9470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9471 this_ptr_conv.is_owned = false;
9472 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
9476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9477 LDKUpdateFee this_ptr_conv;
9478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9479 this_ptr_conv.is_owned = false;
9480 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
9483 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
9484 LDKThirtyTwoBytes channel_id_arg_ref;
9485 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9486 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9487 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
9488 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9489 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9490 long ret_ref = (long)ret_var.inner;
9491 if (ret_var.is_owned) {
9497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9498 LDKDataLossProtect this_ptr_conv;
9499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9500 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9501 DataLossProtect_free(this_ptr_conv);
9504 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9505 LDKDataLossProtect orig_conv;
9506 orig_conv.inner = (void*)(orig & (~1));
9507 orig_conv.is_owned = false;
9508 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
9509 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9510 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9511 long ret_ref = (long)ret_var.inner;
9512 if (ret_var.is_owned) {
9518 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9519 LDKDataLossProtect this_ptr_conv;
9520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9521 this_ptr_conv.is_owned = false;
9522 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9523 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
9527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9528 LDKDataLossProtect this_ptr_conv;
9529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9530 this_ptr_conv.is_owned = false;
9531 LDKThirtyTwoBytes val_ref;
9532 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9533 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9534 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
9537 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9538 LDKDataLossProtect this_ptr_conv;
9539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9540 this_ptr_conv.is_owned = false;
9541 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9542 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
9546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9547 LDKDataLossProtect this_ptr_conv;
9548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9549 this_ptr_conv.is_owned = false;
9550 LDKPublicKey val_ref;
9551 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9552 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9553 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
9556 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) {
9557 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
9558 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
9559 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
9560 LDKPublicKey my_current_per_commitment_point_arg_ref;
9561 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
9562 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
9563 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
9564 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9565 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9566 long ret_ref = (long)ret_var.inner;
9567 if (ret_var.is_owned) {
9573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9574 LDKChannelReestablish this_ptr_conv;
9575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9576 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9577 ChannelReestablish_free(this_ptr_conv);
9580 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9581 LDKChannelReestablish orig_conv;
9582 orig_conv.inner = (void*)(orig & (~1));
9583 orig_conv.is_owned = false;
9584 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
9585 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9586 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9587 long ret_ref = (long)ret_var.inner;
9588 if (ret_var.is_owned) {
9594 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9595 LDKChannelReestablish this_ptr_conv;
9596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9597 this_ptr_conv.is_owned = false;
9598 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9599 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
9603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9604 LDKChannelReestablish this_ptr_conv;
9605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9606 this_ptr_conv.is_owned = false;
9607 LDKThirtyTwoBytes val_ref;
9608 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9609 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9610 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
9613 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9614 LDKChannelReestablish this_ptr_conv;
9615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9616 this_ptr_conv.is_owned = false;
9617 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
9621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9622 LDKChannelReestablish this_ptr_conv;
9623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9624 this_ptr_conv.is_owned = false;
9625 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
9628 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9629 LDKChannelReestablish this_ptr_conv;
9630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9631 this_ptr_conv.is_owned = false;
9632 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
9636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9637 LDKChannelReestablish this_ptr_conv;
9638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9639 this_ptr_conv.is_owned = false;
9640 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
9643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9644 LDKAnnouncementSignatures this_ptr_conv;
9645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9646 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9647 AnnouncementSignatures_free(this_ptr_conv);
9650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9651 LDKAnnouncementSignatures orig_conv;
9652 orig_conv.inner = (void*)(orig & (~1));
9653 orig_conv.is_owned = false;
9654 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
9655 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9656 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9657 long ret_ref = (long)ret_var.inner;
9658 if (ret_var.is_owned) {
9664 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9665 LDKAnnouncementSignatures this_ptr_conv;
9666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9667 this_ptr_conv.is_owned = false;
9668 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9669 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
9673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9674 LDKAnnouncementSignatures this_ptr_conv;
9675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9676 this_ptr_conv.is_owned = false;
9677 LDKThirtyTwoBytes val_ref;
9678 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9679 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9680 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
9683 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9684 LDKAnnouncementSignatures this_ptr_conv;
9685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9686 this_ptr_conv.is_owned = false;
9687 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
9691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9692 LDKAnnouncementSignatures this_ptr_conv;
9693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9694 this_ptr_conv.is_owned = false;
9695 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
9698 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9699 LDKAnnouncementSignatures this_ptr_conv;
9700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9701 this_ptr_conv.is_owned = false;
9702 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9703 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
9707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9708 LDKAnnouncementSignatures this_ptr_conv;
9709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9710 this_ptr_conv.is_owned = false;
9711 LDKSignature val_ref;
9712 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9713 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9714 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
9717 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9718 LDKAnnouncementSignatures this_ptr_conv;
9719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9720 this_ptr_conv.is_owned = false;
9721 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9722 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
9726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9727 LDKAnnouncementSignatures this_ptr_conv;
9728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9729 this_ptr_conv.is_owned = false;
9730 LDKSignature val_ref;
9731 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9732 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9733 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
9736 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) {
9737 LDKThirtyTwoBytes channel_id_arg_ref;
9738 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9739 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9740 LDKSignature node_signature_arg_ref;
9741 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
9742 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
9743 LDKSignature bitcoin_signature_arg_ref;
9744 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
9745 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
9746 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
9747 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9748 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9749 long ret_ref = (long)ret_var.inner;
9750 if (ret_var.is_owned) {
9756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9757 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
9758 FREE((void*)this_ptr);
9759 NetAddress_free(this_ptr_conv);
9762 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9763 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
9764 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9765 *ret_copy = NetAddress_clone(orig_conv);
9766 long ret_ref = (long)ret_copy;
9770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9771 LDKUnsignedNodeAnnouncement this_ptr_conv;
9772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9773 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9774 UnsignedNodeAnnouncement_free(this_ptr_conv);
9777 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9778 LDKUnsignedNodeAnnouncement orig_conv;
9779 orig_conv.inner = (void*)(orig & (~1));
9780 orig_conv.is_owned = false;
9781 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
9782 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9783 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9784 long ret_ref = (long)ret_var.inner;
9785 if (ret_var.is_owned) {
9791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9792 LDKUnsignedNodeAnnouncement this_ptr_conv;
9793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9794 this_ptr_conv.is_owned = false;
9795 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9796 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9797 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9798 long ret_ref = (long)ret_var.inner;
9799 if (ret_var.is_owned) {
9805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9806 LDKUnsignedNodeAnnouncement this_ptr_conv;
9807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9808 this_ptr_conv.is_owned = false;
9809 LDKNodeFeatures val_conv;
9810 val_conv.inner = (void*)(val & (~1));
9811 val_conv.is_owned = (val & 1) || (val == 0);
9812 // Warning: we may need a move here but can't clone!
9813 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9816 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9817 LDKUnsignedNodeAnnouncement this_ptr_conv;
9818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9819 this_ptr_conv.is_owned = false;
9820 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9825 LDKUnsignedNodeAnnouncement this_ptr_conv;
9826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9827 this_ptr_conv.is_owned = false;
9828 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9831 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9832 LDKUnsignedNodeAnnouncement this_ptr_conv;
9833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9834 this_ptr_conv.is_owned = false;
9835 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9836 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
9840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9841 LDKUnsignedNodeAnnouncement this_ptr_conv;
9842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9843 this_ptr_conv.is_owned = false;
9844 LDKPublicKey val_ref;
9845 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9846 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9847 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
9850 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
9851 LDKUnsignedNodeAnnouncement this_ptr_conv;
9852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9853 this_ptr_conv.is_owned = false;
9854 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
9855 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
9859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9860 LDKUnsignedNodeAnnouncement this_ptr_conv;
9861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9862 this_ptr_conv.is_owned = false;
9863 LDKThreeBytes val_ref;
9864 CHECK((*_env)->GetArrayLength (_env, val) == 3);
9865 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
9866 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
9869 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
9870 LDKUnsignedNodeAnnouncement this_ptr_conv;
9871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9872 this_ptr_conv.is_owned = false;
9873 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9874 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
9878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9879 LDKUnsignedNodeAnnouncement this_ptr_conv;
9880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9881 this_ptr_conv.is_owned = false;
9882 LDKThirtyTwoBytes val_ref;
9883 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9884 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9885 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
9888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9889 LDKUnsignedNodeAnnouncement this_ptr_conv;
9890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9891 this_ptr_conv.is_owned = false;
9892 LDKCVec_NetAddressZ val_constr;
9893 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9894 if (val_constr.datalen > 0)
9895 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9897 val_constr.data = NULL;
9898 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9899 for (size_t m = 0; m < val_constr.datalen; m++) {
9900 long arr_conv_12 = val_vals[m];
9901 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9902 FREE((void*)arr_conv_12);
9903 val_constr.data[m] = arr_conv_12_conv;
9905 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9906 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
9909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9910 LDKNodeAnnouncement this_ptr_conv;
9911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9912 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9913 NodeAnnouncement_free(this_ptr_conv);
9916 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9917 LDKNodeAnnouncement orig_conv;
9918 orig_conv.inner = (void*)(orig & (~1));
9919 orig_conv.is_owned = false;
9920 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
9921 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9922 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9923 long ret_ref = (long)ret_var.inner;
9924 if (ret_var.is_owned) {
9930 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9931 LDKNodeAnnouncement this_ptr_conv;
9932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9933 this_ptr_conv.is_owned = false;
9934 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9935 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
9939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9940 LDKNodeAnnouncement this_ptr_conv;
9941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9942 this_ptr_conv.is_owned = false;
9943 LDKSignature val_ref;
9944 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9945 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9946 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
9949 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9950 LDKNodeAnnouncement this_ptr_conv;
9951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9952 this_ptr_conv.is_owned = false;
9953 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
9954 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9955 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9956 long ret_ref = (long)ret_var.inner;
9957 if (ret_var.is_owned) {
9963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9964 LDKNodeAnnouncement this_ptr_conv;
9965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9966 this_ptr_conv.is_owned = false;
9967 LDKUnsignedNodeAnnouncement val_conv;
9968 val_conv.inner = (void*)(val & (~1));
9969 val_conv.is_owned = (val & 1) || (val == 0);
9970 if (val_conv.inner != NULL)
9971 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
9972 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
9975 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9976 LDKSignature signature_arg_ref;
9977 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9978 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9979 LDKUnsignedNodeAnnouncement contents_arg_conv;
9980 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9981 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9982 if (contents_arg_conv.inner != NULL)
9983 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
9984 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
9985 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9986 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9987 long ret_ref = (long)ret_var.inner;
9988 if (ret_var.is_owned) {
9994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9995 LDKUnsignedChannelAnnouncement this_ptr_conv;
9996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9997 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9998 UnsignedChannelAnnouncement_free(this_ptr_conv);
10001 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10002 LDKUnsignedChannelAnnouncement orig_conv;
10003 orig_conv.inner = (void*)(orig & (~1));
10004 orig_conv.is_owned = false;
10005 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
10006 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10007 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10008 long ret_ref = (long)ret_var.inner;
10009 if (ret_var.is_owned) {
10015 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10016 LDKUnsignedChannelAnnouncement this_ptr_conv;
10017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10018 this_ptr_conv.is_owned = false;
10019 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
10020 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10021 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10022 long ret_ref = (long)ret_var.inner;
10023 if (ret_var.is_owned) {
10029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10030 LDKUnsignedChannelAnnouncement this_ptr_conv;
10031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10032 this_ptr_conv.is_owned = false;
10033 LDKChannelFeatures val_conv;
10034 val_conv.inner = (void*)(val & (~1));
10035 val_conv.is_owned = (val & 1) || (val == 0);
10036 // Warning: we may need a move here but can't clone!
10037 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
10040 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10041 LDKUnsignedChannelAnnouncement this_ptr_conv;
10042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10043 this_ptr_conv.is_owned = false;
10044 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10045 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
10049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10050 LDKUnsignedChannelAnnouncement this_ptr_conv;
10051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10052 this_ptr_conv.is_owned = false;
10053 LDKThirtyTwoBytes val_ref;
10054 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10055 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10056 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
10059 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10060 LDKUnsignedChannelAnnouncement this_ptr_conv;
10061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10062 this_ptr_conv.is_owned = false;
10063 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
10067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10068 LDKUnsignedChannelAnnouncement this_ptr_conv;
10069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10070 this_ptr_conv.is_owned = false;
10071 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
10074 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10075 LDKUnsignedChannelAnnouncement this_ptr_conv;
10076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10077 this_ptr_conv.is_owned = false;
10078 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10079 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
10083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10084 LDKUnsignedChannelAnnouncement this_ptr_conv;
10085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10086 this_ptr_conv.is_owned = false;
10087 LDKPublicKey val_ref;
10088 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10089 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10090 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
10093 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10094 LDKUnsignedChannelAnnouncement this_ptr_conv;
10095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10096 this_ptr_conv.is_owned = false;
10097 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10098 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
10102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10103 LDKUnsignedChannelAnnouncement this_ptr_conv;
10104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10105 this_ptr_conv.is_owned = false;
10106 LDKPublicKey val_ref;
10107 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10108 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10109 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
10112 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10113 LDKUnsignedChannelAnnouncement this_ptr_conv;
10114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10115 this_ptr_conv.is_owned = false;
10116 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10117 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
10121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10122 LDKUnsignedChannelAnnouncement this_ptr_conv;
10123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10124 this_ptr_conv.is_owned = false;
10125 LDKPublicKey val_ref;
10126 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10127 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10128 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
10131 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10132 LDKUnsignedChannelAnnouncement this_ptr_conv;
10133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10134 this_ptr_conv.is_owned = false;
10135 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10136 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
10140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10141 LDKUnsignedChannelAnnouncement this_ptr_conv;
10142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10143 this_ptr_conv.is_owned = false;
10144 LDKPublicKey val_ref;
10145 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10146 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10147 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
10150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10151 LDKChannelAnnouncement this_ptr_conv;
10152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10153 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10154 ChannelAnnouncement_free(this_ptr_conv);
10157 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10158 LDKChannelAnnouncement orig_conv;
10159 orig_conv.inner = (void*)(orig & (~1));
10160 orig_conv.is_owned = false;
10161 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
10162 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10163 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10164 long ret_ref = (long)ret_var.inner;
10165 if (ret_var.is_owned) {
10171 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10172 LDKChannelAnnouncement this_ptr_conv;
10173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10174 this_ptr_conv.is_owned = false;
10175 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10176 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
10180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10181 LDKChannelAnnouncement this_ptr_conv;
10182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10183 this_ptr_conv.is_owned = false;
10184 LDKSignature val_ref;
10185 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10186 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10187 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
10190 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10191 LDKChannelAnnouncement this_ptr_conv;
10192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10193 this_ptr_conv.is_owned = false;
10194 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10195 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
10199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10200 LDKChannelAnnouncement this_ptr_conv;
10201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10202 this_ptr_conv.is_owned = false;
10203 LDKSignature val_ref;
10204 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10205 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10206 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
10209 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10210 LDKChannelAnnouncement this_ptr_conv;
10211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10212 this_ptr_conv.is_owned = false;
10213 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10214 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
10218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10219 LDKChannelAnnouncement this_ptr_conv;
10220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10221 this_ptr_conv.is_owned = false;
10222 LDKSignature val_ref;
10223 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10224 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10225 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
10228 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10229 LDKChannelAnnouncement this_ptr_conv;
10230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10231 this_ptr_conv.is_owned = false;
10232 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10233 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
10237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10238 LDKChannelAnnouncement this_ptr_conv;
10239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10240 this_ptr_conv.is_owned = false;
10241 LDKSignature val_ref;
10242 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10243 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10244 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
10247 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10248 LDKChannelAnnouncement this_ptr_conv;
10249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10250 this_ptr_conv.is_owned = false;
10251 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
10252 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10253 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10254 long ret_ref = (long)ret_var.inner;
10255 if (ret_var.is_owned) {
10261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10262 LDKChannelAnnouncement this_ptr_conv;
10263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10264 this_ptr_conv.is_owned = false;
10265 LDKUnsignedChannelAnnouncement val_conv;
10266 val_conv.inner = (void*)(val & (~1));
10267 val_conv.is_owned = (val & 1) || (val == 0);
10268 if (val_conv.inner != NULL)
10269 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
10270 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
10273 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) {
10274 LDKSignature node_signature_1_arg_ref;
10275 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
10276 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
10277 LDKSignature node_signature_2_arg_ref;
10278 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
10279 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
10280 LDKSignature bitcoin_signature_1_arg_ref;
10281 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
10282 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
10283 LDKSignature bitcoin_signature_2_arg_ref;
10284 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
10285 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
10286 LDKUnsignedChannelAnnouncement contents_arg_conv;
10287 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10288 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10289 if (contents_arg_conv.inner != NULL)
10290 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
10291 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);
10292 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10293 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10294 long ret_ref = (long)ret_var.inner;
10295 if (ret_var.is_owned) {
10301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10302 LDKUnsignedChannelUpdate this_ptr_conv;
10303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10304 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10305 UnsignedChannelUpdate_free(this_ptr_conv);
10308 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10309 LDKUnsignedChannelUpdate orig_conv;
10310 orig_conv.inner = (void*)(orig & (~1));
10311 orig_conv.is_owned = false;
10312 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
10313 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10314 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10315 long ret_ref = (long)ret_var.inner;
10316 if (ret_var.is_owned) {
10322 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10323 LDKUnsignedChannelUpdate this_ptr_conv;
10324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10325 this_ptr_conv.is_owned = false;
10326 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10327 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
10331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10332 LDKUnsignedChannelUpdate this_ptr_conv;
10333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10334 this_ptr_conv.is_owned = false;
10335 LDKThirtyTwoBytes val_ref;
10336 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10337 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10338 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
10341 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10342 LDKUnsignedChannelUpdate this_ptr_conv;
10343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10344 this_ptr_conv.is_owned = false;
10345 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
10349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10350 LDKUnsignedChannelUpdate this_ptr_conv;
10351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10352 this_ptr_conv.is_owned = false;
10353 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
10356 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10357 LDKUnsignedChannelUpdate this_ptr_conv;
10358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10359 this_ptr_conv.is_owned = false;
10360 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
10364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10365 LDKUnsignedChannelUpdate this_ptr_conv;
10366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10367 this_ptr_conv.is_owned = false;
10368 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
10371 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
10372 LDKUnsignedChannelUpdate this_ptr_conv;
10373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10374 this_ptr_conv.is_owned = false;
10375 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
10379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
10380 LDKUnsignedChannelUpdate this_ptr_conv;
10381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10382 this_ptr_conv.is_owned = false;
10383 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
10386 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10387 LDKUnsignedChannelUpdate this_ptr_conv;
10388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10389 this_ptr_conv.is_owned = false;
10390 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
10394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10395 LDKUnsignedChannelUpdate this_ptr_conv;
10396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10397 this_ptr_conv.is_owned = false;
10398 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
10401 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10402 LDKUnsignedChannelUpdate this_ptr_conv;
10403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10404 this_ptr_conv.is_owned = false;
10405 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
10409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10410 LDKUnsignedChannelUpdate this_ptr_conv;
10411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10412 this_ptr_conv.is_owned = false;
10413 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
10416 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10417 LDKUnsignedChannelUpdate this_ptr_conv;
10418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10419 this_ptr_conv.is_owned = false;
10420 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
10424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10425 LDKUnsignedChannelUpdate this_ptr_conv;
10426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10427 this_ptr_conv.is_owned = false;
10428 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
10431 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
10432 LDKUnsignedChannelUpdate this_ptr_conv;
10433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10434 this_ptr_conv.is_owned = false;
10435 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
10439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10440 LDKUnsignedChannelUpdate this_ptr_conv;
10441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10442 this_ptr_conv.is_owned = false;
10443 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
10446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10447 LDKChannelUpdate this_ptr_conv;
10448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10449 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10450 ChannelUpdate_free(this_ptr_conv);
10453 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10454 LDKChannelUpdate orig_conv;
10455 orig_conv.inner = (void*)(orig & (~1));
10456 orig_conv.is_owned = false;
10457 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
10458 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10459 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10460 long ret_ref = (long)ret_var.inner;
10461 if (ret_var.is_owned) {
10467 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10468 LDKChannelUpdate this_ptr_conv;
10469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10470 this_ptr_conv.is_owned = false;
10471 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10472 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
10476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10477 LDKChannelUpdate this_ptr_conv;
10478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10479 this_ptr_conv.is_owned = false;
10480 LDKSignature val_ref;
10481 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10482 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10483 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
10486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10487 LDKChannelUpdate this_ptr_conv;
10488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10489 this_ptr_conv.is_owned = false;
10490 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
10491 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10492 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10493 long ret_ref = (long)ret_var.inner;
10494 if (ret_var.is_owned) {
10500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10501 LDKChannelUpdate this_ptr_conv;
10502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10503 this_ptr_conv.is_owned = false;
10504 LDKUnsignedChannelUpdate val_conv;
10505 val_conv.inner = (void*)(val & (~1));
10506 val_conv.is_owned = (val & 1) || (val == 0);
10507 if (val_conv.inner != NULL)
10508 val_conv = UnsignedChannelUpdate_clone(&val_conv);
10509 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
10512 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
10513 LDKSignature signature_arg_ref;
10514 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10515 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10516 LDKUnsignedChannelUpdate contents_arg_conv;
10517 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10518 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10519 if (contents_arg_conv.inner != NULL)
10520 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
10521 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
10522 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10523 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10524 long ret_ref = (long)ret_var.inner;
10525 if (ret_var.is_owned) {
10531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10532 LDKQueryChannelRange this_ptr_conv;
10533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10534 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10535 QueryChannelRange_free(this_ptr_conv);
10538 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10539 LDKQueryChannelRange orig_conv;
10540 orig_conv.inner = (void*)(orig & (~1));
10541 orig_conv.is_owned = false;
10542 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
10543 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10544 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10545 long ret_ref = (long)ret_var.inner;
10546 if (ret_var.is_owned) {
10552 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10553 LDKQueryChannelRange this_ptr_conv;
10554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10555 this_ptr_conv.is_owned = false;
10556 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10557 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
10561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10562 LDKQueryChannelRange this_ptr_conv;
10563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10564 this_ptr_conv.is_owned = false;
10565 LDKThirtyTwoBytes val_ref;
10566 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10567 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10568 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10571 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10572 LDKQueryChannelRange this_ptr_conv;
10573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10574 this_ptr_conv.is_owned = false;
10575 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
10579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10580 LDKQueryChannelRange this_ptr_conv;
10581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10582 this_ptr_conv.is_owned = false;
10583 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
10586 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10587 LDKQueryChannelRange this_ptr_conv;
10588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10589 this_ptr_conv.is_owned = false;
10590 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
10594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10595 LDKQueryChannelRange this_ptr_conv;
10596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10597 this_ptr_conv.is_owned = false;
10598 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10601 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) {
10602 LDKThirtyTwoBytes chain_hash_arg_ref;
10603 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10604 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10605 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
10606 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10607 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10608 long ret_ref = (long)ret_var.inner;
10609 if (ret_var.is_owned) {
10615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10616 LDKReplyChannelRange this_ptr_conv;
10617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10618 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10619 ReplyChannelRange_free(this_ptr_conv);
10622 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10623 LDKReplyChannelRange orig_conv;
10624 orig_conv.inner = (void*)(orig & (~1));
10625 orig_conv.is_owned = false;
10626 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
10627 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10628 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10629 long ret_ref = (long)ret_var.inner;
10630 if (ret_var.is_owned) {
10636 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10637 LDKReplyChannelRange this_ptr_conv;
10638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10639 this_ptr_conv.is_owned = false;
10640 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10641 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
10645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10646 LDKReplyChannelRange this_ptr_conv;
10647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10648 this_ptr_conv.is_owned = false;
10649 LDKThirtyTwoBytes val_ref;
10650 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10651 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10652 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10655 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10656 LDKReplyChannelRange this_ptr_conv;
10657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10658 this_ptr_conv.is_owned = false;
10659 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
10663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10664 LDKReplyChannelRange this_ptr_conv;
10665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10666 this_ptr_conv.is_owned = false;
10667 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
10670 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10671 LDKReplyChannelRange this_ptr_conv;
10672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10673 this_ptr_conv.is_owned = false;
10674 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
10678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10679 LDKReplyChannelRange this_ptr_conv;
10680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10681 this_ptr_conv.is_owned = false;
10682 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10686 LDKReplyChannelRange this_ptr_conv;
10687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10688 this_ptr_conv.is_owned = false;
10689 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
10693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10694 LDKReplyChannelRange this_ptr_conv;
10695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10696 this_ptr_conv.is_owned = false;
10697 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
10700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10701 LDKReplyChannelRange this_ptr_conv;
10702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10703 this_ptr_conv.is_owned = false;
10704 LDKCVec_u64Z val_constr;
10705 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10706 if (val_constr.datalen > 0)
10707 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10709 val_constr.data = NULL;
10710 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10711 for (size_t g = 0; g < val_constr.datalen; g++) {
10712 long arr_conv_6 = val_vals[g];
10713 val_constr.data[g] = arr_conv_6;
10715 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10716 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
10719 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) {
10720 LDKThirtyTwoBytes chain_hash_arg_ref;
10721 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10722 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10723 LDKCVec_u64Z short_channel_ids_arg_constr;
10724 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10725 if (short_channel_ids_arg_constr.datalen > 0)
10726 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10728 short_channel_ids_arg_constr.data = NULL;
10729 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10730 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10731 long arr_conv_6 = short_channel_ids_arg_vals[g];
10732 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10734 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10735 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
10736 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10737 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10738 long ret_ref = (long)ret_var.inner;
10739 if (ret_var.is_owned) {
10745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10746 LDKQueryShortChannelIds this_ptr_conv;
10747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10748 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10749 QueryShortChannelIds_free(this_ptr_conv);
10752 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10753 LDKQueryShortChannelIds orig_conv;
10754 orig_conv.inner = (void*)(orig & (~1));
10755 orig_conv.is_owned = false;
10756 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
10757 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10758 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10759 long ret_ref = (long)ret_var.inner;
10760 if (ret_var.is_owned) {
10766 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10767 LDKQueryShortChannelIds this_ptr_conv;
10768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10769 this_ptr_conv.is_owned = false;
10770 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10771 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
10775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10776 LDKQueryShortChannelIds this_ptr_conv;
10777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10778 this_ptr_conv.is_owned = false;
10779 LDKThirtyTwoBytes val_ref;
10780 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10781 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10782 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
10785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10786 LDKQueryShortChannelIds this_ptr_conv;
10787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10788 this_ptr_conv.is_owned = false;
10789 LDKCVec_u64Z val_constr;
10790 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10791 if (val_constr.datalen > 0)
10792 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10794 val_constr.data = NULL;
10795 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10796 for (size_t g = 0; g < val_constr.datalen; g++) {
10797 long arr_conv_6 = val_vals[g];
10798 val_constr.data[g] = arr_conv_6;
10800 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10801 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
10804 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
10805 LDKThirtyTwoBytes chain_hash_arg_ref;
10806 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10807 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10808 LDKCVec_u64Z short_channel_ids_arg_constr;
10809 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10810 if (short_channel_ids_arg_constr.datalen > 0)
10811 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10813 short_channel_ids_arg_constr.data = NULL;
10814 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10815 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10816 long arr_conv_6 = short_channel_ids_arg_vals[g];
10817 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10819 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10820 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
10821 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10822 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10823 long ret_ref = (long)ret_var.inner;
10824 if (ret_var.is_owned) {
10830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10831 LDKReplyShortChannelIdsEnd this_ptr_conv;
10832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10834 ReplyShortChannelIdsEnd_free(this_ptr_conv);
10837 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10838 LDKReplyShortChannelIdsEnd orig_conv;
10839 orig_conv.inner = (void*)(orig & (~1));
10840 orig_conv.is_owned = false;
10841 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
10842 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10843 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10844 long ret_ref = (long)ret_var.inner;
10845 if (ret_var.is_owned) {
10851 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10852 LDKReplyShortChannelIdsEnd this_ptr_conv;
10853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10854 this_ptr_conv.is_owned = false;
10855 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10856 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
10860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10861 LDKReplyShortChannelIdsEnd this_ptr_conv;
10862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10863 this_ptr_conv.is_owned = false;
10864 LDKThirtyTwoBytes val_ref;
10865 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10866 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10867 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
10870 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10871 LDKReplyShortChannelIdsEnd this_ptr_conv;
10872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10873 this_ptr_conv.is_owned = false;
10874 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
10878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10879 LDKReplyShortChannelIdsEnd this_ptr_conv;
10880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10881 this_ptr_conv.is_owned = false;
10882 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
10885 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
10886 LDKThirtyTwoBytes chain_hash_arg_ref;
10887 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10888 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10889 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
10890 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10891 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10892 long ret_ref = (long)ret_var.inner;
10893 if (ret_var.is_owned) {
10899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10900 LDKGossipTimestampFilter this_ptr_conv;
10901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10902 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10903 GossipTimestampFilter_free(this_ptr_conv);
10906 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10907 LDKGossipTimestampFilter orig_conv;
10908 orig_conv.inner = (void*)(orig & (~1));
10909 orig_conv.is_owned = false;
10910 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
10911 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10912 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10913 long ret_ref = (long)ret_var.inner;
10914 if (ret_var.is_owned) {
10920 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10921 LDKGossipTimestampFilter this_ptr_conv;
10922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10923 this_ptr_conv.is_owned = false;
10924 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10925 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
10929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10930 LDKGossipTimestampFilter this_ptr_conv;
10931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10932 this_ptr_conv.is_owned = false;
10933 LDKThirtyTwoBytes val_ref;
10934 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10935 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10936 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
10939 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10940 LDKGossipTimestampFilter this_ptr_conv;
10941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10942 this_ptr_conv.is_owned = false;
10943 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
10947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10948 LDKGossipTimestampFilter this_ptr_conv;
10949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10950 this_ptr_conv.is_owned = false;
10951 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
10954 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
10955 LDKGossipTimestampFilter this_ptr_conv;
10956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10957 this_ptr_conv.is_owned = false;
10958 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
10962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10963 LDKGossipTimestampFilter this_ptr_conv;
10964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10965 this_ptr_conv.is_owned = false;
10966 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
10969 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) {
10970 LDKThirtyTwoBytes chain_hash_arg_ref;
10971 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10972 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10973 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
10974 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10975 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10976 long ret_ref = (long)ret_var.inner;
10977 if (ret_var.is_owned) {
10983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10984 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
10985 FREE((void*)this_ptr);
10986 ErrorAction_free(this_ptr_conv);
10989 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10990 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
10991 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10992 *ret_copy = ErrorAction_clone(orig_conv);
10993 long ret_ref = (long)ret_copy;
10997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10998 LDKLightningError this_ptr_conv;
10999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11000 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11001 LightningError_free(this_ptr_conv);
11004 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
11005 LDKLightningError this_ptr_conv;
11006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11007 this_ptr_conv.is_owned = false;
11008 LDKStr _str = LightningError_get_err(&this_ptr_conv);
11009 char* _buf = MALLOC(_str.len + 1, "str conv buf");
11010 memcpy(_buf, _str.chars, _str.len);
11011 _buf[_str.len] = 0;
11012 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
11017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11018 LDKLightningError this_ptr_conv;
11019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11020 this_ptr_conv.is_owned = false;
11021 LDKCVec_u8Z val_ref;
11022 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
11023 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
11024 LightningError_set_err(&this_ptr_conv, val_ref);
11025 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
11028 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
11029 LDKLightningError this_ptr_conv;
11030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11031 this_ptr_conv.is_owned = false;
11032 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
11033 *ret_copy = LightningError_get_action(&this_ptr_conv);
11034 long ret_ref = (long)ret_copy;
11038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11039 LDKLightningError this_ptr_conv;
11040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11041 this_ptr_conv.is_owned = false;
11042 LDKErrorAction val_conv = *(LDKErrorAction*)val;
11044 LightningError_set_action(&this_ptr_conv, val_conv);
11047 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
11048 LDKCVec_u8Z err_arg_ref;
11049 err_arg_ref.data = (*_env)->GetByteArrayElements (_env, err_arg, NULL);
11050 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
11051 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
11052 FREE((void*)action_arg);
11053 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
11054 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11055 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11056 long ret_ref = (long)ret_var.inner;
11057 if (ret_var.is_owned) {
11060 (*_env)->ReleaseByteArrayElements(_env, err_arg, (int8_t*)err_arg_ref.data, 0);
11064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11065 LDKCommitmentUpdate this_ptr_conv;
11066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11067 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11068 CommitmentUpdate_free(this_ptr_conv);
11071 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11072 LDKCommitmentUpdate orig_conv;
11073 orig_conv.inner = (void*)(orig & (~1));
11074 orig_conv.is_owned = false;
11075 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
11076 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11077 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11078 long ret_ref = (long)ret_var.inner;
11079 if (ret_var.is_owned) {
11085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11086 LDKCommitmentUpdate this_ptr_conv;
11087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11088 this_ptr_conv.is_owned = false;
11089 LDKCVec_UpdateAddHTLCZ val_constr;
11090 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11091 if (val_constr.datalen > 0)
11092 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11094 val_constr.data = NULL;
11095 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11096 for (size_t p = 0; p < val_constr.datalen; p++) {
11097 long arr_conv_15 = val_vals[p];
11098 LDKUpdateAddHTLC arr_conv_15_conv;
11099 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11100 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11101 if (arr_conv_15_conv.inner != NULL)
11102 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11103 val_constr.data[p] = arr_conv_15_conv;
11105 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11106 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
11109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11110 LDKCommitmentUpdate this_ptr_conv;
11111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11112 this_ptr_conv.is_owned = false;
11113 LDKCVec_UpdateFulfillHTLCZ val_constr;
11114 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11115 if (val_constr.datalen > 0)
11116 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11118 val_constr.data = NULL;
11119 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11120 for (size_t t = 0; t < val_constr.datalen; t++) {
11121 long arr_conv_19 = val_vals[t];
11122 LDKUpdateFulfillHTLC arr_conv_19_conv;
11123 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11124 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11125 if (arr_conv_19_conv.inner != NULL)
11126 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11127 val_constr.data[t] = arr_conv_19_conv;
11129 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11130 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
11133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11134 LDKCommitmentUpdate this_ptr_conv;
11135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11136 this_ptr_conv.is_owned = false;
11137 LDKCVec_UpdateFailHTLCZ val_constr;
11138 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11139 if (val_constr.datalen > 0)
11140 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11142 val_constr.data = NULL;
11143 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11144 for (size_t q = 0; q < val_constr.datalen; q++) {
11145 long arr_conv_16 = val_vals[q];
11146 LDKUpdateFailHTLC arr_conv_16_conv;
11147 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11148 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11149 if (arr_conv_16_conv.inner != NULL)
11150 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11151 val_constr.data[q] = arr_conv_16_conv;
11153 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11154 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
11157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11158 LDKCommitmentUpdate this_ptr_conv;
11159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11160 this_ptr_conv.is_owned = false;
11161 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
11162 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11163 if (val_constr.datalen > 0)
11164 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11166 val_constr.data = NULL;
11167 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11168 for (size_t z = 0; z < val_constr.datalen; z++) {
11169 long arr_conv_25 = val_vals[z];
11170 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11171 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11172 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11173 if (arr_conv_25_conv.inner != NULL)
11174 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11175 val_constr.data[z] = arr_conv_25_conv;
11177 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11178 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
11181 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
11182 LDKCommitmentUpdate this_ptr_conv;
11183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11184 this_ptr_conv.is_owned = false;
11185 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
11186 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11187 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11188 long ret_ref = (long)ret_var.inner;
11189 if (ret_var.is_owned) {
11195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11196 LDKCommitmentUpdate this_ptr_conv;
11197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11198 this_ptr_conv.is_owned = false;
11199 LDKUpdateFee val_conv;
11200 val_conv.inner = (void*)(val & (~1));
11201 val_conv.is_owned = (val & 1) || (val == 0);
11202 if (val_conv.inner != NULL)
11203 val_conv = UpdateFee_clone(&val_conv);
11204 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
11207 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
11208 LDKCommitmentUpdate this_ptr_conv;
11209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11210 this_ptr_conv.is_owned = false;
11211 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
11212 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11213 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11214 long ret_ref = (long)ret_var.inner;
11215 if (ret_var.is_owned) {
11221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11222 LDKCommitmentUpdate this_ptr_conv;
11223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11224 this_ptr_conv.is_owned = false;
11225 LDKCommitmentSigned val_conv;
11226 val_conv.inner = (void*)(val & (~1));
11227 val_conv.is_owned = (val & 1) || (val == 0);
11228 if (val_conv.inner != NULL)
11229 val_conv = CommitmentSigned_clone(&val_conv);
11230 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
11233 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) {
11234 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
11235 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
11236 if (update_add_htlcs_arg_constr.datalen > 0)
11237 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11239 update_add_htlcs_arg_constr.data = NULL;
11240 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
11241 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
11242 long arr_conv_15 = update_add_htlcs_arg_vals[p];
11243 LDKUpdateAddHTLC arr_conv_15_conv;
11244 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11245 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11246 if (arr_conv_15_conv.inner != NULL)
11247 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11248 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
11250 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
11251 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
11252 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
11253 if (update_fulfill_htlcs_arg_constr.datalen > 0)
11254 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11256 update_fulfill_htlcs_arg_constr.data = NULL;
11257 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
11258 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
11259 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
11260 LDKUpdateFulfillHTLC arr_conv_19_conv;
11261 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11262 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11263 if (arr_conv_19_conv.inner != NULL)
11264 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11265 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
11267 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
11268 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
11269 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
11270 if (update_fail_htlcs_arg_constr.datalen > 0)
11271 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11273 update_fail_htlcs_arg_constr.data = NULL;
11274 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
11275 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
11276 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
11277 LDKUpdateFailHTLC arr_conv_16_conv;
11278 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11279 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11280 if (arr_conv_16_conv.inner != NULL)
11281 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11282 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
11284 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
11285 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
11286 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
11287 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
11288 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11290 update_fail_malformed_htlcs_arg_constr.data = NULL;
11291 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
11292 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
11293 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
11294 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11295 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11296 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11297 if (arr_conv_25_conv.inner != NULL)
11298 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11299 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
11301 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
11302 LDKUpdateFee update_fee_arg_conv;
11303 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
11304 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
11305 if (update_fee_arg_conv.inner != NULL)
11306 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
11307 LDKCommitmentSigned commitment_signed_arg_conv;
11308 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
11309 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
11310 if (commitment_signed_arg_conv.inner != NULL)
11311 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
11312 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);
11313 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11314 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11315 long ret_ref = (long)ret_var.inner;
11316 if (ret_var.is_owned) {
11322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11323 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
11324 FREE((void*)this_ptr);
11325 HTLCFailChannelUpdate_free(this_ptr_conv);
11328 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11329 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
11330 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
11331 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
11332 long ret_ref = (long)ret_copy;
11336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11337 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
11338 FREE((void*)this_ptr);
11339 ChannelMessageHandler_free(this_ptr_conv);
11342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11343 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
11344 FREE((void*)this_ptr);
11345 RoutingMessageHandler_free(this_ptr_conv);
11348 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11349 LDKAcceptChannel obj_conv;
11350 obj_conv.inner = (void*)(obj & (~1));
11351 obj_conv.is_owned = false;
11352 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
11353 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11354 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11355 CVec_u8Z_free(arg_var);
11359 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11360 LDKu8slice ser_ref;
11361 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11362 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11363 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
11364 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11365 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11366 long ret_ref = (long)ret_var.inner;
11367 if (ret_var.is_owned) {
11370 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11374 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
11375 LDKAnnouncementSignatures obj_conv;
11376 obj_conv.inner = (void*)(obj & (~1));
11377 obj_conv.is_owned = false;
11378 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
11379 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11380 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11381 CVec_u8Z_free(arg_var);
11385 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11386 LDKu8slice ser_ref;
11387 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11388 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11389 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
11390 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11391 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11392 long ret_ref = (long)ret_var.inner;
11393 if (ret_var.is_owned) {
11396 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11400 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
11401 LDKChannelReestablish obj_conv;
11402 obj_conv.inner = (void*)(obj & (~1));
11403 obj_conv.is_owned = false;
11404 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
11405 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11406 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11407 CVec_u8Z_free(arg_var);
11411 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11412 LDKu8slice ser_ref;
11413 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11414 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11415 LDKChannelReestablish ret_var = ChannelReestablish_read(ser_ref);
11416 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11417 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11418 long ret_ref = (long)ret_var.inner;
11419 if (ret_var.is_owned) {
11422 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11426 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11427 LDKClosingSigned obj_conv;
11428 obj_conv.inner = (void*)(obj & (~1));
11429 obj_conv.is_owned = false;
11430 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
11431 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11432 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11433 CVec_u8Z_free(arg_var);
11437 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11438 LDKu8slice ser_ref;
11439 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11440 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11441 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
11442 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11443 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11444 long ret_ref = (long)ret_var.inner;
11445 if (ret_var.is_owned) {
11448 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11452 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11453 LDKCommitmentSigned obj_conv;
11454 obj_conv.inner = (void*)(obj & (~1));
11455 obj_conv.is_owned = false;
11456 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
11457 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11458 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11459 CVec_u8Z_free(arg_var);
11463 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11464 LDKu8slice ser_ref;
11465 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11466 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11467 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
11468 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11469 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11470 long ret_ref = (long)ret_var.inner;
11471 if (ret_var.is_owned) {
11474 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11478 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
11479 LDKFundingCreated obj_conv;
11480 obj_conv.inner = (void*)(obj & (~1));
11481 obj_conv.is_owned = false;
11482 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
11483 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11484 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11485 CVec_u8Z_free(arg_var);
11489 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11490 LDKu8slice ser_ref;
11491 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11492 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11493 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
11494 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11495 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11496 long ret_ref = (long)ret_var.inner;
11497 if (ret_var.is_owned) {
11500 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11504 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11505 LDKFundingSigned obj_conv;
11506 obj_conv.inner = (void*)(obj & (~1));
11507 obj_conv.is_owned = false;
11508 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
11509 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11510 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11511 CVec_u8Z_free(arg_var);
11515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11516 LDKu8slice ser_ref;
11517 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11518 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11519 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
11520 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11521 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11522 long ret_ref = (long)ret_var.inner;
11523 if (ret_var.is_owned) {
11526 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11530 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
11531 LDKFundingLocked obj_conv;
11532 obj_conv.inner = (void*)(obj & (~1));
11533 obj_conv.is_owned = false;
11534 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
11535 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11536 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11537 CVec_u8Z_free(arg_var);
11541 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11542 LDKu8slice ser_ref;
11543 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11544 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11545 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
11546 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11547 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11548 long ret_ref = (long)ret_var.inner;
11549 if (ret_var.is_owned) {
11552 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11556 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
11558 obj_conv.inner = (void*)(obj & (~1));
11559 obj_conv.is_owned = false;
11560 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
11561 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11562 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11563 CVec_u8Z_free(arg_var);
11567 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11568 LDKu8slice ser_ref;
11569 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11570 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11571 LDKInit ret_var = Init_read(ser_ref);
11572 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11573 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11574 long ret_ref = (long)ret_var.inner;
11575 if (ret_var.is_owned) {
11578 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11582 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11583 LDKOpenChannel obj_conv;
11584 obj_conv.inner = (void*)(obj & (~1));
11585 obj_conv.is_owned = false;
11586 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
11587 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11588 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11589 CVec_u8Z_free(arg_var);
11593 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11594 LDKu8slice ser_ref;
11595 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11596 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11597 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
11598 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11599 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11600 long ret_ref = (long)ret_var.inner;
11601 if (ret_var.is_owned) {
11604 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11608 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
11609 LDKRevokeAndACK obj_conv;
11610 obj_conv.inner = (void*)(obj & (~1));
11611 obj_conv.is_owned = false;
11612 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
11613 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11614 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11615 CVec_u8Z_free(arg_var);
11619 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11620 LDKu8slice ser_ref;
11621 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11622 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11623 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
11624 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11625 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11626 long ret_ref = (long)ret_var.inner;
11627 if (ret_var.is_owned) {
11630 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11634 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
11635 LDKShutdown obj_conv;
11636 obj_conv.inner = (void*)(obj & (~1));
11637 obj_conv.is_owned = false;
11638 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
11639 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11640 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11641 CVec_u8Z_free(arg_var);
11645 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11646 LDKu8slice ser_ref;
11647 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11648 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11649 LDKShutdown ret_var = Shutdown_read(ser_ref);
11650 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11651 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11652 long ret_ref = (long)ret_var.inner;
11653 if (ret_var.is_owned) {
11656 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11660 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11661 LDKUpdateFailHTLC obj_conv;
11662 obj_conv.inner = (void*)(obj & (~1));
11663 obj_conv.is_owned = false;
11664 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
11665 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11666 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11667 CVec_u8Z_free(arg_var);
11671 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11672 LDKu8slice ser_ref;
11673 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11674 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11675 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
11676 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11677 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11678 long ret_ref = (long)ret_var.inner;
11679 if (ret_var.is_owned) {
11682 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11686 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11687 LDKUpdateFailMalformedHTLC obj_conv;
11688 obj_conv.inner = (void*)(obj & (~1));
11689 obj_conv.is_owned = false;
11690 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
11691 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11692 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11693 CVec_u8Z_free(arg_var);
11697 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11698 LDKu8slice ser_ref;
11699 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11700 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11701 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
11702 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11703 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11704 long ret_ref = (long)ret_var.inner;
11705 if (ret_var.is_owned) {
11708 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11712 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
11713 LDKUpdateFee obj_conv;
11714 obj_conv.inner = (void*)(obj & (~1));
11715 obj_conv.is_owned = false;
11716 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
11717 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11718 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11719 CVec_u8Z_free(arg_var);
11723 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11724 LDKu8slice ser_ref;
11725 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11726 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11727 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
11728 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11729 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11730 long ret_ref = (long)ret_var.inner;
11731 if (ret_var.is_owned) {
11734 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11738 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11739 LDKUpdateFulfillHTLC obj_conv;
11740 obj_conv.inner = (void*)(obj & (~1));
11741 obj_conv.is_owned = false;
11742 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
11743 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11744 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11745 CVec_u8Z_free(arg_var);
11749 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11750 LDKu8slice ser_ref;
11751 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11752 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11753 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
11754 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11755 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11756 long ret_ref = (long)ret_var.inner;
11757 if (ret_var.is_owned) {
11760 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11764 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11765 LDKUpdateAddHTLC obj_conv;
11766 obj_conv.inner = (void*)(obj & (~1));
11767 obj_conv.is_owned = false;
11768 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
11769 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11770 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11771 CVec_u8Z_free(arg_var);
11775 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11776 LDKu8slice ser_ref;
11777 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11778 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11779 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
11780 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11781 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11782 long ret_ref = (long)ret_var.inner;
11783 if (ret_var.is_owned) {
11786 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11790 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
11792 obj_conv.inner = (void*)(obj & (~1));
11793 obj_conv.is_owned = false;
11794 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
11795 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11796 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11797 CVec_u8Z_free(arg_var);
11801 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11802 LDKu8slice ser_ref;
11803 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11804 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11805 LDKPing ret_var = Ping_read(ser_ref);
11806 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11807 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11808 long ret_ref = (long)ret_var.inner;
11809 if (ret_var.is_owned) {
11812 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11816 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
11818 obj_conv.inner = (void*)(obj & (~1));
11819 obj_conv.is_owned = false;
11820 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
11821 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11822 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11823 CVec_u8Z_free(arg_var);
11827 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11828 LDKu8slice ser_ref;
11829 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11830 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11831 LDKPong ret_var = Pong_read(ser_ref);
11832 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11833 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11834 long ret_ref = (long)ret_var.inner;
11835 if (ret_var.is_owned) {
11838 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11842 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11843 LDKUnsignedChannelAnnouncement obj_conv;
11844 obj_conv.inner = (void*)(obj & (~1));
11845 obj_conv.is_owned = false;
11846 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
11847 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11848 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11849 CVec_u8Z_free(arg_var);
11853 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11854 LDKu8slice ser_ref;
11855 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11856 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11857 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_read(ser_ref);
11858 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11859 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11860 long ret_ref = (long)ret_var.inner;
11861 if (ret_var.is_owned) {
11864 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11868 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11869 LDKChannelAnnouncement obj_conv;
11870 obj_conv.inner = (void*)(obj & (~1));
11871 obj_conv.is_owned = false;
11872 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
11873 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11874 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11875 CVec_u8Z_free(arg_var);
11879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11880 LDKu8slice ser_ref;
11881 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11882 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11883 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
11884 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11885 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11886 long ret_ref = (long)ret_var.inner;
11887 if (ret_var.is_owned) {
11890 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11894 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
11895 LDKUnsignedChannelUpdate obj_conv;
11896 obj_conv.inner = (void*)(obj & (~1));
11897 obj_conv.is_owned = false;
11898 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
11899 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11900 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11901 CVec_u8Z_free(arg_var);
11905 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11906 LDKu8slice ser_ref;
11907 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11908 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11909 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_read(ser_ref);
11910 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11911 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11912 long ret_ref = (long)ret_var.inner;
11913 if (ret_var.is_owned) {
11916 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11920 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
11921 LDKChannelUpdate obj_conv;
11922 obj_conv.inner = (void*)(obj & (~1));
11923 obj_conv.is_owned = false;
11924 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
11925 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11926 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11927 CVec_u8Z_free(arg_var);
11931 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11932 LDKu8slice ser_ref;
11933 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11934 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11935 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
11936 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11937 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11938 long ret_ref = (long)ret_var.inner;
11939 if (ret_var.is_owned) {
11942 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11946 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
11947 LDKErrorMessage obj_conv;
11948 obj_conv.inner = (void*)(obj & (~1));
11949 obj_conv.is_owned = false;
11950 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
11951 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11952 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11953 CVec_u8Z_free(arg_var);
11957 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11958 LDKu8slice ser_ref;
11959 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11960 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11961 LDKErrorMessage ret_var = ErrorMessage_read(ser_ref);
11962 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11963 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11964 long ret_ref = (long)ret_var.inner;
11965 if (ret_var.is_owned) {
11968 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11972 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11973 LDKUnsignedNodeAnnouncement obj_conv;
11974 obj_conv.inner = (void*)(obj & (~1));
11975 obj_conv.is_owned = false;
11976 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
11977 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11978 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11979 CVec_u8Z_free(arg_var);
11983 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11984 LDKu8slice ser_ref;
11985 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11986 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11987 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_read(ser_ref);
11988 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11989 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11990 long ret_ref = (long)ret_var.inner;
11991 if (ret_var.is_owned) {
11994 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11998 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11999 LDKNodeAnnouncement obj_conv;
12000 obj_conv.inner = (void*)(obj & (~1));
12001 obj_conv.is_owned = false;
12002 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
12003 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12004 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12005 CVec_u8Z_free(arg_var);
12009 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12010 LDKu8slice ser_ref;
12011 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12012 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12013 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
12014 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12015 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12016 long ret_ref = (long)ret_var.inner;
12017 if (ret_var.is_owned) {
12020 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12024 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12025 LDKu8slice ser_ref;
12026 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12027 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12028 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_read(ser_ref);
12029 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12030 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12031 long ret_ref = (long)ret_var.inner;
12032 if (ret_var.is_owned) {
12035 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12039 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
12040 LDKQueryShortChannelIds obj_conv;
12041 obj_conv.inner = (void*)(obj & (~1));
12042 obj_conv.is_owned = false;
12043 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
12044 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12045 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12046 CVec_u8Z_free(arg_var);
12050 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12051 LDKu8slice ser_ref;
12052 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12053 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12054 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_read(ser_ref);
12055 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12056 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12057 long ret_ref = (long)ret_var.inner;
12058 if (ret_var.is_owned) {
12061 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12065 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
12066 LDKReplyShortChannelIdsEnd obj_conv;
12067 obj_conv.inner = (void*)(obj & (~1));
12068 obj_conv.is_owned = false;
12069 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
12070 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12071 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12072 CVec_u8Z_free(arg_var);
12076 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12077 LDKu8slice ser_ref;
12078 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12079 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12080 LDKQueryChannelRange ret_var = QueryChannelRange_read(ser_ref);
12081 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12082 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12083 long ret_ref = (long)ret_var.inner;
12084 if (ret_var.is_owned) {
12087 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12091 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
12092 LDKQueryChannelRange obj_conv;
12093 obj_conv.inner = (void*)(obj & (~1));
12094 obj_conv.is_owned = false;
12095 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
12096 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12097 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12098 CVec_u8Z_free(arg_var);
12102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12103 LDKu8slice ser_ref;
12104 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12105 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12106 LDKReplyChannelRange ret_var = ReplyChannelRange_read(ser_ref);
12107 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12108 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12109 long ret_ref = (long)ret_var.inner;
12110 if (ret_var.is_owned) {
12113 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12117 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
12118 LDKReplyChannelRange obj_conv;
12119 obj_conv.inner = (void*)(obj & (~1));
12120 obj_conv.is_owned = false;
12121 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
12122 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12123 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12124 CVec_u8Z_free(arg_var);
12128 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12129 LDKu8slice ser_ref;
12130 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12131 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12132 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_read(ser_ref);
12133 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12134 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12135 long ret_ref = (long)ret_var.inner;
12136 if (ret_var.is_owned) {
12139 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12143 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
12144 LDKGossipTimestampFilter obj_conv;
12145 obj_conv.inner = (void*)(obj & (~1));
12146 obj_conv.is_owned = false;
12147 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
12148 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12149 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12150 CVec_u8Z_free(arg_var);
12154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12155 LDKMessageHandler this_ptr_conv;
12156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12157 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12158 MessageHandler_free(this_ptr_conv);
12161 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12162 LDKMessageHandler this_ptr_conv;
12163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12164 this_ptr_conv.is_owned = false;
12165 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
12169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12170 LDKMessageHandler this_ptr_conv;
12171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12172 this_ptr_conv.is_owned = false;
12173 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
12174 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
12175 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12176 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
12178 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
12181 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12182 LDKMessageHandler this_ptr_conv;
12183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12184 this_ptr_conv.is_owned = false;
12185 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
12189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12190 LDKMessageHandler this_ptr_conv;
12191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12192 this_ptr_conv.is_owned = false;
12193 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
12194 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12195 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12196 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
12198 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
12201 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
12202 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
12203 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
12204 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12205 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
12207 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
12208 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12209 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12210 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
12212 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
12213 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12214 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12215 long ret_ref = (long)ret_var.inner;
12216 if (ret_var.is_owned) {
12222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12223 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
12224 FREE((void*)this_ptr);
12225 SocketDescriptor_free(this_ptr_conv);
12228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12229 LDKPeerHandleError this_ptr_conv;
12230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12231 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12232 PeerHandleError_free(this_ptr_conv);
12235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
12236 LDKPeerHandleError this_ptr_conv;
12237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12238 this_ptr_conv.is_owned = false;
12239 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
12243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12244 LDKPeerHandleError this_ptr_conv;
12245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12246 this_ptr_conv.is_owned = false;
12247 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
12250 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
12251 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
12252 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12253 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12254 long ret_ref = (long)ret_var.inner;
12255 if (ret_var.is_owned) {
12261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12262 LDKPeerManager this_ptr_conv;
12263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12264 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12265 PeerManager_free(this_ptr_conv);
12268 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) {
12269 LDKMessageHandler message_handler_conv;
12270 message_handler_conv.inner = (void*)(message_handler & (~1));
12271 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
12272 // Warning: we may need a move here but can't clone!
12273 LDKSecretKey our_node_secret_ref;
12274 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
12275 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
12276 unsigned char ephemeral_random_data_arr[32];
12277 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
12278 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
12279 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
12280 LDKLogger logger_conv = *(LDKLogger*)logger;
12281 if (logger_conv.free == LDKLogger_JCalls_free) {
12282 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12283 LDKLogger_JCalls_clone(logger_conv.this_arg);
12285 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
12286 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12287 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12288 long ret_ref = (long)ret_var.inner;
12289 if (ret_var.is_owned) {
12295 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
12296 LDKPeerManager this_arg_conv;
12297 this_arg_conv.inner = (void*)(this_arg & (~1));
12298 this_arg_conv.is_owned = false;
12299 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
12300 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, arr_of_B_clz, NULL);
12301 for (size_t i = 0; i < ret_var.datalen; i++) {
12302 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
12303 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
12304 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
12306 CVec_PublicKeyZ_free(ret_var);
12310 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) {
12311 LDKPeerManager this_arg_conv;
12312 this_arg_conv.inner = (void*)(this_arg & (~1));
12313 this_arg_conv.is_owned = false;
12314 LDKPublicKey their_node_id_ref;
12315 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
12316 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12317 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12318 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12319 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12320 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12322 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
12323 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
12324 return (long)ret_conv;
12327 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12328 LDKPeerManager this_arg_conv;
12329 this_arg_conv.inner = (void*)(this_arg & (~1));
12330 this_arg_conv.is_owned = false;
12331 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12332 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12333 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12334 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12336 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12337 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
12338 return (long)ret_conv;
12341 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12342 LDKPeerManager this_arg_conv;
12343 this_arg_conv.inner = (void*)(this_arg & (~1));
12344 this_arg_conv.is_owned = false;
12345 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12346 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12347 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
12348 return (long)ret_conv;
12351 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
12352 LDKPeerManager this_arg_conv;
12353 this_arg_conv.inner = (void*)(this_arg & (~1));
12354 this_arg_conv.is_owned = false;
12355 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
12356 LDKu8slice data_ref;
12357 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
12358 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
12359 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12360 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
12361 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
12362 return (long)ret_conv;
12365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
12366 LDKPeerManager this_arg_conv;
12367 this_arg_conv.inner = (void*)(this_arg & (~1));
12368 this_arg_conv.is_owned = false;
12369 PeerManager_process_events(&this_arg_conv);
12372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12373 LDKPeerManager this_arg_conv;
12374 this_arg_conv.inner = (void*)(this_arg & (~1));
12375 this_arg_conv.is_owned = false;
12376 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12377 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
12380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
12381 LDKPeerManager this_arg_conv;
12382 this_arg_conv.inner = (void*)(this_arg & (~1));
12383 this_arg_conv.is_owned = false;
12384 PeerManager_timer_tick_occured(&this_arg_conv);
12387 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
12388 unsigned char commitment_seed_arr[32];
12389 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
12390 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
12391 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
12392 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
12393 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
12397 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
12398 LDKPublicKey per_commitment_point_ref;
12399 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12400 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12401 unsigned char base_secret_arr[32];
12402 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
12403 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
12404 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
12405 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12406 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
12407 return (long)ret_conv;
12410 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
12411 LDKPublicKey per_commitment_point_ref;
12412 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12413 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12414 LDKPublicKey base_point_ref;
12415 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
12416 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
12417 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12418 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
12419 return (long)ret_conv;
12422 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) {
12423 unsigned char per_commitment_secret_arr[32];
12424 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
12425 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
12426 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
12427 unsigned char countersignatory_revocation_base_secret_arr[32];
12428 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
12429 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
12430 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
12431 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12432 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
12433 return (long)ret_conv;
12436 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) {
12437 LDKPublicKey per_commitment_point_ref;
12438 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12439 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12440 LDKPublicKey countersignatory_revocation_base_point_ref;
12441 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
12442 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
12443 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12444 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
12445 return (long)ret_conv;
12448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12449 LDKTxCreationKeys this_ptr_conv;
12450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12452 TxCreationKeys_free(this_ptr_conv);
12455 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12456 LDKTxCreationKeys orig_conv;
12457 orig_conv.inner = (void*)(orig & (~1));
12458 orig_conv.is_owned = false;
12459 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
12460 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12461 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12462 long ret_ref = (long)ret_var.inner;
12463 if (ret_var.is_owned) {
12469 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12470 LDKTxCreationKeys this_ptr_conv;
12471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12472 this_ptr_conv.is_owned = false;
12473 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12474 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
12478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12479 LDKTxCreationKeys this_ptr_conv;
12480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12481 this_ptr_conv.is_owned = false;
12482 LDKPublicKey val_ref;
12483 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12484 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12485 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
12488 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12489 LDKTxCreationKeys this_ptr_conv;
12490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12491 this_ptr_conv.is_owned = false;
12492 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12493 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
12497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12498 LDKTxCreationKeys this_ptr_conv;
12499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12500 this_ptr_conv.is_owned = false;
12501 LDKPublicKey val_ref;
12502 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12503 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12504 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
12507 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12508 LDKTxCreationKeys this_ptr_conv;
12509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12510 this_ptr_conv.is_owned = false;
12511 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12512 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
12516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12517 LDKTxCreationKeys this_ptr_conv;
12518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12519 this_ptr_conv.is_owned = false;
12520 LDKPublicKey val_ref;
12521 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12522 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12523 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
12526 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12527 LDKTxCreationKeys this_ptr_conv;
12528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12529 this_ptr_conv.is_owned = false;
12530 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12531 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
12535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12536 LDKTxCreationKeys this_ptr_conv;
12537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12538 this_ptr_conv.is_owned = false;
12539 LDKPublicKey val_ref;
12540 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12541 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12542 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
12545 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12546 LDKTxCreationKeys this_ptr_conv;
12547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12548 this_ptr_conv.is_owned = false;
12549 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12550 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
12554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12555 LDKTxCreationKeys this_ptr_conv;
12556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12557 this_ptr_conv.is_owned = false;
12558 LDKPublicKey val_ref;
12559 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12560 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12561 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
12564 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) {
12565 LDKPublicKey per_commitment_point_arg_ref;
12566 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
12567 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
12568 LDKPublicKey revocation_key_arg_ref;
12569 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
12570 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
12571 LDKPublicKey broadcaster_htlc_key_arg_ref;
12572 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
12573 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
12574 LDKPublicKey countersignatory_htlc_key_arg_ref;
12575 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
12576 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
12577 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
12578 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
12579 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
12580 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);
12581 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12582 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12583 long ret_ref = (long)ret_var.inner;
12584 if (ret_var.is_owned) {
12590 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12591 LDKTxCreationKeys obj_conv;
12592 obj_conv.inner = (void*)(obj & (~1));
12593 obj_conv.is_owned = false;
12594 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
12595 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12596 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12597 CVec_u8Z_free(arg_var);
12601 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12602 LDKu8slice ser_ref;
12603 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12604 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12605 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
12606 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12607 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12608 long ret_ref = (long)ret_var.inner;
12609 if (ret_var.is_owned) {
12612 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12617 LDKPreCalculatedTxCreationKeys this_ptr_conv;
12618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12619 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12620 PreCalculatedTxCreationKeys_free(this_ptr_conv);
12623 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12624 LDKPreCalculatedTxCreationKeys orig_conv;
12625 orig_conv.inner = (void*)(orig & (~1));
12626 orig_conv.is_owned = false;
12627 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_clone(&orig_conv);
12628 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12629 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12630 long ret_ref = (long)ret_var.inner;
12631 if (ret_var.is_owned) {
12637 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
12638 LDKTxCreationKeys keys_conv;
12639 keys_conv.inner = (void*)(keys & (~1));
12640 keys_conv.is_owned = (keys & 1) || (keys == 0);
12641 if (keys_conv.inner != NULL)
12642 keys_conv = TxCreationKeys_clone(&keys_conv);
12643 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_new(keys_conv);
12644 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12645 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12646 long ret_ref = (long)ret_var.inner;
12647 if (ret_var.is_owned) {
12653 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
12654 LDKPreCalculatedTxCreationKeys this_arg_conv;
12655 this_arg_conv.inner = (void*)(this_arg & (~1));
12656 this_arg_conv.is_owned = false;
12657 LDKTxCreationKeys ret_var = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
12658 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12659 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12660 long ret_ref = (long)ret_var.inner;
12661 if (ret_var.is_owned) {
12667 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
12668 LDKPreCalculatedTxCreationKeys this_arg_conv;
12669 this_arg_conv.inner = (void*)(this_arg & (~1));
12670 this_arg_conv.is_owned = false;
12671 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12672 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
12676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12677 LDKChannelPublicKeys this_ptr_conv;
12678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12679 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12680 ChannelPublicKeys_free(this_ptr_conv);
12683 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12684 LDKChannelPublicKeys orig_conv;
12685 orig_conv.inner = (void*)(orig & (~1));
12686 orig_conv.is_owned = false;
12687 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
12688 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12689 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12690 long ret_ref = (long)ret_var.inner;
12691 if (ret_var.is_owned) {
12697 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
12698 LDKChannelPublicKeys this_ptr_conv;
12699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12700 this_ptr_conv.is_owned = false;
12701 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12702 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
12706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12707 LDKChannelPublicKeys this_ptr_conv;
12708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12709 this_ptr_conv.is_owned = false;
12710 LDKPublicKey val_ref;
12711 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12712 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12713 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
12716 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12717 LDKChannelPublicKeys this_ptr_conv;
12718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12719 this_ptr_conv.is_owned = false;
12720 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12721 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
12725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12726 LDKChannelPublicKeys this_ptr_conv;
12727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12728 this_ptr_conv.is_owned = false;
12729 LDKPublicKey val_ref;
12730 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12731 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12732 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
12735 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12736 LDKChannelPublicKeys this_ptr_conv;
12737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12738 this_ptr_conv.is_owned = false;
12739 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12740 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
12744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12745 LDKChannelPublicKeys this_ptr_conv;
12746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12747 this_ptr_conv.is_owned = false;
12748 LDKPublicKey val_ref;
12749 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12750 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12751 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
12754 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12755 LDKChannelPublicKeys this_ptr_conv;
12756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12757 this_ptr_conv.is_owned = false;
12758 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12759 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
12763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12764 LDKChannelPublicKeys this_ptr_conv;
12765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12766 this_ptr_conv.is_owned = false;
12767 LDKPublicKey val_ref;
12768 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12769 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12770 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12773 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12774 LDKChannelPublicKeys this_ptr_conv;
12775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12776 this_ptr_conv.is_owned = false;
12777 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12778 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
12782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12783 LDKChannelPublicKeys this_ptr_conv;
12784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12785 this_ptr_conv.is_owned = false;
12786 LDKPublicKey val_ref;
12787 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12788 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12789 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
12792 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) {
12793 LDKPublicKey funding_pubkey_arg_ref;
12794 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
12795 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
12796 LDKPublicKey revocation_basepoint_arg_ref;
12797 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
12798 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
12799 LDKPublicKey payment_point_arg_ref;
12800 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
12801 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
12802 LDKPublicKey delayed_payment_basepoint_arg_ref;
12803 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
12804 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
12805 LDKPublicKey htlc_basepoint_arg_ref;
12806 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
12807 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
12808 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);
12809 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12810 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12811 long ret_ref = (long)ret_var.inner;
12812 if (ret_var.is_owned) {
12818 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12819 LDKChannelPublicKeys obj_conv;
12820 obj_conv.inner = (void*)(obj & (~1));
12821 obj_conv.is_owned = false;
12822 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
12823 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12824 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12825 CVec_u8Z_free(arg_var);
12829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12830 LDKu8slice ser_ref;
12831 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12832 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12833 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
12834 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12835 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12836 long ret_ref = (long)ret_var.inner;
12837 if (ret_var.is_owned) {
12840 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12844 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) {
12845 LDKPublicKey per_commitment_point_ref;
12846 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12847 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12848 LDKPublicKey broadcaster_delayed_payment_base_ref;
12849 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
12850 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
12851 LDKPublicKey broadcaster_htlc_base_ref;
12852 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
12853 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
12854 LDKPublicKey countersignatory_revocation_base_ref;
12855 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
12856 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
12857 LDKPublicKey countersignatory_htlc_base_ref;
12858 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
12859 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
12860 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
12861 *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);
12862 return (long)ret_conv;
12865 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) {
12866 LDKPublicKey revocation_key_ref;
12867 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
12868 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
12869 LDKPublicKey broadcaster_delayed_payment_key_ref;
12870 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
12871 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
12872 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
12873 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12874 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12875 CVec_u8Z_free(arg_var);
12879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12880 LDKHTLCOutputInCommitment this_ptr_conv;
12881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12882 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12883 HTLCOutputInCommitment_free(this_ptr_conv);
12886 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12887 LDKHTLCOutputInCommitment orig_conv;
12888 orig_conv.inner = (void*)(orig & (~1));
12889 orig_conv.is_owned = false;
12890 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
12891 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12892 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12893 long ret_ref = (long)ret_var.inner;
12894 if (ret_var.is_owned) {
12900 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
12901 LDKHTLCOutputInCommitment this_ptr_conv;
12902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12903 this_ptr_conv.is_owned = false;
12904 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
12908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12909 LDKHTLCOutputInCommitment this_ptr_conv;
12910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12911 this_ptr_conv.is_owned = false;
12912 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
12915 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12916 LDKHTLCOutputInCommitment this_ptr_conv;
12917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12918 this_ptr_conv.is_owned = false;
12919 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
12923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12924 LDKHTLCOutputInCommitment this_ptr_conv;
12925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12926 this_ptr_conv.is_owned = false;
12927 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
12930 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
12931 LDKHTLCOutputInCommitment this_ptr_conv;
12932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12933 this_ptr_conv.is_owned = false;
12934 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
12938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12939 LDKHTLCOutputInCommitment this_ptr_conv;
12940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12941 this_ptr_conv.is_owned = false;
12942 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
12945 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
12946 LDKHTLCOutputInCommitment this_ptr_conv;
12947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12948 this_ptr_conv.is_owned = false;
12949 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12950 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
12954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12955 LDKHTLCOutputInCommitment this_ptr_conv;
12956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12957 this_ptr_conv.is_owned = false;
12958 LDKThirtyTwoBytes val_ref;
12959 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12960 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12961 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
12964 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
12965 LDKHTLCOutputInCommitment obj_conv;
12966 obj_conv.inner = (void*)(obj & (~1));
12967 obj_conv.is_owned = false;
12968 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
12969 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12970 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12971 CVec_u8Z_free(arg_var);
12975 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12976 LDKu8slice ser_ref;
12977 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12978 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12979 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
12980 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12981 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12982 long ret_ref = (long)ret_var.inner;
12983 if (ret_var.is_owned) {
12986 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12990 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
12991 LDKHTLCOutputInCommitment htlc_conv;
12992 htlc_conv.inner = (void*)(htlc & (~1));
12993 htlc_conv.is_owned = false;
12994 LDKTxCreationKeys keys_conv;
12995 keys_conv.inner = (void*)(keys & (~1));
12996 keys_conv.is_owned = false;
12997 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
12998 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12999 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13000 CVec_u8Z_free(arg_var);
13004 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
13005 LDKPublicKey broadcaster_ref;
13006 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
13007 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
13008 LDKPublicKey countersignatory_ref;
13009 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
13010 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
13011 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
13012 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13013 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13014 CVec_u8Z_free(arg_var);
13018 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv * _env, jclass _b, jbyteArray prev_hash, jint feerate_per_kw, jshort contest_delay, jlong htlc, jbyteArray broadcaster_delayed_payment_key, jbyteArray revocation_key) {
13019 unsigned char prev_hash_arr[32];
13020 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
13021 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
13022 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
13023 LDKHTLCOutputInCommitment htlc_conv;
13024 htlc_conv.inner = (void*)(htlc & (~1));
13025 htlc_conv.is_owned = false;
13026 LDKPublicKey broadcaster_delayed_payment_key_ref;
13027 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
13028 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
13029 LDKPublicKey revocation_key_ref;
13030 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
13031 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
13032 LDKTransaction *ret_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
13033 *ret_copy = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
13034 long ret_ref = (long)ret_copy;
13038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13039 LDKHolderCommitmentTransaction this_ptr_conv;
13040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13041 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13042 HolderCommitmentTransaction_free(this_ptr_conv);
13045 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13046 LDKHolderCommitmentTransaction orig_conv;
13047 orig_conv.inner = (void*)(orig & (~1));
13048 orig_conv.is_owned = false;
13049 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
13050 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13051 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13052 long ret_ref = (long)ret_var.inner;
13053 if (ret_var.is_owned) {
13059 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
13060 LDKHolderCommitmentTransaction this_ptr_conv;
13061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13062 this_ptr_conv.is_owned = false;
13063 LDKTransaction *ret_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
13064 *ret_copy = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
13065 long ret_ref = (long)ret_copy;
13069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13070 LDKHolderCommitmentTransaction this_ptr_conv;
13071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13072 this_ptr_conv.is_owned = false;
13073 LDKTransaction val_conv = *(LDKTransaction*)val;
13074 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
13077 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
13078 LDKHolderCommitmentTransaction this_ptr_conv;
13079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13080 this_ptr_conv.is_owned = false;
13081 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
13082 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
13086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13087 LDKHolderCommitmentTransaction this_ptr_conv;
13088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13089 this_ptr_conv.is_owned = false;
13090 LDKSignature val_ref;
13091 CHECK((*_env)->GetArrayLength (_env, val) == 64);
13092 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
13093 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
13096 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
13097 LDKHolderCommitmentTransaction this_ptr_conv;
13098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13099 this_ptr_conv.is_owned = false;
13100 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
13104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13105 LDKHolderCommitmentTransaction this_ptr_conv;
13106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13107 this_ptr_conv.is_owned = false;
13108 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
13111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
13112 LDKHolderCommitmentTransaction this_ptr_conv;
13113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13114 this_ptr_conv.is_owned = false;
13115 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_constr;
13116 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13117 if (val_constr.datalen > 0)
13118 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
13120 val_constr.data = NULL;
13121 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
13122 for (size_t q = 0; q < val_constr.datalen; q++) {
13123 long arr_conv_42 = val_vals[q];
13124 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
13125 FREE((void*)arr_conv_42);
13126 val_constr.data[q] = arr_conv_42_conv;
13128 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
13129 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_constr);
13132 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new_1missing_1holder_1sig(JNIEnv * _env, jclass _b, jlong unsigned_tx, jbyteArray counterparty_sig, jbyteArray holder_funding_key, jbyteArray counterparty_funding_key, jlong keys, jint feerate_per_kw, jlongArray htlc_data) {
13133 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
13134 LDKSignature counterparty_sig_ref;
13135 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
13136 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
13137 LDKPublicKey holder_funding_key_ref;
13138 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
13139 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
13140 LDKPublicKey counterparty_funding_key_ref;
13141 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
13142 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
13143 LDKTxCreationKeys keys_conv;
13144 keys_conv.inner = (void*)(keys & (~1));
13145 keys_conv.is_owned = (keys & 1) || (keys == 0);
13146 if (keys_conv.inner != NULL)
13147 keys_conv = TxCreationKeys_clone(&keys_conv);
13148 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_constr;
13149 htlc_data_constr.datalen = (*_env)->GetArrayLength (_env, htlc_data);
13150 if (htlc_data_constr.datalen > 0)
13151 htlc_data_constr.data = MALLOC(htlc_data_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
13153 htlc_data_constr.data = NULL;
13154 long* htlc_data_vals = (*_env)->GetLongArrayElements (_env, htlc_data, NULL);
13155 for (size_t q = 0; q < htlc_data_constr.datalen; q++) {
13156 long arr_conv_42 = htlc_data_vals[q];
13157 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
13158 FREE((void*)arr_conv_42);
13159 htlc_data_constr.data[q] = arr_conv_42_conv;
13161 (*_env)->ReleaseLongArrayElements (_env, htlc_data, htlc_data_vals, 0);
13162 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new_missing_holder_sig(unsigned_tx_conv, counterparty_sig_ref, holder_funding_key_ref, counterparty_funding_key_ref, keys_conv, feerate_per_kw, htlc_data_constr);
13163 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13164 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13165 long ret_ref = (long)ret_var.inner;
13166 if (ret_var.is_owned) {
13172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
13173 LDKHolderCommitmentTransaction this_arg_conv;
13174 this_arg_conv.inner = (void*)(this_arg & (~1));
13175 this_arg_conv.is_owned = false;
13176 LDKTxCreationKeys ret_var = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
13177 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13178 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13179 long ret_ref = (long)ret_var.inner;
13180 if (ret_var.is_owned) {
13186 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
13187 LDKHolderCommitmentTransaction this_arg_conv;
13188 this_arg_conv.inner = (void*)(this_arg & (~1));
13189 this_arg_conv.is_owned = false;
13190 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
13191 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
13195 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) {
13196 LDKHolderCommitmentTransaction this_arg_conv;
13197 this_arg_conv.inner = (void*)(this_arg & (~1));
13198 this_arg_conv.is_owned = false;
13199 unsigned char funding_key_arr[32];
13200 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
13201 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
13202 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
13203 LDKu8slice funding_redeemscript_ref;
13204 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
13205 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
13206 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
13207 (*_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);
13208 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
13212 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) {
13213 LDKHolderCommitmentTransaction this_arg_conv;
13214 this_arg_conv.inner = (void*)(this_arg & (~1));
13215 this_arg_conv.is_owned = false;
13216 unsigned char htlc_base_key_arr[32];
13217 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
13218 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
13219 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
13220 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
13221 *ret_conv = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
13222 return (long)ret_conv;
13225 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
13226 LDKHolderCommitmentTransaction obj_conv;
13227 obj_conv.inner = (void*)(obj & (~1));
13228 obj_conv.is_owned = false;
13229 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
13230 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13231 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13232 CVec_u8Z_free(arg_var);
13236 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13237 LDKu8slice ser_ref;
13238 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13239 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13240 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
13241 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13242 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13243 long ret_ref = (long)ret_var.inner;
13244 if (ret_var.is_owned) {
13247 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13252 LDKInitFeatures this_ptr_conv;
13253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13254 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13255 InitFeatures_free(this_ptr_conv);
13258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13259 LDKNodeFeatures this_ptr_conv;
13260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13261 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13262 NodeFeatures_free(this_ptr_conv);
13265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13266 LDKChannelFeatures this_ptr_conv;
13267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13268 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13269 ChannelFeatures_free(this_ptr_conv);
13272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13273 LDKRouteHop this_ptr_conv;
13274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13275 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13276 RouteHop_free(this_ptr_conv);
13279 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13280 LDKRouteHop orig_conv;
13281 orig_conv.inner = (void*)(orig & (~1));
13282 orig_conv.is_owned = false;
13283 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
13284 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13285 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13286 long ret_ref = (long)ret_var.inner;
13287 if (ret_var.is_owned) {
13293 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
13294 LDKRouteHop this_ptr_conv;
13295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13296 this_ptr_conv.is_owned = false;
13297 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13298 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
13302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13303 LDKRouteHop this_ptr_conv;
13304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13305 this_ptr_conv.is_owned = false;
13306 LDKPublicKey val_ref;
13307 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13308 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13309 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
13312 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13313 LDKRouteHop this_ptr_conv;
13314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13315 this_ptr_conv.is_owned = false;
13316 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
13317 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13318 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13319 long ret_ref = (long)ret_var.inner;
13320 if (ret_var.is_owned) {
13326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13327 LDKRouteHop this_ptr_conv;
13328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13329 this_ptr_conv.is_owned = false;
13330 LDKNodeFeatures val_conv;
13331 val_conv.inner = (void*)(val & (~1));
13332 val_conv.is_owned = (val & 1) || (val == 0);
13333 // Warning: we may need a move here but can't clone!
13334 RouteHop_set_node_features(&this_ptr_conv, val_conv);
13337 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13338 LDKRouteHop this_ptr_conv;
13339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13340 this_ptr_conv.is_owned = false;
13341 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
13345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13346 LDKRouteHop this_ptr_conv;
13347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13348 this_ptr_conv.is_owned = false;
13349 RouteHop_set_short_channel_id(&this_ptr_conv, val);
13352 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13353 LDKRouteHop this_ptr_conv;
13354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13355 this_ptr_conv.is_owned = false;
13356 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
13357 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13358 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13359 long ret_ref = (long)ret_var.inner;
13360 if (ret_var.is_owned) {
13366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13367 LDKRouteHop this_ptr_conv;
13368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13369 this_ptr_conv.is_owned = false;
13370 LDKChannelFeatures val_conv;
13371 val_conv.inner = (void*)(val & (~1));
13372 val_conv.is_owned = (val & 1) || (val == 0);
13373 // Warning: we may need a move here but can't clone!
13374 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
13377 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13378 LDKRouteHop this_ptr_conv;
13379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13380 this_ptr_conv.is_owned = false;
13381 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
13385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13386 LDKRouteHop this_ptr_conv;
13387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13388 this_ptr_conv.is_owned = false;
13389 RouteHop_set_fee_msat(&this_ptr_conv, val);
13392 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13393 LDKRouteHop this_ptr_conv;
13394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13395 this_ptr_conv.is_owned = false;
13396 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
13400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13401 LDKRouteHop this_ptr_conv;
13402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13403 this_ptr_conv.is_owned = false;
13404 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
13407 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) {
13408 LDKPublicKey pubkey_arg_ref;
13409 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
13410 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
13411 LDKNodeFeatures node_features_arg_conv;
13412 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
13413 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
13414 // Warning: we may need a move here but can't clone!
13415 LDKChannelFeatures channel_features_arg_conv;
13416 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
13417 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
13418 // Warning: we may need a move here but can't clone!
13419 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);
13420 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13421 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13422 long ret_ref = (long)ret_var.inner;
13423 if (ret_var.is_owned) {
13429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13430 LDKRoute this_ptr_conv;
13431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13432 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13433 Route_free(this_ptr_conv);
13436 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13437 LDKRoute orig_conv;
13438 orig_conv.inner = (void*)(orig & (~1));
13439 orig_conv.is_owned = false;
13440 LDKRoute ret_var = Route_clone(&orig_conv);
13441 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13442 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13443 long ret_ref = (long)ret_var.inner;
13444 if (ret_var.is_owned) {
13450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
13451 LDKRoute this_ptr_conv;
13452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13453 this_ptr_conv.is_owned = false;
13454 LDKCVec_CVec_RouteHopZZ val_constr;
13455 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13456 if (val_constr.datalen > 0)
13457 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13459 val_constr.data = NULL;
13460 for (size_t m = 0; m < val_constr.datalen; m++) {
13461 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
13462 LDKCVec_RouteHopZ arr_conv_12_constr;
13463 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13464 if (arr_conv_12_constr.datalen > 0)
13465 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13467 arr_conv_12_constr.data = NULL;
13468 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13469 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13470 long arr_conv_10 = arr_conv_12_vals[k];
13471 LDKRouteHop arr_conv_10_conv;
13472 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13473 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13474 if (arr_conv_10_conv.inner != NULL)
13475 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13476 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13478 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13479 val_constr.data[m] = arr_conv_12_constr;
13481 Route_set_paths(&this_ptr_conv, val_constr);
13484 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
13485 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
13486 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
13487 if (paths_arg_constr.datalen > 0)
13488 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13490 paths_arg_constr.data = NULL;
13491 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
13492 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
13493 LDKCVec_RouteHopZ arr_conv_12_constr;
13494 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13495 if (arr_conv_12_constr.datalen > 0)
13496 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13498 arr_conv_12_constr.data = NULL;
13499 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13500 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13501 long arr_conv_10 = arr_conv_12_vals[k];
13502 LDKRouteHop arr_conv_10_conv;
13503 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13504 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13505 if (arr_conv_10_conv.inner != NULL)
13506 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13507 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13509 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13510 paths_arg_constr.data[m] = arr_conv_12_constr;
13512 LDKRoute ret_var = Route_new(paths_arg_constr);
13513 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13514 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13515 long ret_ref = (long)ret_var.inner;
13516 if (ret_var.is_owned) {
13522 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
13524 obj_conv.inner = (void*)(obj & (~1));
13525 obj_conv.is_owned = false;
13526 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
13527 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13528 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13529 CVec_u8Z_free(arg_var);
13533 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13534 LDKu8slice ser_ref;
13535 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13536 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13537 LDKRoute ret_var = Route_read(ser_ref);
13538 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13539 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13540 long ret_ref = (long)ret_var.inner;
13541 if (ret_var.is_owned) {
13544 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13549 LDKRouteHint this_ptr_conv;
13550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13551 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13552 RouteHint_free(this_ptr_conv);
13555 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13556 LDKRouteHint orig_conv;
13557 orig_conv.inner = (void*)(orig & (~1));
13558 orig_conv.is_owned = false;
13559 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
13560 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13561 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13562 long ret_ref = (long)ret_var.inner;
13563 if (ret_var.is_owned) {
13569 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13570 LDKRouteHint this_ptr_conv;
13571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13572 this_ptr_conv.is_owned = false;
13573 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13574 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
13578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13579 LDKRouteHint this_ptr_conv;
13580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13581 this_ptr_conv.is_owned = false;
13582 LDKPublicKey val_ref;
13583 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13584 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13585 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
13588 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13589 LDKRouteHint this_ptr_conv;
13590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13591 this_ptr_conv.is_owned = false;
13592 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
13596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13597 LDKRouteHint this_ptr_conv;
13598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13599 this_ptr_conv.is_owned = false;
13600 RouteHint_set_short_channel_id(&this_ptr_conv, val);
13603 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
13604 LDKRouteHint this_ptr_conv;
13605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13606 this_ptr_conv.is_owned = false;
13607 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
13608 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13609 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13610 long ret_ref = (long)ret_var.inner;
13611 if (ret_var.is_owned) {
13617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13618 LDKRouteHint this_ptr_conv;
13619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13620 this_ptr_conv.is_owned = false;
13621 LDKRoutingFees val_conv;
13622 val_conv.inner = (void*)(val & (~1));
13623 val_conv.is_owned = (val & 1) || (val == 0);
13624 if (val_conv.inner != NULL)
13625 val_conv = RoutingFees_clone(&val_conv);
13626 RouteHint_set_fees(&this_ptr_conv, val_conv);
13629 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13630 LDKRouteHint this_ptr_conv;
13631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13632 this_ptr_conv.is_owned = false;
13633 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
13637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13638 LDKRouteHint this_ptr_conv;
13639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13640 this_ptr_conv.is_owned = false;
13641 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
13644 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13645 LDKRouteHint this_ptr_conv;
13646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13647 this_ptr_conv.is_owned = false;
13648 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
13652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13653 LDKRouteHint this_ptr_conv;
13654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13655 this_ptr_conv.is_owned = false;
13656 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
13659 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) {
13660 LDKPublicKey src_node_id_arg_ref;
13661 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
13662 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
13663 LDKRoutingFees fees_arg_conv;
13664 fees_arg_conv.inner = (void*)(fees_arg & (~1));
13665 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
13666 if (fees_arg_conv.inner != NULL)
13667 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
13668 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);
13669 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13670 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13671 long ret_ref = (long)ret_var.inner;
13672 if (ret_var.is_owned) {
13678 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) {
13679 LDKPublicKey our_node_id_ref;
13680 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
13681 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
13682 LDKNetworkGraph network_conv;
13683 network_conv.inner = (void*)(network & (~1));
13684 network_conv.is_owned = false;
13685 LDKPublicKey target_ref;
13686 CHECK((*_env)->GetArrayLength (_env, target) == 33);
13687 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
13688 LDKCVec_ChannelDetailsZ first_hops_constr;
13689 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
13690 if (first_hops_constr.datalen > 0)
13691 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13693 first_hops_constr.data = NULL;
13694 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
13695 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13696 long arr_conv_16 = first_hops_vals[q];
13697 LDKChannelDetails arr_conv_16_conv;
13698 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13699 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13700 first_hops_constr.data[q] = arr_conv_16_conv;
13702 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
13703 LDKCVec_RouteHintZ last_hops_constr;
13704 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
13705 if (last_hops_constr.datalen > 0)
13706 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13708 last_hops_constr.data = NULL;
13709 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
13710 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
13711 long arr_conv_11 = last_hops_vals[l];
13712 LDKRouteHint arr_conv_11_conv;
13713 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
13714 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
13715 if (arr_conv_11_conv.inner != NULL)
13716 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
13717 last_hops_constr.data[l] = arr_conv_11_conv;
13719 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
13720 LDKLogger logger_conv = *(LDKLogger*)logger;
13721 if (logger_conv.free == LDKLogger_JCalls_free) {
13722 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13723 LDKLogger_JCalls_clone(logger_conv.this_arg);
13725 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13726 *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);
13727 FREE(first_hops_constr.data);
13728 return (long)ret_conv;
13731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13732 LDKNetworkGraph this_ptr_conv;
13733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13734 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13735 NetworkGraph_free(this_ptr_conv);
13738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13739 LDKLockedNetworkGraph this_ptr_conv;
13740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13741 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13742 LockedNetworkGraph_free(this_ptr_conv);
13745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13746 LDKNetGraphMsgHandler this_ptr_conv;
13747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13748 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13749 NetGraphMsgHandler_free(this_ptr_conv);
13752 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
13753 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13754 LDKLogger logger_conv = *(LDKLogger*)logger;
13755 if (logger_conv.free == LDKLogger_JCalls_free) {
13756 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13757 LDKLogger_JCalls_clone(logger_conv.this_arg);
13759 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
13760 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13761 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13762 long ret_ref = (long)ret_var.inner;
13763 if (ret_var.is_owned) {
13769 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
13770 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13771 LDKLogger logger_conv = *(LDKLogger*)logger;
13772 if (logger_conv.free == LDKLogger_JCalls_free) {
13773 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13774 LDKLogger_JCalls_clone(logger_conv.this_arg);
13776 LDKNetworkGraph network_graph_conv;
13777 network_graph_conv.inner = (void*)(network_graph & (~1));
13778 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
13779 // Warning: we may need a move here but can't clone!
13780 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
13781 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13782 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13783 long ret_ref = (long)ret_var.inner;
13784 if (ret_var.is_owned) {
13790 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13791 LDKNetGraphMsgHandler this_arg_conv;
13792 this_arg_conv.inner = (void*)(this_arg & (~1));
13793 this_arg_conv.is_owned = false;
13794 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
13795 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13796 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13797 long ret_ref = (long)ret_var.inner;
13798 if (ret_var.is_owned) {
13804 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13805 LDKLockedNetworkGraph this_arg_conv;
13806 this_arg_conv.inner = (void*)(this_arg & (~1));
13807 this_arg_conv.is_owned = false;
13808 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
13809 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13810 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13811 long ret_ref = (long)ret_var.inner;
13812 if (ret_var.is_owned) {
13818 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
13819 LDKNetGraphMsgHandler this_arg_conv;
13820 this_arg_conv.inner = (void*)(this_arg & (~1));
13821 this_arg_conv.is_owned = false;
13822 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13823 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
13827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13828 LDKDirectionalChannelInfo this_ptr_conv;
13829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13830 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13831 DirectionalChannelInfo_free(this_ptr_conv);
13834 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
13835 LDKDirectionalChannelInfo this_ptr_conv;
13836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13837 this_ptr_conv.is_owned = false;
13838 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
13842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13843 LDKDirectionalChannelInfo this_ptr_conv;
13844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13845 this_ptr_conv.is_owned = false;
13846 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
13849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
13850 LDKDirectionalChannelInfo this_ptr_conv;
13851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13852 this_ptr_conv.is_owned = false;
13853 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
13857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
13858 LDKDirectionalChannelInfo this_ptr_conv;
13859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13860 this_ptr_conv.is_owned = false;
13861 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
13864 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13865 LDKDirectionalChannelInfo this_ptr_conv;
13866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13867 this_ptr_conv.is_owned = false;
13868 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
13872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13873 LDKDirectionalChannelInfo this_ptr_conv;
13874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13875 this_ptr_conv.is_owned = false;
13876 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
13879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13880 LDKDirectionalChannelInfo this_ptr_conv;
13881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13882 this_ptr_conv.is_owned = false;
13883 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
13887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13888 LDKDirectionalChannelInfo this_ptr_conv;
13889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13890 this_ptr_conv.is_owned = false;
13891 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
13894 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
13895 LDKDirectionalChannelInfo this_ptr_conv;
13896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13897 this_ptr_conv.is_owned = false;
13898 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
13899 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13900 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13901 long ret_ref = (long)ret_var.inner;
13902 if (ret_var.is_owned) {
13908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13909 LDKDirectionalChannelInfo this_ptr_conv;
13910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13911 this_ptr_conv.is_owned = false;
13912 LDKChannelUpdate val_conv;
13913 val_conv.inner = (void*)(val & (~1));
13914 val_conv.is_owned = (val & 1) || (val == 0);
13915 if (val_conv.inner != NULL)
13916 val_conv = ChannelUpdate_clone(&val_conv);
13917 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
13920 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13921 LDKDirectionalChannelInfo obj_conv;
13922 obj_conv.inner = (void*)(obj & (~1));
13923 obj_conv.is_owned = false;
13924 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
13925 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13926 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13927 CVec_u8Z_free(arg_var);
13931 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13932 LDKu8slice ser_ref;
13933 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13934 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13935 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
13936 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13937 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13938 long ret_ref = (long)ret_var.inner;
13939 if (ret_var.is_owned) {
13942 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13947 LDKChannelInfo this_ptr_conv;
13948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13949 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13950 ChannelInfo_free(this_ptr_conv);
13953 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13954 LDKChannelInfo this_ptr_conv;
13955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13956 this_ptr_conv.is_owned = false;
13957 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
13958 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13959 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13960 long ret_ref = (long)ret_var.inner;
13961 if (ret_var.is_owned) {
13967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13968 LDKChannelInfo this_ptr_conv;
13969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13970 this_ptr_conv.is_owned = false;
13971 LDKChannelFeatures val_conv;
13972 val_conv.inner = (void*)(val & (~1));
13973 val_conv.is_owned = (val & 1) || (val == 0);
13974 // Warning: we may need a move here but can't clone!
13975 ChannelInfo_set_features(&this_ptr_conv, val_conv);
13978 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(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 = false;
13982 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13983 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
13987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13988 LDKChannelInfo this_ptr_conv;
13989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13990 this_ptr_conv.is_owned = false;
13991 LDKPublicKey val_ref;
13992 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13993 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13994 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
13997 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
13998 LDKChannelInfo this_ptr_conv;
13999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14000 this_ptr_conv.is_owned = false;
14001 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
14002 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14003 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14004 long ret_ref = (long)ret_var.inner;
14005 if (ret_var.is_owned) {
14011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14012 LDKChannelInfo this_ptr_conv;
14013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14014 this_ptr_conv.is_owned = false;
14015 LDKDirectionalChannelInfo val_conv;
14016 val_conv.inner = (void*)(val & (~1));
14017 val_conv.is_owned = (val & 1) || (val == 0);
14018 // Warning: we may need a move here but can't clone!
14019 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
14022 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
14023 LDKChannelInfo this_ptr_conv;
14024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14025 this_ptr_conv.is_owned = false;
14026 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14027 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
14031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14032 LDKChannelInfo this_ptr_conv;
14033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14034 this_ptr_conv.is_owned = false;
14035 LDKPublicKey val_ref;
14036 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14037 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14038 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
14041 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
14042 LDKChannelInfo this_ptr_conv;
14043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14044 this_ptr_conv.is_owned = false;
14045 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
14046 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14047 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14048 long ret_ref = (long)ret_var.inner;
14049 if (ret_var.is_owned) {
14055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14056 LDKChannelInfo this_ptr_conv;
14057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14058 this_ptr_conv.is_owned = false;
14059 LDKDirectionalChannelInfo val_conv;
14060 val_conv.inner = (void*)(val & (~1));
14061 val_conv.is_owned = (val & 1) || (val == 0);
14062 // Warning: we may need a move here but can't clone!
14063 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
14066 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14067 LDKChannelInfo this_ptr_conv;
14068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14069 this_ptr_conv.is_owned = false;
14070 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
14071 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14072 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14073 long ret_ref = (long)ret_var.inner;
14074 if (ret_var.is_owned) {
14080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14081 LDKChannelInfo this_ptr_conv;
14082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14083 this_ptr_conv.is_owned = false;
14084 LDKChannelAnnouncement val_conv;
14085 val_conv.inner = (void*)(val & (~1));
14086 val_conv.is_owned = (val & 1) || (val == 0);
14087 if (val_conv.inner != NULL)
14088 val_conv = ChannelAnnouncement_clone(&val_conv);
14089 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
14092 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14093 LDKChannelInfo obj_conv;
14094 obj_conv.inner = (void*)(obj & (~1));
14095 obj_conv.is_owned = false;
14096 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
14097 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14098 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14099 CVec_u8Z_free(arg_var);
14103 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14104 LDKu8slice ser_ref;
14105 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14106 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14107 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
14108 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14109 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14110 long ret_ref = (long)ret_var.inner;
14111 if (ret_var.is_owned) {
14114 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14119 LDKRoutingFees this_ptr_conv;
14120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14121 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14122 RoutingFees_free(this_ptr_conv);
14125 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
14126 LDKRoutingFees orig_conv;
14127 orig_conv.inner = (void*)(orig & (~1));
14128 orig_conv.is_owned = false;
14129 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
14130 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14131 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14132 long ret_ref = (long)ret_var.inner;
14133 if (ret_var.is_owned) {
14139 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
14140 LDKRoutingFees this_ptr_conv;
14141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14142 this_ptr_conv.is_owned = false;
14143 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
14147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14148 LDKRoutingFees this_ptr_conv;
14149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14150 this_ptr_conv.is_owned = false;
14151 RoutingFees_set_base_msat(&this_ptr_conv, val);
14154 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
14155 LDKRoutingFees this_ptr_conv;
14156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14157 this_ptr_conv.is_owned = false;
14158 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
14162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14163 LDKRoutingFees this_ptr_conv;
14164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14165 this_ptr_conv.is_owned = false;
14166 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
14169 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
14170 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
14171 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14172 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14173 long ret_ref = (long)ret_var.inner;
14174 if (ret_var.is_owned) {
14180 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14181 LDKu8slice ser_ref;
14182 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14183 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14184 LDKRoutingFees ret_var = RoutingFees_read(ser_ref);
14185 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14186 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14187 long ret_ref = (long)ret_var.inner;
14188 if (ret_var.is_owned) {
14191 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14195 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
14196 LDKRoutingFees obj_conv;
14197 obj_conv.inner = (void*)(obj & (~1));
14198 obj_conv.is_owned = false;
14199 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
14200 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14201 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14202 CVec_u8Z_free(arg_var);
14206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14207 LDKNodeAnnouncementInfo this_ptr_conv;
14208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14209 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14210 NodeAnnouncementInfo_free(this_ptr_conv);
14213 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
14214 LDKNodeAnnouncementInfo this_ptr_conv;
14215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14216 this_ptr_conv.is_owned = false;
14217 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
14218 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14219 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14220 long ret_ref = (long)ret_var.inner;
14221 if (ret_var.is_owned) {
14227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14228 LDKNodeAnnouncementInfo this_ptr_conv;
14229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14230 this_ptr_conv.is_owned = false;
14231 LDKNodeFeatures val_conv;
14232 val_conv.inner = (void*)(val & (~1));
14233 val_conv.is_owned = (val & 1) || (val == 0);
14234 // Warning: we may need a move here but can't clone!
14235 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
14238 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(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 = false;
14242 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
14246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14247 LDKNodeAnnouncementInfo this_ptr_conv;
14248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14249 this_ptr_conv.is_owned = false;
14250 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
14253 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
14254 LDKNodeAnnouncementInfo this_ptr_conv;
14255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14256 this_ptr_conv.is_owned = false;
14257 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
14258 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
14262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14263 LDKNodeAnnouncementInfo this_ptr_conv;
14264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14265 this_ptr_conv.is_owned = false;
14266 LDKThreeBytes val_ref;
14267 CHECK((*_env)->GetArrayLength (_env, val) == 3);
14268 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
14269 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
14272 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
14273 LDKNodeAnnouncementInfo this_ptr_conv;
14274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14275 this_ptr_conv.is_owned = false;
14276 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
14277 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
14281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14282 LDKNodeAnnouncementInfo this_ptr_conv;
14283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14284 this_ptr_conv.is_owned = false;
14285 LDKThirtyTwoBytes val_ref;
14286 CHECK((*_env)->GetArrayLength (_env, val) == 32);
14287 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
14288 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
14291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14292 LDKNodeAnnouncementInfo this_ptr_conv;
14293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14294 this_ptr_conv.is_owned = false;
14295 LDKCVec_NetAddressZ val_constr;
14296 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14297 if (val_constr.datalen > 0)
14298 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14300 val_constr.data = NULL;
14301 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14302 for (size_t m = 0; m < val_constr.datalen; m++) {
14303 long arr_conv_12 = val_vals[m];
14304 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14305 FREE((void*)arr_conv_12);
14306 val_constr.data[m] = arr_conv_12_conv;
14308 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14309 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
14312 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14313 LDKNodeAnnouncementInfo this_ptr_conv;
14314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14315 this_ptr_conv.is_owned = false;
14316 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
14317 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14318 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14319 long ret_ref = (long)ret_var.inner;
14320 if (ret_var.is_owned) {
14326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14327 LDKNodeAnnouncementInfo this_ptr_conv;
14328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14329 this_ptr_conv.is_owned = false;
14330 LDKNodeAnnouncement val_conv;
14331 val_conv.inner = (void*)(val & (~1));
14332 val_conv.is_owned = (val & 1) || (val == 0);
14333 if (val_conv.inner != NULL)
14334 val_conv = NodeAnnouncement_clone(&val_conv);
14335 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
14338 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) {
14339 LDKNodeFeatures features_arg_conv;
14340 features_arg_conv.inner = (void*)(features_arg & (~1));
14341 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
14342 // Warning: we may need a move here but can't clone!
14343 LDKThreeBytes rgb_arg_ref;
14344 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
14345 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
14346 LDKThirtyTwoBytes alias_arg_ref;
14347 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
14348 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
14349 LDKCVec_NetAddressZ addresses_arg_constr;
14350 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
14351 if (addresses_arg_constr.datalen > 0)
14352 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14354 addresses_arg_constr.data = NULL;
14355 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
14356 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
14357 long arr_conv_12 = addresses_arg_vals[m];
14358 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14359 FREE((void*)arr_conv_12);
14360 addresses_arg_constr.data[m] = arr_conv_12_conv;
14362 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
14363 LDKNodeAnnouncement announcement_message_arg_conv;
14364 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
14365 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
14366 if (announcement_message_arg_conv.inner != NULL)
14367 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
14368 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
14369 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14370 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14371 long ret_ref = (long)ret_var.inner;
14372 if (ret_var.is_owned) {
14378 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14379 LDKNodeAnnouncementInfo obj_conv;
14380 obj_conv.inner = (void*)(obj & (~1));
14381 obj_conv.is_owned = false;
14382 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
14383 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14384 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14385 CVec_u8Z_free(arg_var);
14389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14390 LDKu8slice ser_ref;
14391 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14392 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14393 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_read(ser_ref);
14394 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14395 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14396 long ret_ref = (long)ret_var.inner;
14397 if (ret_var.is_owned) {
14400 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14405 LDKNodeInfo this_ptr_conv;
14406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14408 NodeInfo_free(this_ptr_conv);
14411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14412 LDKNodeInfo this_ptr_conv;
14413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14414 this_ptr_conv.is_owned = false;
14415 LDKCVec_u64Z val_constr;
14416 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14417 if (val_constr.datalen > 0)
14418 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14420 val_constr.data = NULL;
14421 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14422 for (size_t g = 0; g < val_constr.datalen; g++) {
14423 long arr_conv_6 = val_vals[g];
14424 val_constr.data[g] = arr_conv_6;
14426 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14427 NodeInfo_set_channels(&this_ptr_conv, val_constr);
14430 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
14431 LDKNodeInfo this_ptr_conv;
14432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14433 this_ptr_conv.is_owned = false;
14434 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
14435 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14436 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14437 long ret_ref = (long)ret_var.inner;
14438 if (ret_var.is_owned) {
14444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14445 LDKNodeInfo this_ptr_conv;
14446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14447 this_ptr_conv.is_owned = false;
14448 LDKRoutingFees val_conv;
14449 val_conv.inner = (void*)(val & (~1));
14450 val_conv.is_owned = (val & 1) || (val == 0);
14451 if (val_conv.inner != NULL)
14452 val_conv = RoutingFees_clone(&val_conv);
14453 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
14456 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
14457 LDKNodeInfo this_ptr_conv;
14458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14459 this_ptr_conv.is_owned = false;
14460 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
14461 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14462 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14463 long ret_ref = (long)ret_var.inner;
14464 if (ret_var.is_owned) {
14470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14471 LDKNodeInfo this_ptr_conv;
14472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14473 this_ptr_conv.is_owned = false;
14474 LDKNodeAnnouncementInfo val_conv;
14475 val_conv.inner = (void*)(val & (~1));
14476 val_conv.is_owned = (val & 1) || (val == 0);
14477 // Warning: we may need a move here but can't clone!
14478 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
14481 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) {
14482 LDKCVec_u64Z channels_arg_constr;
14483 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
14484 if (channels_arg_constr.datalen > 0)
14485 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14487 channels_arg_constr.data = NULL;
14488 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
14489 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
14490 long arr_conv_6 = channels_arg_vals[g];
14491 channels_arg_constr.data[g] = arr_conv_6;
14493 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
14494 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
14495 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
14496 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
14497 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
14498 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
14499 LDKNodeAnnouncementInfo announcement_info_arg_conv;
14500 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
14501 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
14502 // Warning: we may need a move here but can't clone!
14503 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
14504 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14505 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14506 long ret_ref = (long)ret_var.inner;
14507 if (ret_var.is_owned) {
14513 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14514 LDKNodeInfo obj_conv;
14515 obj_conv.inner = (void*)(obj & (~1));
14516 obj_conv.is_owned = false;
14517 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
14518 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14519 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14520 CVec_u8Z_free(arg_var);
14524 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14525 LDKu8slice ser_ref;
14526 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14527 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14528 LDKNodeInfo ret_var = NodeInfo_read(ser_ref);
14529 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14530 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14531 long ret_ref = (long)ret_var.inner;
14532 if (ret_var.is_owned) {
14535 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14539 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
14540 LDKNetworkGraph obj_conv;
14541 obj_conv.inner = (void*)(obj & (~1));
14542 obj_conv.is_owned = false;
14543 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
14544 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14545 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14546 CVec_u8Z_free(arg_var);
14550 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14551 LDKu8slice ser_ref;
14552 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14553 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14554 LDKNetworkGraph ret_var = NetworkGraph_read(ser_ref);
14555 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14556 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14557 long ret_ref = (long)ret_var.inner;
14558 if (ret_var.is_owned) {
14561 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14565 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
14566 LDKNetworkGraph ret_var = NetworkGraph_new();
14567 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14568 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14569 long ret_ref = (long)ret_var.inner;
14570 if (ret_var.is_owned) {
14576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1close_1channel_1from_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong short_channel_id, jboolean is_permanent) {
14577 LDKNetworkGraph this_arg_conv;
14578 this_arg_conv.inner = (void*)(this_arg & (~1));
14579 this_arg_conv.is_owned = false;
14580 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);