1 #include "org_ldk_impl_bindings.h"
2 #include <rust_types.h>
7 // Always run a, then assert it is true:
8 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
9 // Assert a is true or do nothing
10 #define CHECK(a) DO_ASSERT(a)
12 // Running a leak check across all the allocations and frees of the JDK is a mess,
13 // so instead we implement our own naive leak checker here, relying on the -wrap
14 // linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated
15 // and free'd in Rust or C across the generated bindings shared library.
19 static mtx_t allocation_mtx;
21 void __attribute__((constructor)) init_mtx() {
22 DO_ASSERT(mtx_init(&allocation_mtx, mtx_plain) == thrd_success);
26 typedef struct allocation {
27 struct allocation* next;
29 const char* struct_name;
33 static allocation* allocation_ll = NULL;
35 void* __real_malloc(size_t len);
36 void* __real_calloc(size_t nmemb, size_t len);
37 static void new_allocation(void* res, const char* struct_name) {
38 allocation* new_alloc = __real_malloc(sizeof(allocation));
40 new_alloc->struct_name = struct_name;
41 new_alloc->bt_len = backtrace(new_alloc->bt, BT_MAX);
42 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
43 new_alloc->next = allocation_ll;
44 allocation_ll = new_alloc;
45 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
47 static void* MALLOC(size_t len, const char* struct_name) {
48 void* res = __real_malloc(len);
49 new_allocation(res, struct_name);
52 void __real_free(void* ptr);
53 static void alloc_freed(void* ptr) {
55 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
56 allocation* it = allocation_ll;
57 while (it->ptr != ptr) {
58 p = it; it = it->next;
60 fprintf(stderr, "Tried to free unknown pointer %p at:\n", ptr);
62 int bt_len = backtrace(bt, BT_MAX);
63 backtrace_symbols_fd(bt, bt_len, STDERR_FILENO);
64 fprintf(stderr, "\n\n");
65 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
66 return; // addrsan should catch malloc-unknown and print more info than we have
69 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
70 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
71 DO_ASSERT(it->ptr == ptr);
74 static void FREE(void* ptr) {
75 if ((long)ptr < 1024) return; // Rust loves to create pointers to the NULL page for dummys
80 void* __wrap_malloc(size_t len) {
81 void* res = __real_malloc(len);
82 new_allocation(res, "malloc call");
85 void* __wrap_calloc(size_t nmemb, size_t len) {
86 void* res = __real_calloc(nmemb, len);
87 new_allocation(res, "calloc call");
90 void __wrap_free(void* ptr) {
95 void* __real_realloc(void* ptr, size_t newlen);
96 void* __wrap_realloc(void* ptr, size_t len) {
98 void* res = __real_realloc(ptr, len);
99 new_allocation(res, "realloc call");
102 void __wrap_reallocarray(void* ptr, size_t new_sz) {
103 // Rust doesn't seem to use reallocarray currently
107 void __attribute__((destructor)) check_leaks() {
108 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
109 fprintf(stderr, "%s %p remains:\n", a->struct_name, a->ptr);
110 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
111 fprintf(stderr, "\n\n");
113 DO_ASSERT(allocation_ll == NULL);
115 static jclass arr_of_arr_of_B_clz = 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 long ret_keys = (long)keys;
1894 LDKCVec_HTLCOutputInCommitmentZ htlcs_var = htlcs;
1895 jlongArray htlcs_arr = (*_env)->NewLongArray(_env, htlcs_var.datalen);
1896 jlong *htlcs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, htlcs_arr, NULL);
1897 for (size_t y = 0; y < htlcs_var.datalen; y++) {
1898 LDKHTLCOutputInCommitment arr_conv_24_var = htlcs_var.data[y];
1899 CHECK((((long)arr_conv_24_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1900 CHECK((((long)&arr_conv_24_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1901 long arr_conv_24_ref = (long)arr_conv_24_var.inner;
1902 if (arr_conv_24_var.is_owned) {
1903 arr_conv_24_ref |= 1;
1905 htlcs_arr_ptr[y] = arr_conv_24_ref;
1907 (*_env)->ReleasePrimitiveArrayCritical(_env, htlcs_arr, htlcs_arr_ptr, 0);
1908 FREE(htlcs_var.data);
1909 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1911 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, ret_keys, htlcs_arr);
1912 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret;
1916 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1917 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1919 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1920 long ret_holder_commitment_tx = (long)holder_commitment_tx;
1921 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1923 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, ret_holder_commitment_tx);
1924 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1928 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1929 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1931 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1932 long ret_holder_commitment_tx = (long)holder_commitment_tx;
1933 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1935 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, ret_holder_commitment_tx);
1936 LDKCResult_CVec_SignatureZNoneZ ret_conv = *(LDKCResult_CVec_SignatureZNoneZ*)ret;
1940 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) {
1941 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1943 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1944 LDKTransaction *justice_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1945 *justice_tx_copy = justice_tx;
1946 long justice_tx_ref = (long)justice_tx_copy;
1947 jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32);
1948 (*_env)->SetByteArrayRegion(_env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1949 long ret_htlc = (long)htlc;
1950 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1952 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_justice_transaction_meth, justice_tx_ref, input, amount, per_commitment_key_arr, ret_htlc);
1953 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1957 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) {
1958 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1960 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1961 LDKTransaction *htlc_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1962 *htlc_tx_copy = htlc_tx;
1963 long htlc_tx_ref = (long)htlc_tx_copy;
1964 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
1965 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1966 long ret_htlc = (long)htlc;
1967 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1969 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, ret_htlc);
1970 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1974 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1975 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1977 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1978 LDKTransaction *closing_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1979 *closing_tx_copy = closing_tx;
1980 long closing_tx_ref = (long)closing_tx_copy;
1981 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1983 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1984 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1988 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1989 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1991 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1992 long ret_msg = (long)msg;
1993 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1995 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, ret_msg);
1996 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
2000 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
2001 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2003 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2004 long ret_channel_points = (long)channel_points;
2005 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2007 return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, ret_channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
2009 static void LDKChannelKeys_JCalls_free(void* this_arg) {
2010 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2011 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2013 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2014 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2018 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
2019 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2020 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2021 return (void*) this_arg;
2023 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
2024 jclass c = (*env)->GetObjectClass(env, o);
2026 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
2027 atomic_init(&calls->refcnt, 1);
2028 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2029 calls->o = (*env)->NewWeakGlobalRef(env, o);
2030 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2031 CHECK(calls->get_per_commitment_point_meth != NULL);
2032 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2033 CHECK(calls->release_commitment_secret_meth != NULL);
2034 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
2035 CHECK(calls->key_derivation_params_meth != NULL);
2036 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJ[J)J");
2037 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2038 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
2039 CHECK(calls->sign_holder_commitment_meth != NULL);
2040 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
2041 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
2042 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
2043 CHECK(calls->sign_justice_transaction_meth != NULL);
2044 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
2045 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2046 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
2047 CHECK(calls->sign_closing_transaction_meth != NULL);
2048 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2049 CHECK(calls->sign_channel_announcement_meth != NULL);
2050 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
2051 CHECK(calls->on_accept_meth != NULL);
2053 LDKChannelPublicKeys pubkeys_conv;
2054 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2055 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2056 if (pubkeys_conv.inner != NULL)
2057 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2059 LDKChannelKeys ret = {
2060 .this_arg = (void*) calls,
2061 .get_per_commitment_point = get_per_commitment_point_jcall,
2062 .release_commitment_secret = release_commitment_secret_jcall,
2063 .key_derivation_params = key_derivation_params_jcall,
2064 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
2065 .sign_holder_commitment = sign_holder_commitment_jcall,
2066 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
2067 .sign_justice_transaction = sign_justice_transaction_jcall,
2068 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
2069 .sign_closing_transaction = sign_closing_transaction_jcall,
2070 .sign_channel_announcement = sign_channel_announcement_jcall,
2071 .on_accept = on_accept_jcall,
2072 .clone = LDKChannelKeys_JCalls_clone,
2073 .free = LDKChannelKeys_JCalls_free,
2074 .pubkeys = pubkeys_conv,
2075 .set_pubkeys = NULL,
2079 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
2080 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2081 *res_ptr = LDKChannelKeys_init(env, _a, o, pubkeys);
2082 return (long)res_ptr;
2084 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2085 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
2089 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2090 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2091 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2092 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2096 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2097 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2098 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2099 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2103 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
2104 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2105 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2106 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
2107 return (long)ret_ref;
2110 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) {
2111 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2112 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
2113 LDKPreCalculatedTxCreationKeys keys_conv;
2114 keys_conv.inner = (void*)(keys & (~1));
2115 keys_conv.is_owned = (keys & 1) || (keys == 0);
2116 LDKCVec_HTLCOutputInCommitmentZ htlcs_constr;
2117 htlcs_constr.datalen = (*_env)->GetArrayLength (_env, htlcs);
2118 if (htlcs_constr.datalen > 0)
2119 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
2121 htlcs_constr.data = NULL;
2122 long* htlcs_vals = (*_env)->GetLongArrayElements (_env, htlcs, NULL);
2123 for (size_t y = 0; y < htlcs_constr.datalen; y++) {
2124 long arr_conv_24 = htlcs_vals[y];
2125 LDKHTLCOutputInCommitment arr_conv_24_conv;
2126 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
2127 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
2128 if (arr_conv_24_conv.inner != NULL)
2129 arr_conv_24_conv = HTLCOutputInCommitment_clone(&arr_conv_24_conv);
2130 htlcs_constr.data[y] = arr_conv_24_conv;
2132 (*_env)->ReleaseLongArrayElements (_env, htlcs, htlcs_vals, 0);
2133 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2134 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_constr);
2135 return (long)ret_conv;
2138 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
2139 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2140 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2141 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2142 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
2143 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2144 *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2145 return (long)ret_conv;
2148 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) {
2149 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2150 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2151 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2152 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
2153 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
2154 *ret_conv = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2155 return (long)ret_conv;
2158 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) {
2159 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2160 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
2161 unsigned char per_commitment_key_arr[32];
2162 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
2163 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
2164 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2165 LDKHTLCOutputInCommitment htlc_conv;
2166 htlc_conv.inner = (void*)(htlc & (~1));
2167 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2168 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2169 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
2170 return (long)ret_conv;
2173 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) {
2174 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2175 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
2176 LDKPublicKey per_commitment_point_ref;
2177 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
2178 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2179 LDKHTLCOutputInCommitment htlc_conv;
2180 htlc_conv.inner = (void*)(htlc & (~1));
2181 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2182 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2183 *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);
2184 return (long)ret_conv;
2187 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) {
2188 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2189 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
2190 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2191 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv);
2192 return (long)ret_conv;
2195 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
2196 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2197 LDKUnsignedChannelAnnouncement msg_conv;
2198 msg_conv.inner = (void*)(msg & (~1));
2199 msg_conv.is_owned = (msg & 1) || (msg == 0);
2200 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2201 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2202 return (long)ret_conv;
2205 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) {
2206 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2207 LDKChannelPublicKeys channel_points_conv;
2208 channel_points_conv.inner = (void*)(channel_points & (~1));
2209 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2210 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2213 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
2214 if (this_arg->set_pubkeys != NULL)
2215 this_arg->set_pubkeys(this_arg);
2216 return this_arg->pubkeys;
2218 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
2219 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2220 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
2221 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2222 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2223 long ret_ref = (long)ret_var.inner;
2224 if (ret_var.is_owned) {
2230 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2231 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2232 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2233 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2234 for (size_t i = 0; i < vec->datalen; i++) {
2235 CHECK((((long)vec->data[i].inner) & 1) == 0);
2236 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2238 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2241 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2242 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2243 ret->datalen = (*env)->GetArrayLength(env, elems);
2244 if (ret->datalen == 0) {
2247 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2248 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2249 for (size_t i = 0; i < ret->datalen; i++) {
2250 jlong arr_elem = java_elems[i];
2251 LDKMonitorEvent arr_elem_conv;
2252 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2253 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2254 if (arr_elem_conv.inner != NULL)
2255 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
2256 ret->data[i] = arr_elem_conv;
2258 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2262 typedef struct LDKWatch_JCalls {
2263 atomic_size_t refcnt;
2266 jmethodID watch_channel_meth;
2267 jmethodID update_channel_meth;
2268 jmethodID release_pending_monitor_events_meth;
2270 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2271 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2273 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2274 LDKOutPoint funding_txo_var = funding_txo;
2275 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2276 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2277 long funding_txo_ref = (long)funding_txo_var.inner;
2278 if (funding_txo_var.is_owned) {
2279 funding_txo_ref |= 1;
2281 LDKChannelMonitor monitor_var = monitor;
2282 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2283 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2284 long monitor_ref = (long)monitor_var.inner;
2285 if (monitor_var.is_owned) {
2288 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2290 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2291 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2295 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2296 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2298 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2299 LDKOutPoint funding_txo_var = funding_txo;
2300 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2301 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2302 long funding_txo_ref = (long)funding_txo_var.inner;
2303 if (funding_txo_var.is_owned) {
2304 funding_txo_ref |= 1;
2306 LDKChannelMonitorUpdate update_var = update;
2307 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2308 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2309 long update_ref = (long)update_var.inner;
2310 if (update_var.is_owned) {
2313 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2315 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2316 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2320 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2321 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2323 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2324 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2326 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_pending_monitor_events_meth);
2327 LDKCVec_MonitorEventZ arg_constr;
2328 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
2329 if (arg_constr.datalen > 0)
2330 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2332 arg_constr.data = NULL;
2333 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
2334 for (size_t o = 0; o < arg_constr.datalen; o++) {
2335 long arr_conv_14 = arg_vals[o];
2336 LDKMonitorEvent arr_conv_14_conv;
2337 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2338 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2339 if (arr_conv_14_conv.inner != NULL)
2340 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2341 arg_constr.data[o] = arr_conv_14_conv;
2343 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
2346 static void LDKWatch_JCalls_free(void* this_arg) {
2347 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2348 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2350 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2351 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2355 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2356 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2357 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2358 return (void*) this_arg;
2360 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2361 jclass c = (*env)->GetObjectClass(env, o);
2363 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2364 atomic_init(&calls->refcnt, 1);
2365 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2366 calls->o = (*env)->NewWeakGlobalRef(env, o);
2367 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2368 CHECK(calls->watch_channel_meth != NULL);
2369 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2370 CHECK(calls->update_channel_meth != NULL);
2371 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2372 CHECK(calls->release_pending_monitor_events_meth != NULL);
2375 .this_arg = (void*) calls,
2376 .watch_channel = watch_channel_jcall,
2377 .update_channel = update_channel_jcall,
2378 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2379 .free = LDKWatch_JCalls_free,
2383 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2384 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2385 *res_ptr = LDKWatch_init(env, _a, o);
2386 return (long)res_ptr;
2388 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2389 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2393 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2394 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2395 LDKOutPoint funding_txo_conv;
2396 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2397 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2398 if (funding_txo_conv.inner != NULL)
2399 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2400 LDKChannelMonitor monitor_conv;
2401 monitor_conv.inner = (void*)(monitor & (~1));
2402 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2403 // Warning: we may need a move here but can't clone!
2404 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2405 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2406 return (long)ret_conv;
2409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2410 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2411 LDKOutPoint funding_txo_conv;
2412 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2413 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2414 if (funding_txo_conv.inner != NULL)
2415 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2416 LDKChannelMonitorUpdate update_conv;
2417 update_conv.inner = (void*)(update & (~1));
2418 update_conv.is_owned = (update & 1) || (update == 0);
2419 if (update_conv.inner != NULL)
2420 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2421 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2422 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2423 return (long)ret_conv;
2426 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2427 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2428 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2429 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
2430 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
2431 for (size_t o = 0; o < ret_var.datalen; o++) {
2432 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2433 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2434 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2435 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2436 if (arr_conv_14_var.is_owned) {
2437 arr_conv_14_ref |= 1;
2439 ret_arr_ptr[o] = arr_conv_14_ref;
2441 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
2446 typedef struct LDKFilter_JCalls {
2447 atomic_size_t refcnt;
2450 jmethodID register_tx_meth;
2451 jmethodID register_output_meth;
2453 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2454 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2456 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2457 jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
2458 (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
2459 LDKu8slice script_pubkey_var = script_pubkey;
2460 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2461 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2462 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2464 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2466 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2467 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2469 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2470 long ret_outpoint = (long)outpoint;
2471 LDKu8slice script_pubkey_var = script_pubkey;
2472 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2473 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2474 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2476 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, ret_outpoint, script_pubkey_arr);
2478 static void LDKFilter_JCalls_free(void* this_arg) {
2479 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2480 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2482 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2483 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2487 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2488 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2489 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2490 return (void*) this_arg;
2492 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2493 jclass c = (*env)->GetObjectClass(env, o);
2495 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2496 atomic_init(&calls->refcnt, 1);
2497 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2498 calls->o = (*env)->NewWeakGlobalRef(env, o);
2499 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2500 CHECK(calls->register_tx_meth != NULL);
2501 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2502 CHECK(calls->register_output_meth != NULL);
2505 .this_arg = (void*) calls,
2506 .register_tx = register_tx_jcall,
2507 .register_output = register_output_jcall,
2508 .free = LDKFilter_JCalls_free,
2512 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2513 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2514 *res_ptr = LDKFilter_init(env, _a, o);
2515 return (long)res_ptr;
2517 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2518 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2523 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2524 unsigned char txid_arr[32];
2525 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2526 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2527 unsigned char (*txid_ref)[32] = &txid_arr;
2528 LDKu8slice script_pubkey_ref;
2529 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2530 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2531 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2532 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2536 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2537 LDKOutPoint outpoint_conv;
2538 outpoint_conv.inner = (void*)(outpoint & (~1));
2539 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2540 LDKu8slice script_pubkey_ref;
2541 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2542 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2543 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2544 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2547 typedef struct LDKBroadcasterInterface_JCalls {
2548 atomic_size_t refcnt;
2551 jmethodID broadcast_transaction_meth;
2552 } LDKBroadcasterInterface_JCalls;
2553 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2554 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2556 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2557 LDKTransaction *tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
2559 long tx_ref = (long)tx_copy;
2560 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2562 return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2564 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2565 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2566 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2568 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2569 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2573 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2574 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2575 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2576 return (void*) this_arg;
2578 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2579 jclass c = (*env)->GetObjectClass(env, o);
2581 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2582 atomic_init(&calls->refcnt, 1);
2583 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2584 calls->o = (*env)->NewWeakGlobalRef(env, o);
2585 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2586 CHECK(calls->broadcast_transaction_meth != NULL);
2588 LDKBroadcasterInterface ret = {
2589 .this_arg = (void*) calls,
2590 .broadcast_transaction = broadcast_transaction_jcall,
2591 .free = LDKBroadcasterInterface_JCalls_free,
2595 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2596 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2597 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2598 return (long)res_ptr;
2600 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2601 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2606 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2607 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2608 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv);
2611 typedef struct LDKFeeEstimator_JCalls {
2612 atomic_size_t refcnt;
2615 jmethodID get_est_sat_per_1000_weight_meth;
2616 } LDKFeeEstimator_JCalls;
2617 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2618 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2620 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2621 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target);
2622 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2624 return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2626 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2627 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2628 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2630 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2631 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2635 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2636 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2637 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2638 return (void*) this_arg;
2640 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2641 jclass c = (*env)->GetObjectClass(env, o);
2643 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2644 atomic_init(&calls->refcnt, 1);
2645 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2646 calls->o = (*env)->NewWeakGlobalRef(env, o);
2647 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2648 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2650 LDKFeeEstimator ret = {
2651 .this_arg = (void*) calls,
2652 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2653 .free = LDKFeeEstimator_JCalls_free,
2657 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2658 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2659 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2660 return (long)res_ptr;
2662 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2663 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2667 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) {
2668 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2669 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2670 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2674 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2675 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2676 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2678 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2679 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2680 ret->datalen = (*env)->GetArrayLength(env, elems);
2681 if (ret->datalen == 0) {
2684 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2685 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2686 for (size_t i = 0; i < ret->datalen; i++) {
2687 jlong arr_elem = java_elems[i];
2688 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2689 FREE((void*)arr_elem);
2690 ret->data[i] = arr_elem_conv;
2692 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2696 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2697 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2698 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2700 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2701 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2702 ret->datalen = (*env)->GetArrayLength(env, elems);
2703 if (ret->datalen == 0) {
2706 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2707 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2708 for (size_t i = 0; i < ret->datalen; i++) {
2709 jlong arr_elem = java_elems[i];
2710 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2711 ret->data[i] = arr_elem_conv;
2713 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2717 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2718 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2719 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2721 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2722 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2723 ret->datalen = (*env)->GetArrayLength(env, elems);
2724 if (ret->datalen == 0) {
2727 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2728 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2729 for (size_t i = 0; i < ret->datalen; i++) {
2730 jlong arr_elem = java_elems[i];
2731 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2732 FREE((void*)arr_elem);
2733 ret->data[i] = arr_elem_conv;
2735 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2739 typedef struct LDKKeysInterface_JCalls {
2740 atomic_size_t refcnt;
2743 jmethodID get_node_secret_meth;
2744 jmethodID get_destination_script_meth;
2745 jmethodID get_shutdown_pubkey_meth;
2746 jmethodID get_channel_keys_meth;
2747 jmethodID get_secure_random_bytes_meth;
2748 } LDKKeysInterface_JCalls;
2749 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2750 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2752 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2753 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2755 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth);
2756 LDKSecretKey arg_ref;
2757 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2758 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
2761 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2762 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2764 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2765 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2767 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_destination_script_meth);
2768 LDKCVec_u8Z arg_ref;
2769 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
2770 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
2773 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2774 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2776 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2777 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2779 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_shutdown_pubkey_meth);
2780 LDKPublicKey arg_ref;
2781 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
2782 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
2785 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2786 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2788 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2789 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2791 LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2792 LDKChannelKeys ret_conv = *(LDKChannelKeys*)ret;
2793 if (ret_conv.free == LDKChannelKeys_JCalls_free) {
2794 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2795 LDKChannelKeys_JCalls_clone(ret_conv.this_arg);
2799 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2800 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2802 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2803 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2805 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth);
2806 LDKThirtyTwoBytes arg_ref;
2807 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2808 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
2811 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2812 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2813 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2815 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2816 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2820 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2821 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2822 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2823 return (void*) this_arg;
2825 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2826 jclass c = (*env)->GetObjectClass(env, o);
2828 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2829 atomic_init(&calls->refcnt, 1);
2830 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2831 calls->o = (*env)->NewWeakGlobalRef(env, o);
2832 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2833 CHECK(calls->get_node_secret_meth != NULL);
2834 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2835 CHECK(calls->get_destination_script_meth != NULL);
2836 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2837 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2838 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2839 CHECK(calls->get_channel_keys_meth != NULL);
2840 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2841 CHECK(calls->get_secure_random_bytes_meth != NULL);
2843 LDKKeysInterface ret = {
2844 .this_arg = (void*) calls,
2845 .get_node_secret = get_node_secret_jcall,
2846 .get_destination_script = get_destination_script_jcall,
2847 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2848 .get_channel_keys = get_channel_keys_jcall,
2849 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2850 .free = LDKKeysInterface_JCalls_free,
2854 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2855 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2856 *res_ptr = LDKKeysInterface_init(env, _a, o);
2857 return (long)res_ptr;
2859 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2860 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2864 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2865 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2866 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2867 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2871 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2872 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2873 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2874 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2875 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2876 CVec_u8Z_free(arg_var);
2880 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2881 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2882 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2883 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2887 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) {
2888 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2889 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2890 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2894 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2895 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2896 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2897 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2901 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2902 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2903 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2904 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2905 for (size_t i = 0; i < vec->datalen; i++) {
2906 CHECK((((long)vec->data[i].inner) & 1) == 0);
2907 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2909 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2912 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2913 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2914 ret->datalen = (*env)->GetArrayLength(env, elems);
2915 if (ret->datalen == 0) {
2918 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2919 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2920 for (size_t i = 0; i < ret->datalen; i++) {
2921 jlong arr_elem = java_elems[i];
2922 LDKChannelDetails arr_elem_conv;
2923 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2924 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2925 if (arr_elem_conv.inner != NULL)
2926 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2927 ret->data[i] = arr_elem_conv;
2929 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2933 static jclass LDKNetAddress_IPv4_class = NULL;
2934 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2935 static jclass LDKNetAddress_IPv6_class = NULL;
2936 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2937 static jclass LDKNetAddress_OnionV2_class = NULL;
2938 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2939 static jclass LDKNetAddress_OnionV3_class = NULL;
2940 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2942 LDKNetAddress_IPv4_class =
2943 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2944 CHECK(LDKNetAddress_IPv4_class != NULL);
2945 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2946 CHECK(LDKNetAddress_IPv4_meth != NULL);
2947 LDKNetAddress_IPv6_class =
2948 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2949 CHECK(LDKNetAddress_IPv6_class != NULL);
2950 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2951 CHECK(LDKNetAddress_IPv6_meth != NULL);
2952 LDKNetAddress_OnionV2_class =
2953 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2954 CHECK(LDKNetAddress_OnionV2_class != NULL);
2955 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2956 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2957 LDKNetAddress_OnionV3_class =
2958 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2959 CHECK(LDKNetAddress_OnionV3_class != NULL);
2960 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2961 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2963 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
2964 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2966 case LDKNetAddress_IPv4: {
2967 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 4);
2968 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 4, obj->i_pv4.addr.data);
2969 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
2971 case LDKNetAddress_IPv6: {
2972 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 16);
2973 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 16, obj->i_pv6.addr.data);
2974 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
2976 case LDKNetAddress_OnionV2: {
2977 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 10);
2978 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 10, obj->onion_v2.addr.data);
2979 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
2981 case LDKNetAddress_OnionV3: {
2982 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
2983 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2984 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);
2989 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2990 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2991 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2993 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2994 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2995 ret->datalen = (*env)->GetArrayLength(env, elems);
2996 if (ret->datalen == 0) {
2999 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
3000 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3001 for (size_t i = 0; i < ret->datalen; i++) {
3002 jlong arr_elem = java_elems[i];
3003 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
3004 FREE((void*)arr_elem);
3005 ret->data[i] = arr_elem_conv;
3007 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3011 typedef struct LDKChannelMessageHandler_JCalls {
3012 atomic_size_t refcnt;
3015 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
3016 jmethodID handle_open_channel_meth;
3017 jmethodID handle_accept_channel_meth;
3018 jmethodID handle_funding_created_meth;
3019 jmethodID handle_funding_signed_meth;
3020 jmethodID handle_funding_locked_meth;
3021 jmethodID handle_shutdown_meth;
3022 jmethodID handle_closing_signed_meth;
3023 jmethodID handle_update_add_htlc_meth;
3024 jmethodID handle_update_fulfill_htlc_meth;
3025 jmethodID handle_update_fail_htlc_meth;
3026 jmethodID handle_update_fail_malformed_htlc_meth;
3027 jmethodID handle_commitment_signed_meth;
3028 jmethodID handle_revoke_and_ack_meth;
3029 jmethodID handle_update_fee_meth;
3030 jmethodID handle_announcement_signatures_meth;
3031 jmethodID peer_disconnected_meth;
3032 jmethodID peer_connected_meth;
3033 jmethodID handle_channel_reestablish_meth;
3034 jmethodID handle_error_meth;
3035 } LDKChannelMessageHandler_JCalls;
3036 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
3037 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3039 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3040 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3041 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3042 LDKInitFeatures their_features_var = their_features;
3043 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3044 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3045 long their_features_ref = (long)their_features_var.inner;
3046 if (their_features_var.is_owned) {
3047 their_features_ref |= 1;
3049 long ret_msg = (long)msg;
3050 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3052 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, ret_msg);
3054 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
3055 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3057 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3058 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3059 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3060 LDKInitFeatures their_features_var = their_features;
3061 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3062 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3063 long their_features_ref = (long)their_features_var.inner;
3064 if (their_features_var.is_owned) {
3065 their_features_ref |= 1;
3067 long ret_msg = (long)msg;
3068 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3070 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, ret_msg);
3072 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
3073 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3075 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3076 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3077 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3078 long ret_msg = (long)msg;
3079 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3081 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, ret_msg);
3083 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
3084 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3086 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3087 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3088 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3089 long ret_msg = (long)msg;
3090 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3092 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, ret_msg);
3094 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
3095 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3097 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3098 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3099 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3100 long ret_msg = (long)msg;
3101 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3103 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, ret_msg);
3105 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
3106 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3108 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3109 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3110 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3111 long ret_msg = (long)msg;
3112 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3114 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, ret_msg);
3116 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
3117 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3119 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3120 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3121 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3122 long ret_msg = (long)msg;
3123 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3125 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, ret_msg);
3127 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
3128 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3130 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3131 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3132 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3133 long ret_msg = (long)msg;
3134 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3136 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, ret_msg);
3138 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *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 long ret_msg = (long)msg;
3145 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3147 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, ret_msg);
3149 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
3150 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3152 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3153 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3154 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3155 long ret_msg = (long)msg;
3156 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3158 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, ret_msg);
3160 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
3161 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3163 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3164 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3165 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3166 long ret_msg = (long)msg;
3167 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3169 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, ret_msg);
3171 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
3172 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3174 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3175 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3176 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3177 long ret_msg = (long)msg;
3178 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3180 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, ret_msg);
3182 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
3183 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3185 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3186 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3187 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3188 long ret_msg = (long)msg;
3189 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3191 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, ret_msg);
3193 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
3194 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3196 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3197 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3198 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3199 long ret_msg = (long)msg;
3200 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3202 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, ret_msg);
3204 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
3205 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3207 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3208 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3209 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3210 long ret_msg = (long)msg;
3211 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3213 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, ret_msg);
3215 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3216 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3218 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3219 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3220 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3221 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3223 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
3225 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
3226 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3228 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3229 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3230 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3231 long ret_msg = (long)msg;
3232 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3234 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, ret_msg);
3236 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3237 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3239 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3240 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3241 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3242 long ret_msg = (long)msg;
3243 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3245 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, ret_msg);
3247 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
3248 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3250 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3251 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3252 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3253 long ret_msg = (long)msg;
3254 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3256 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, ret_msg);
3258 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3259 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3260 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3262 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3263 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3267 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3268 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3269 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3270 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3271 return (void*) this_arg;
3273 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3274 jclass c = (*env)->GetObjectClass(env, o);
3276 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3277 atomic_init(&calls->refcnt, 1);
3278 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3279 calls->o = (*env)->NewWeakGlobalRef(env, o);
3280 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3281 CHECK(calls->handle_open_channel_meth != NULL);
3282 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3283 CHECK(calls->handle_accept_channel_meth != NULL);
3284 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3285 CHECK(calls->handle_funding_created_meth != NULL);
3286 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3287 CHECK(calls->handle_funding_signed_meth != NULL);
3288 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3289 CHECK(calls->handle_funding_locked_meth != NULL);
3290 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3291 CHECK(calls->handle_shutdown_meth != NULL);
3292 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3293 CHECK(calls->handle_closing_signed_meth != NULL);
3294 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3295 CHECK(calls->handle_update_add_htlc_meth != NULL);
3296 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3297 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3298 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3299 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3300 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3301 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3302 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3303 CHECK(calls->handle_commitment_signed_meth != NULL);
3304 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3305 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3306 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3307 CHECK(calls->handle_update_fee_meth != NULL);
3308 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3309 CHECK(calls->handle_announcement_signatures_meth != NULL);
3310 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3311 CHECK(calls->peer_disconnected_meth != NULL);
3312 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3313 CHECK(calls->peer_connected_meth != NULL);
3314 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3315 CHECK(calls->handle_channel_reestablish_meth != NULL);
3316 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3317 CHECK(calls->handle_error_meth != NULL);
3319 LDKChannelMessageHandler ret = {
3320 .this_arg = (void*) calls,
3321 .handle_open_channel = handle_open_channel_jcall,
3322 .handle_accept_channel = handle_accept_channel_jcall,
3323 .handle_funding_created = handle_funding_created_jcall,
3324 .handle_funding_signed = handle_funding_signed_jcall,
3325 .handle_funding_locked = handle_funding_locked_jcall,
3326 .handle_shutdown = handle_shutdown_jcall,
3327 .handle_closing_signed = handle_closing_signed_jcall,
3328 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3329 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3330 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3331 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3332 .handle_commitment_signed = handle_commitment_signed_jcall,
3333 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3334 .handle_update_fee = handle_update_fee_jcall,
3335 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3336 .peer_disconnected = peer_disconnected_jcall,
3337 .peer_connected = peer_connected_jcall,
3338 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3339 .handle_error = handle_error_jcall,
3340 .free = LDKChannelMessageHandler_JCalls_free,
3341 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3343 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3346 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3347 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3348 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3349 return (long)res_ptr;
3351 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3352 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3356 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) {
3357 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3358 LDKPublicKey their_node_id_ref;
3359 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3360 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3361 LDKInitFeatures their_features_conv;
3362 their_features_conv.inner = (void*)(their_features & (~1));
3363 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3364 // Warning: we may need a move here but can't clone!
3365 LDKOpenChannel msg_conv;
3366 msg_conv.inner = (void*)(msg & (~1));
3367 msg_conv.is_owned = (msg & 1) || (msg == 0);
3368 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3371 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) {
3372 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3373 LDKPublicKey their_node_id_ref;
3374 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3375 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3376 LDKInitFeatures their_features_conv;
3377 their_features_conv.inner = (void*)(their_features & (~1));
3378 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3379 // Warning: we may need a move here but can't clone!
3380 LDKAcceptChannel msg_conv;
3381 msg_conv.inner = (void*)(msg & (~1));
3382 msg_conv.is_owned = (msg & 1) || (msg == 0);
3383 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3386 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) {
3387 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3388 LDKPublicKey their_node_id_ref;
3389 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3390 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3391 LDKFundingCreated msg_conv;
3392 msg_conv.inner = (void*)(msg & (~1));
3393 msg_conv.is_owned = (msg & 1) || (msg == 0);
3394 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3397 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) {
3398 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3399 LDKPublicKey their_node_id_ref;
3400 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3401 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3402 LDKFundingSigned msg_conv;
3403 msg_conv.inner = (void*)(msg & (~1));
3404 msg_conv.is_owned = (msg & 1) || (msg == 0);
3405 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3408 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) {
3409 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3410 LDKPublicKey their_node_id_ref;
3411 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3412 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3413 LDKFundingLocked msg_conv;
3414 msg_conv.inner = (void*)(msg & (~1));
3415 msg_conv.is_owned = (msg & 1) || (msg == 0);
3416 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3420 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3421 LDKPublicKey their_node_id_ref;
3422 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3423 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3424 LDKShutdown msg_conv;
3425 msg_conv.inner = (void*)(msg & (~1));
3426 msg_conv.is_owned = (msg & 1) || (msg == 0);
3427 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3430 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) {
3431 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3432 LDKPublicKey their_node_id_ref;
3433 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3434 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3435 LDKClosingSigned msg_conv;
3436 msg_conv.inner = (void*)(msg & (~1));
3437 msg_conv.is_owned = (msg & 1) || (msg == 0);
3438 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3441 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) {
3442 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3443 LDKPublicKey their_node_id_ref;
3444 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3445 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3446 LDKUpdateAddHTLC msg_conv;
3447 msg_conv.inner = (void*)(msg & (~1));
3448 msg_conv.is_owned = (msg & 1) || (msg == 0);
3449 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3452 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) {
3453 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3454 LDKPublicKey their_node_id_ref;
3455 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3456 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3457 LDKUpdateFulfillHTLC msg_conv;
3458 msg_conv.inner = (void*)(msg & (~1));
3459 msg_conv.is_owned = (msg & 1) || (msg == 0);
3460 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3463 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) {
3464 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3465 LDKPublicKey their_node_id_ref;
3466 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3467 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3468 LDKUpdateFailHTLC msg_conv;
3469 msg_conv.inner = (void*)(msg & (~1));
3470 msg_conv.is_owned = (msg & 1) || (msg == 0);
3471 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3474 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) {
3475 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3476 LDKPublicKey their_node_id_ref;
3477 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3478 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3479 LDKUpdateFailMalformedHTLC msg_conv;
3480 msg_conv.inner = (void*)(msg & (~1));
3481 msg_conv.is_owned = (msg & 1) || (msg == 0);
3482 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3485 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) {
3486 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3487 LDKPublicKey their_node_id_ref;
3488 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3489 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3490 LDKCommitmentSigned msg_conv;
3491 msg_conv.inner = (void*)(msg & (~1));
3492 msg_conv.is_owned = (msg & 1) || (msg == 0);
3493 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3496 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) {
3497 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3498 LDKPublicKey their_node_id_ref;
3499 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3500 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3501 LDKRevokeAndACK msg_conv;
3502 msg_conv.inner = (void*)(msg & (~1));
3503 msg_conv.is_owned = (msg & 1) || (msg == 0);
3504 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3507 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) {
3508 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3509 LDKPublicKey their_node_id_ref;
3510 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3511 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3512 LDKUpdateFee msg_conv;
3513 msg_conv.inner = (void*)(msg & (~1));
3514 msg_conv.is_owned = (msg & 1) || (msg == 0);
3515 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3518 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) {
3519 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3520 LDKPublicKey their_node_id_ref;
3521 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3522 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3523 LDKAnnouncementSignatures msg_conv;
3524 msg_conv.inner = (void*)(msg & (~1));
3525 msg_conv.is_owned = (msg & 1) || (msg == 0);
3526 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3529 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) {
3530 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3531 LDKPublicKey their_node_id_ref;
3532 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3533 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3534 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3538 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3539 LDKPublicKey their_node_id_ref;
3540 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3541 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3543 msg_conv.inner = (void*)(msg & (~1));
3544 msg_conv.is_owned = (msg & 1) || (msg == 0);
3545 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3548 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) {
3549 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3550 LDKPublicKey their_node_id_ref;
3551 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3552 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3553 LDKChannelReestablish msg_conv;
3554 msg_conv.inner = (void*)(msg & (~1));
3555 msg_conv.is_owned = (msg & 1) || (msg == 0);
3556 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3560 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3561 LDKPublicKey their_node_id_ref;
3562 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3563 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3564 LDKErrorMessage msg_conv;
3565 msg_conv.inner = (void*)(msg & (~1));
3566 msg_conv.is_owned = (msg & 1) || (msg == 0);
3567 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3570 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3571 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3572 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3573 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3574 for (size_t i = 0; i < vec->datalen; i++) {
3575 CHECK((((long)vec->data[i].inner) & 1) == 0);
3576 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3578 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3581 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3582 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3583 ret->datalen = (*env)->GetArrayLength(env, elems);
3584 if (ret->datalen == 0) {
3587 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3588 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3589 for (size_t i = 0; i < ret->datalen; i++) {
3590 jlong arr_elem = java_elems[i];
3591 LDKChannelMonitor arr_elem_conv;
3592 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3593 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3594 // Warning: we may need a move here but can't clone!
3595 ret->data[i] = arr_elem_conv;
3597 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3601 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3602 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3603 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3605 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3606 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3607 ret->datalen = (*env)->GetArrayLength(env, elems);
3608 if (ret->datalen == 0) {
3611 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3612 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3613 for (size_t i = 0; i < ret->datalen; i++) {
3614 ret->data[i] = java_elems[i];
3616 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3620 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3621 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3622 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3623 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3624 for (size_t i = 0; i < vec->datalen; i++) {
3625 CHECK((((long)vec->data[i].inner) & 1) == 0);
3626 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3628 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3631 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3632 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3633 ret->datalen = (*env)->GetArrayLength(env, elems);
3634 if (ret->datalen == 0) {
3637 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3638 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3639 for (size_t i = 0; i < ret->datalen; i++) {
3640 jlong arr_elem = java_elems[i];
3641 LDKUpdateAddHTLC arr_elem_conv;
3642 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3643 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3644 if (arr_elem_conv.inner != NULL)
3645 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3646 ret->data[i] = arr_elem_conv;
3648 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3652 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3653 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3654 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3655 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3656 for (size_t i = 0; i < vec->datalen; i++) {
3657 CHECK((((long)vec->data[i].inner) & 1) == 0);
3658 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3660 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3663 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3664 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3665 ret->datalen = (*env)->GetArrayLength(env, elems);
3666 if (ret->datalen == 0) {
3669 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3670 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3671 for (size_t i = 0; i < ret->datalen; i++) {
3672 jlong arr_elem = java_elems[i];
3673 LDKUpdateFulfillHTLC arr_elem_conv;
3674 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3675 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3676 if (arr_elem_conv.inner != NULL)
3677 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3678 ret->data[i] = arr_elem_conv;
3680 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3684 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3685 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3686 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3687 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3688 for (size_t i = 0; i < vec->datalen; i++) {
3689 CHECK((((long)vec->data[i].inner) & 1) == 0);
3690 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3692 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3695 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3696 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3697 ret->datalen = (*env)->GetArrayLength(env, elems);
3698 if (ret->datalen == 0) {
3701 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3702 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3703 for (size_t i = 0; i < ret->datalen; i++) {
3704 jlong arr_elem = java_elems[i];
3705 LDKUpdateFailHTLC arr_elem_conv;
3706 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3707 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3708 if (arr_elem_conv.inner != NULL)
3709 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3710 ret->data[i] = arr_elem_conv;
3712 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3716 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3717 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3718 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3719 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3720 for (size_t i = 0; i < vec->datalen; i++) {
3721 CHECK((((long)vec->data[i].inner) & 1) == 0);
3722 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3724 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3727 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3728 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3729 ret->datalen = (*env)->GetArrayLength(env, elems);
3730 if (ret->datalen == 0) {
3733 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3734 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3735 for (size_t i = 0; i < ret->datalen; i++) {
3736 jlong arr_elem = java_elems[i];
3737 LDKUpdateFailMalformedHTLC arr_elem_conv;
3738 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3739 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3740 if (arr_elem_conv.inner != NULL)
3741 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3742 ret->data[i] = arr_elem_conv;
3744 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3749 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3752 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3753 CHECK(val->result_ok);
3754 return *val->contents.result;
3756 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3757 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3758 CHECK(!val->result_ok);
3759 LDKLightningError err_var = (*val->contents.err);
3760 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3761 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3762 long err_ref = (long)err_var.inner & ~1;
3765 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3766 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3767 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3769 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3770 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3771 ret->datalen = (*env)->GetArrayLength(env, elems);
3772 if (ret->datalen == 0) {
3775 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3776 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3777 for (size_t i = 0; i < ret->datalen; i++) {
3778 jlong arr_elem = java_elems[i];
3779 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3780 FREE((void*)arr_elem);
3781 ret->data[i] = arr_elem_conv;
3783 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3787 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3788 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3789 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3790 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3791 for (size_t i = 0; i < vec->datalen; i++) {
3792 CHECK((((long)vec->data[i].inner) & 1) == 0);
3793 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3795 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3798 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3799 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3800 ret->datalen = (*env)->GetArrayLength(env, elems);
3801 if (ret->datalen == 0) {
3804 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3805 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3806 for (size_t i = 0; i < ret->datalen; i++) {
3807 jlong arr_elem = java_elems[i];
3808 LDKNodeAnnouncement arr_elem_conv;
3809 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3810 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3811 if (arr_elem_conv.inner != NULL)
3812 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3813 ret->data[i] = arr_elem_conv;
3815 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3819 typedef struct LDKRoutingMessageHandler_JCalls {
3820 atomic_size_t refcnt;
3823 jmethodID handle_node_announcement_meth;
3824 jmethodID handle_channel_announcement_meth;
3825 jmethodID handle_channel_update_meth;
3826 jmethodID handle_htlc_fail_channel_update_meth;
3827 jmethodID get_next_channel_announcements_meth;
3828 jmethodID get_next_node_announcements_meth;
3829 jmethodID should_request_full_sync_meth;
3830 } LDKRoutingMessageHandler_JCalls;
3831 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3832 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3834 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3835 long ret_msg = (long)msg;
3836 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3838 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, ret_msg);
3839 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
3843 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3844 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3846 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3847 long ret_msg = (long)msg;
3848 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3850 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, ret_msg);
3851 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
3855 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3856 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3858 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3859 long ret_msg = (long)msg;
3860 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3862 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, ret_msg);
3863 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
3867 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3868 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3870 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3871 long ret_update = (long)update;
3872 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3874 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
3876 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3877 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3879 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3880 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3882 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3883 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
3884 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
3885 if (arg_constr.datalen > 0)
3886 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
3888 arg_constr.data = NULL;
3889 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
3890 for (size_t l = 0; l < arg_constr.datalen; l++) {
3891 long arr_conv_63 = arg_vals[l];
3892 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
3893 FREE((void*)arr_conv_63);
3894 arg_constr.data[l] = arr_conv_63_conv;
3896 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
3899 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3900 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3902 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3903 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
3904 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
3905 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3907 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3908 LDKCVec_NodeAnnouncementZ arg_constr;
3909 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
3910 if (arg_constr.datalen > 0)
3911 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
3913 arg_constr.data = NULL;
3914 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
3915 for (size_t s = 0; s < arg_constr.datalen; s++) {
3916 long arr_conv_18 = arg_vals[s];
3917 LDKNodeAnnouncement arr_conv_18_conv;
3918 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
3919 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
3920 if (arr_conv_18_conv.inner != NULL)
3921 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
3922 arg_constr.data[s] = arr_conv_18_conv;
3924 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
3927 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3928 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3930 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3931 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
3932 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form);
3933 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3935 return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3937 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3938 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3939 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3941 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3942 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3946 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3947 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3948 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3949 return (void*) this_arg;
3951 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3952 jclass c = (*env)->GetObjectClass(env, o);
3954 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3955 atomic_init(&calls->refcnt, 1);
3956 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3957 calls->o = (*env)->NewWeakGlobalRef(env, o);
3958 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3959 CHECK(calls->handle_node_announcement_meth != NULL);
3960 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3961 CHECK(calls->handle_channel_announcement_meth != NULL);
3962 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3963 CHECK(calls->handle_channel_update_meth != NULL);
3964 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3965 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
3966 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
3967 CHECK(calls->get_next_channel_announcements_meth != NULL);
3968 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
3969 CHECK(calls->get_next_node_announcements_meth != NULL);
3970 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3971 CHECK(calls->should_request_full_sync_meth != NULL);
3973 LDKRoutingMessageHandler ret = {
3974 .this_arg = (void*) calls,
3975 .handle_node_announcement = handle_node_announcement_jcall,
3976 .handle_channel_announcement = handle_channel_announcement_jcall,
3977 .handle_channel_update = handle_channel_update_jcall,
3978 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3979 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3980 .get_next_node_announcements = get_next_node_announcements_jcall,
3981 .should_request_full_sync = should_request_full_sync_jcall,
3982 .free = LDKRoutingMessageHandler_JCalls_free,
3986 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3987 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3988 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3989 return (long)res_ptr;
3991 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3992 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3996 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3997 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3998 LDKNodeAnnouncement msg_conv;
3999 msg_conv.inner = (void*)(msg & (~1));
4000 msg_conv.is_owned = (msg & 1) || (msg == 0);
4001 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4002 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
4003 return (long)ret_conv;
4006 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4007 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4008 LDKChannelAnnouncement msg_conv;
4009 msg_conv.inner = (void*)(msg & (~1));
4010 msg_conv.is_owned = (msg & 1) || (msg == 0);
4011 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4012 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4013 return (long)ret_conv;
4016 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4017 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4018 LDKChannelUpdate msg_conv;
4019 msg_conv.inner = (void*)(msg & (~1));
4020 msg_conv.is_owned = (msg & 1) || (msg == 0);
4021 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4022 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
4023 return (long)ret_conv;
4026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
4027 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4028 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
4029 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
4032 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) {
4033 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4034 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
4035 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
4036 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
4037 for (size_t l = 0; l < ret_var.datalen; l++) {
4038 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4039 *arr_conv_63_ref = ret_var.data[l];
4040 ret_arr_ptr[l] = (long)arr_conv_63_ref;
4042 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4043 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(ret_var);
4047 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) {
4048 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4049 LDKPublicKey starting_point_ref;
4050 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
4051 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
4052 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
4053 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
4054 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
4055 for (size_t s = 0; s < ret_var.datalen; s++) {
4056 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
4057 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4058 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4059 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
4060 if (arr_conv_18_var.is_owned) {
4061 arr_conv_18_ref |= 1;
4063 ret_arr_ptr[s] = arr_conv_18_ref;
4065 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4070 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
4071 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4072 LDKPublicKey node_id_ref;
4073 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
4074 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
4075 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
4079 typedef struct LDKSocketDescriptor_JCalls {
4080 atomic_size_t refcnt;
4083 jmethodID send_data_meth;
4084 jmethodID disconnect_socket_meth;
4086 jmethodID hash_meth;
4087 } LDKSocketDescriptor_JCalls;
4088 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
4089 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4091 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4092 LDKu8slice data_var = data;
4093 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
4094 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
4095 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4097 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
4099 void disconnect_socket_jcall(void* this_arg) {
4100 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4102 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4103 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4105 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
4107 bool eq_jcall(const void* this_arg, const void *other_arg) {
4108 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4110 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4111 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4113 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, other_arg);
4115 uint64_t hash_jcall(const void* this_arg) {
4116 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4118 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4119 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4121 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
4123 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
4124 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4125 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4127 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4128 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4132 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
4133 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4134 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4135 return (void*) this_arg;
4137 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
4138 jclass c = (*env)->GetObjectClass(env, o);
4140 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
4141 atomic_init(&calls->refcnt, 1);
4142 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4143 calls->o = (*env)->NewWeakGlobalRef(env, o);
4144 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
4145 CHECK(calls->send_data_meth != NULL);
4146 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
4147 CHECK(calls->disconnect_socket_meth != NULL);
4148 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
4149 CHECK(calls->eq_meth != NULL);
4150 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
4151 CHECK(calls->hash_meth != NULL);
4153 LDKSocketDescriptor ret = {
4154 .this_arg = (void*) calls,
4155 .send_data = send_data_jcall,
4156 .disconnect_socket = disconnect_socket_jcall,
4159 .clone = LDKSocketDescriptor_JCalls_clone,
4160 .free = LDKSocketDescriptor_JCalls_free,
4164 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
4165 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4166 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
4167 return (long)res_ptr;
4169 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4170 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
4174 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
4175 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4176 LDKu8slice data_ref;
4177 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
4178 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
4179 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4180 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
4184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
4185 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4186 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4189 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
4190 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4191 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4195 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4196 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
4197 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
4199 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4200 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4202 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4203 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4204 CHECK(val->result_ok);
4205 LDKCVecTempl_u8 res_var = (*val->contents.result);
4206 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
4207 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
4210 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4211 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4212 CHECK(!val->result_ok);
4213 LDKPeerHandleError err_var = (*val->contents.err);
4214 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4215 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4216 long err_ref = (long)err_var.inner & ~1;
4219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4220 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4223 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4224 CHECK(val->result_ok);
4225 return *val->contents.result;
4227 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4228 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4229 CHECK(!val->result_ok);
4230 LDKPeerHandleError err_var = (*val->contents.err);
4231 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4232 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4233 long err_ref = (long)err_var.inner & ~1;
4236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4237 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
4239 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4240 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4241 CHECK(val->result_ok);
4242 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
4243 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
4246 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4247 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4248 CHECK(!val->result_ok);
4249 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4252 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4253 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
4255 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4256 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4257 CHECK(val->result_ok);
4258 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
4259 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
4262 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4263 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4264 CHECK(!val->result_ok);
4265 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4269 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
4271 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4272 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4273 CHECK(val->result_ok);
4274 LDKTxCreationKeys res_var = (*val->contents.result);
4275 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4276 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4277 long res_ref = (long)res_var.inner & ~1;
4280 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4281 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4282 CHECK(!val->result_ok);
4283 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4286 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4287 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4288 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4290 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4291 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4292 ret->datalen = (*env)->GetArrayLength(env, elems);
4293 if (ret->datalen == 0) {
4296 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4297 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4298 for (size_t i = 0; i < ret->datalen; i++) {
4299 jlong arr_elem = java_elems[i];
4300 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4301 FREE((void*)arr_elem);
4302 ret->data[i] = arr_elem_conv;
4304 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4308 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4309 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4310 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4311 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4312 for (size_t i = 0; i < vec->datalen; i++) {
4313 CHECK((((long)vec->data[i].inner) & 1) == 0);
4314 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4316 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4319 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4320 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4321 ret->datalen = (*env)->GetArrayLength(env, elems);
4322 if (ret->datalen == 0) {
4325 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4326 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4327 for (size_t i = 0; i < ret->datalen; i++) {
4328 jlong arr_elem = java_elems[i];
4329 LDKRouteHop arr_elem_conv;
4330 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4331 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4332 if (arr_elem_conv.inner != NULL)
4333 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4334 ret->data[i] = arr_elem_conv;
4336 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4340 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4341 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4342 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4345 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4347 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4348 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4349 CHECK(val->result_ok);
4350 LDKRoute res_var = (*val->contents.result);
4351 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4352 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4353 long res_ref = (long)res_var.inner & ~1;
4356 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4357 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4358 CHECK(!val->result_ok);
4359 LDKLightningError err_var = (*val->contents.err);
4360 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4361 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4362 long err_ref = (long)err_var.inner & ~1;
4365 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4366 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4367 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4368 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4369 for (size_t i = 0; i < vec->datalen; i++) {
4370 CHECK((((long)vec->data[i].inner) & 1) == 0);
4371 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4373 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4376 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4377 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4378 ret->datalen = (*env)->GetArrayLength(env, elems);
4379 if (ret->datalen == 0) {
4382 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4383 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4384 for (size_t i = 0; i < ret->datalen; i++) {
4385 jlong arr_elem = java_elems[i];
4386 LDKRouteHint arr_elem_conv;
4387 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4388 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4389 if (arr_elem_conv.inner != NULL)
4390 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4391 ret->data[i] = arr_elem_conv;
4393 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4398 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4400 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4404 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4406 C2Tuple_OutPointScriptZ_free(arg_conv);
4409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4410 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4412 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4416 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4418 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4422 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4424 C2Tuple_u64u64Z_free(arg_conv);
4427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4428 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4430 C2Tuple_usizeTransactionZ_free(arg_conv);
4433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4434 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4436 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4440 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4442 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4445 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4446 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4448 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4449 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4450 return (long)ret_conv;
4453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4454 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4456 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray arg) {
4460 LDKCVec_SignatureZ arg_constr;
4461 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4462 if (arg_constr.datalen > 0)
4463 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4465 arg_constr.data = NULL;
4466 for (size_t i = 0; i < arg_constr.datalen; i++) {
4467 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4468 LDKSignature arr_conv_8_ref;
4469 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4470 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4471 arg_constr.data[i] = arr_conv_8_ref;
4473 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4474 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(arg_constr);
4475 return (long)ret_conv;
4478 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4479 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4481 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4482 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4483 return (long)ret_conv;
4486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4487 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4489 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4492 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4493 LDKCVec_u8Z arg_ref;
4494 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
4495 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4496 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4497 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4498 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
4499 return (long)ret_conv;
4502 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4503 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4505 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4506 *ret_conv = CResult_NoneAPIErrorZ_err(arg_conv);
4507 return (long)ret_conv;
4510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4511 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4513 CResult_NoneAPIErrorZ_free(arg_conv);
4516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4517 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4519 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4520 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4521 return (long)ret_conv;
4524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4525 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4527 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4530 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4531 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4533 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4534 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4535 return (long)ret_conv;
4538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4539 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4541 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4544 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4545 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4547 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4548 *ret_conv = CResult_NonePaymentSendFailureZ_err(arg_conv);
4549 return (long)ret_conv;
4552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4553 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4555 CResult_NonePaymentSendFailureZ_free(arg_conv);
4558 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4559 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4561 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4562 *ret_conv = CResult_NonePeerHandleErrorZ_err(arg_conv);
4563 return (long)ret_conv;
4566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4567 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4569 CResult_NonePeerHandleErrorZ_free(arg_conv);
4572 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4573 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4575 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4576 *ret_conv = CResult_PublicKeySecpErrorZ_err(arg_conv);
4577 return (long)ret_conv;
4580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4581 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4583 CResult_PublicKeySecpErrorZ_free(arg_conv);
4586 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4587 LDKPublicKey arg_ref;
4588 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4589 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4590 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4591 *ret_conv = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4592 return (long)ret_conv;
4595 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4596 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4598 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4599 *ret_conv = CResult_RouteLightningErrorZ_err(arg_conv);
4600 return (long)ret_conv;
4603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4604 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4606 CResult_RouteLightningErrorZ_free(arg_conv);
4609 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4610 LDKRoute arg_conv = *(LDKRoute*)arg;
4612 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4613 *ret_conv = CResult_RouteLightningErrorZ_ok(arg_conv);
4614 return (long)ret_conv;
4617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4618 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4620 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4621 *ret_conv = CResult_SecretKeySecpErrorZ_err(arg_conv);
4622 return (long)ret_conv;
4625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4626 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4628 CResult_SecretKeySecpErrorZ_free(arg_conv);
4631 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4632 LDKSecretKey arg_ref;
4633 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4634 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4635 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4636 *ret_conv = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4637 return (long)ret_conv;
4640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4641 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4643 CResult_SignatureNoneZ_free(arg_conv);
4646 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4647 LDKSignature arg_ref;
4648 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4649 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4650 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4651 *ret_conv = CResult_SignatureNoneZ_ok(arg_ref);
4652 return (long)ret_conv;
4655 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4656 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4658 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4659 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4660 return (long)ret_conv;
4663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4664 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4666 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4669 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4670 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4672 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4673 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4674 return (long)ret_conv;
4677 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4678 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4680 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4681 *ret_conv = CResult_TxOutAccessErrorZ_err(arg_conv);
4682 return (long)ret_conv;
4685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4686 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4688 CResult_TxOutAccessErrorZ_free(arg_conv);
4691 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4692 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4694 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4695 *ret_conv = CResult_TxOutAccessErrorZ_ok(arg_conv);
4696 return (long)ret_conv;
4699 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4700 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4702 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4703 *ret_conv = CResult_boolLightningErrorZ_err(arg_conv);
4704 return (long)ret_conv;
4707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4708 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4710 CResult_boolLightningErrorZ_free(arg_conv);
4713 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4714 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4715 *ret_conv = CResult_boolLightningErrorZ_ok(arg);
4716 return (long)ret_conv;
4719 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4720 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4722 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4723 *ret_conv = CResult_boolPeerHandleErrorZ_err(arg_conv);
4724 return (long)ret_conv;
4727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4728 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4730 CResult_boolPeerHandleErrorZ_free(arg_conv);
4733 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4734 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4735 *ret_conv = CResult_boolPeerHandleErrorZ_ok(arg);
4736 return (long)ret_conv;
4739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4740 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_constr;
4741 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4742 if (arg_constr.datalen > 0)
4743 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
4745 arg_constr.data = NULL;
4746 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4747 for (size_t q = 0; q < arg_constr.datalen; q++) {
4748 long arr_conv_42 = arg_vals[q];
4749 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
4750 FREE((void*)arr_conv_42);
4751 arg_constr.data[q] = arr_conv_42_conv;
4753 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4754 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_constr);
4757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4758 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_constr;
4759 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4760 if (arg_constr.datalen > 0)
4761 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ Elements");
4763 arg_constr.data = NULL;
4764 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4765 for (size_t b = 0; b < arg_constr.datalen; b++) {
4766 long arr_conv_27 = arg_vals[b];
4767 LDKC2Tuple_TxidCVec_TxOutZZ arr_conv_27_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arr_conv_27;
4768 FREE((void*)arr_conv_27);
4769 arg_constr.data[b] = arr_conv_27_conv;
4771 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4772 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_constr);
4775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4776 LDKCVec_C2Tuple_usizeTransactionZZ arg_constr;
4777 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4778 if (arg_constr.datalen > 0)
4779 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
4781 arg_constr.data = NULL;
4782 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4783 for (size_t d = 0; d < arg_constr.datalen; d++) {
4784 long arr_conv_29 = arg_vals[d];
4785 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
4786 FREE((void*)arr_conv_29);
4787 arg_constr.data[d] = arr_conv_29_conv;
4789 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4790 CVec_C2Tuple_usizeTransactionZZ_free(arg_constr);
4793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4794 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4795 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4796 if (arg_constr.datalen > 0)
4797 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4799 arg_constr.data = NULL;
4800 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4801 for (size_t l = 0; l < arg_constr.datalen; l++) {
4802 long arr_conv_63 = arg_vals[l];
4803 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4804 FREE((void*)arr_conv_63);
4805 arg_constr.data[l] = arr_conv_63_conv;
4807 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4808 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_constr);
4811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4812 LDKCVec_CVec_RouteHopZZ arg_constr;
4813 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4814 if (arg_constr.datalen > 0)
4815 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
4817 arg_constr.data = NULL;
4818 for (size_t m = 0; m < arg_constr.datalen; m++) {
4819 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, arg, m);
4820 LDKCVec_RouteHopZ arr_conv_12_constr;
4821 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
4822 if (arr_conv_12_constr.datalen > 0)
4823 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4825 arr_conv_12_constr.data = NULL;
4826 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
4827 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
4828 long arr_conv_10 = arr_conv_12_vals[k];
4829 LDKRouteHop arr_conv_10_conv;
4830 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4831 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4832 arr_conv_12_constr.data[k] = arr_conv_10_conv;
4834 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
4835 arg_constr.data[m] = arr_conv_12_constr;
4837 CVec_CVec_RouteHopZZ_free(arg_constr);
4840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4841 LDKCVec_ChannelDetailsZ arg_constr;
4842 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4843 if (arg_constr.datalen > 0)
4844 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
4846 arg_constr.data = NULL;
4847 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4848 for (size_t q = 0; q < arg_constr.datalen; q++) {
4849 long arr_conv_16 = arg_vals[q];
4850 LDKChannelDetails arr_conv_16_conv;
4851 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4852 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4853 arg_constr.data[q] = arr_conv_16_conv;
4855 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4856 CVec_ChannelDetailsZ_free(arg_constr);
4859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4860 LDKCVec_ChannelMonitorZ arg_constr;
4861 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4862 if (arg_constr.datalen > 0)
4863 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
4865 arg_constr.data = NULL;
4866 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4867 for (size_t q = 0; q < arg_constr.datalen; q++) {
4868 long arr_conv_16 = arg_vals[q];
4869 LDKChannelMonitor arr_conv_16_conv;
4870 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4871 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4872 arg_constr.data[q] = arr_conv_16_conv;
4874 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4875 CVec_ChannelMonitorZ_free(arg_constr);
4878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4879 LDKCVec_EventZ arg_constr;
4880 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4881 if (arg_constr.datalen > 0)
4882 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4884 arg_constr.data = NULL;
4885 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4886 for (size_t h = 0; h < arg_constr.datalen; h++) {
4887 long arr_conv_7 = arg_vals[h];
4888 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
4889 FREE((void*)arr_conv_7);
4890 arg_constr.data[h] = arr_conv_7_conv;
4892 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4893 CVec_EventZ_free(arg_constr);
4896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4897 LDKCVec_HTLCOutputInCommitmentZ arg_constr;
4898 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4899 if (arg_constr.datalen > 0)
4900 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
4902 arg_constr.data = NULL;
4903 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4904 for (size_t y = 0; y < arg_constr.datalen; y++) {
4905 long arr_conv_24 = arg_vals[y];
4906 LDKHTLCOutputInCommitment arr_conv_24_conv;
4907 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
4908 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
4909 arg_constr.data[y] = arr_conv_24_conv;
4911 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4912 CVec_HTLCOutputInCommitmentZ_free(arg_constr);
4915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4916 LDKCVec_MessageSendEventZ arg_constr;
4917 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4918 if (arg_constr.datalen > 0)
4919 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4921 arg_constr.data = NULL;
4922 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4923 for (size_t s = 0; s < arg_constr.datalen; s++) {
4924 long arr_conv_18 = arg_vals[s];
4925 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
4926 FREE((void*)arr_conv_18);
4927 arg_constr.data[s] = arr_conv_18_conv;
4929 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4930 CVec_MessageSendEventZ_free(arg_constr);
4933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4934 LDKCVec_MonitorEventZ arg_constr;
4935 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4936 if (arg_constr.datalen > 0)
4937 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
4939 arg_constr.data = NULL;
4940 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4941 for (size_t o = 0; o < arg_constr.datalen; o++) {
4942 long arr_conv_14 = arg_vals[o];
4943 LDKMonitorEvent arr_conv_14_conv;
4944 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
4945 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
4946 arg_constr.data[o] = arr_conv_14_conv;
4948 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4949 CVec_MonitorEventZ_free(arg_constr);
4952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4953 LDKCVec_NetAddressZ arg_constr;
4954 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4955 if (arg_constr.datalen > 0)
4956 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
4958 arg_constr.data = NULL;
4959 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4960 for (size_t m = 0; m < arg_constr.datalen; m++) {
4961 long arr_conv_12 = arg_vals[m];
4962 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
4963 FREE((void*)arr_conv_12);
4964 arg_constr.data[m] = arr_conv_12_conv;
4966 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4967 CVec_NetAddressZ_free(arg_constr);
4970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4971 LDKCVec_NodeAnnouncementZ arg_constr;
4972 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4973 if (arg_constr.datalen > 0)
4974 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4976 arg_constr.data = NULL;
4977 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4978 for (size_t s = 0; s < arg_constr.datalen; s++) {
4979 long arr_conv_18 = arg_vals[s];
4980 LDKNodeAnnouncement arr_conv_18_conv;
4981 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4982 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4983 arg_constr.data[s] = arr_conv_18_conv;
4985 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4986 CVec_NodeAnnouncementZ_free(arg_constr);
4989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4990 LDKCVec_PublicKeyZ arg_constr;
4991 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4992 if (arg_constr.datalen > 0)
4993 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
4995 arg_constr.data = NULL;
4996 for (size_t i = 0; i < arg_constr.datalen; i++) {
4997 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4998 LDKPublicKey arr_conv_8_ref;
4999 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
5000 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
5001 arg_constr.data[i] = arr_conv_8_ref;
5003 CVec_PublicKeyZ_free(arg_constr);
5006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5007 LDKCVec_RouteHintZ arg_constr;
5008 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5009 if (arg_constr.datalen > 0)
5010 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
5012 arg_constr.data = NULL;
5013 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5014 for (size_t l = 0; l < arg_constr.datalen; l++) {
5015 long arr_conv_11 = arg_vals[l];
5016 LDKRouteHint arr_conv_11_conv;
5017 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
5018 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
5019 arg_constr.data[l] = arr_conv_11_conv;
5021 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5022 CVec_RouteHintZ_free(arg_constr);
5025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5026 LDKCVec_RouteHopZ arg_constr;
5027 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5028 if (arg_constr.datalen > 0)
5029 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
5031 arg_constr.data = NULL;
5032 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5033 for (size_t k = 0; k < arg_constr.datalen; k++) {
5034 long arr_conv_10 = arg_vals[k];
5035 LDKRouteHop arr_conv_10_conv;
5036 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
5037 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
5038 arg_constr.data[k] = arr_conv_10_conv;
5040 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5041 CVec_RouteHopZ_free(arg_constr);
5044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5045 LDKCVec_SignatureZ arg_constr;
5046 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5047 if (arg_constr.datalen > 0)
5048 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5050 arg_constr.data = NULL;
5051 for (size_t i = 0; i < arg_constr.datalen; i++) {
5052 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5053 LDKSignature arr_conv_8_ref;
5054 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5055 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5056 arg_constr.data[i] = arr_conv_8_ref;
5058 CVec_SignatureZ_free(arg_constr);
5061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5062 LDKCVec_SpendableOutputDescriptorZ arg_constr;
5063 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5064 if (arg_constr.datalen > 0)
5065 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
5067 arg_constr.data = NULL;
5068 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5069 for (size_t b = 0; b < arg_constr.datalen; b++) {
5070 long arr_conv_27 = arg_vals[b];
5071 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
5072 FREE((void*)arr_conv_27);
5073 arg_constr.data[b] = arr_conv_27_conv;
5075 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5076 CVec_SpendableOutputDescriptorZ_free(arg_constr);
5079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5080 LDKCVec_TransactionZ arg_constr;
5081 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5082 if (arg_constr.datalen > 0)
5083 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5085 arg_constr.data = NULL;
5086 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5087 for (size_t n = 0; n < arg_constr.datalen; n++) {
5088 long arr_conv_13 = arg_vals[n];
5089 LDKTransaction arr_conv_13_conv = *(LDKTransaction*)arr_conv_13;
5090 arg_constr.data[n] = arr_conv_13_conv;
5092 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5093 CVec_TransactionZ_free(arg_constr);
5096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5097 LDKCVec_TxOutZ arg_constr;
5098 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5099 if (arg_constr.datalen > 0)
5100 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5102 arg_constr.data = NULL;
5103 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5104 for (size_t h = 0; h < arg_constr.datalen; h++) {
5105 long arr_conv_7 = arg_vals[h];
5106 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5107 FREE((void*)arr_conv_7);
5108 arg_constr.data[h] = arr_conv_7_conv;
5110 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5111 CVec_TxOutZ_free(arg_constr);
5114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5115 LDKCVec_UpdateAddHTLCZ arg_constr;
5116 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5117 if (arg_constr.datalen > 0)
5118 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
5120 arg_constr.data = NULL;
5121 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5122 for (size_t p = 0; p < arg_constr.datalen; p++) {
5123 long arr_conv_15 = arg_vals[p];
5124 LDKUpdateAddHTLC arr_conv_15_conv;
5125 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
5126 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
5127 arg_constr.data[p] = arr_conv_15_conv;
5129 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5130 CVec_UpdateAddHTLCZ_free(arg_constr);
5133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5134 LDKCVec_UpdateFailHTLCZ arg_constr;
5135 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5136 if (arg_constr.datalen > 0)
5137 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
5139 arg_constr.data = NULL;
5140 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5141 for (size_t q = 0; q < arg_constr.datalen; q++) {
5142 long arr_conv_16 = arg_vals[q];
5143 LDKUpdateFailHTLC arr_conv_16_conv;
5144 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5145 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5146 arg_constr.data[q] = arr_conv_16_conv;
5148 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5149 CVec_UpdateFailHTLCZ_free(arg_constr);
5152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5153 LDKCVec_UpdateFailMalformedHTLCZ arg_constr;
5154 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5155 if (arg_constr.datalen > 0)
5156 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
5158 arg_constr.data = NULL;
5159 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5160 for (size_t z = 0; z < arg_constr.datalen; z++) {
5161 long arr_conv_25 = arg_vals[z];
5162 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
5163 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
5164 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
5165 arg_constr.data[z] = arr_conv_25_conv;
5167 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5168 CVec_UpdateFailMalformedHTLCZ_free(arg_constr);
5171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5172 LDKCVec_UpdateFulfillHTLCZ arg_constr;
5173 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5174 if (arg_constr.datalen > 0)
5175 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
5177 arg_constr.data = NULL;
5178 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5179 for (size_t t = 0; t < arg_constr.datalen; t++) {
5180 long arr_conv_19 = arg_vals[t];
5181 LDKUpdateFulfillHTLC arr_conv_19_conv;
5182 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5183 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5184 arg_constr.data[t] = arr_conv_19_conv;
5186 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5187 CVec_UpdateFulfillHTLCZ_free(arg_constr);
5190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5191 LDKCVec_u64Z arg_constr;
5192 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5193 if (arg_constr.datalen > 0)
5194 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
5196 arg_constr.data = NULL;
5197 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5198 for (size_t g = 0; g < arg_constr.datalen; g++) {
5199 long arr_conv_6 = arg_vals[g];
5200 arg_constr.data[g] = arr_conv_6;
5202 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5203 CVec_u64Z_free(arg_constr);
5206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
5207 LDKCVec_u8Z arg_ref;
5208 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
5209 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
5210 CVec_u8Z_free(arg_ref);
5211 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
5214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
5215 LDKTransaction _res_conv = *(LDKTransaction*)_res;
5216 Transaction_free(_res_conv);
5219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5220 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5222 TxOut_free(_res_conv);
5225 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5226 LDKTransaction b_conv = *(LDKTransaction*)b;
5227 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5228 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_conv);
5229 return (long)ret_ref;
5232 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5233 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5234 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
5235 return (long)ret_conv;
5238 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5239 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5240 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
5241 return (long)ret_conv;
5244 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5246 a_conv.inner = (void*)(a & (~1));
5247 a_conv.is_owned = (a & 1) || (a == 0);
5248 if (a_conv.inner != NULL)
5249 a_conv = OutPoint_clone(&a_conv);
5251 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
5252 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5253 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5254 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5255 (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0);
5256 return (long)ret_ref;
5259 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5260 LDKThirtyTwoBytes a_ref;
5261 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5262 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5263 LDKCVec_TxOutZ b_constr;
5264 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5265 if (b_constr.datalen > 0)
5266 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5268 b_constr.data = NULL;
5269 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5270 for (size_t h = 0; h < b_constr.datalen; h++) {
5271 long arr_conv_7 = b_vals[h];
5272 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5273 FREE((void*)arr_conv_7);
5274 b_constr.data[h] = arr_conv_7_conv;
5276 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5277 LDKC2Tuple_TxidCVec_TxOutZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
5278 *ret_ref = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_constr);
5279 return (long)ret_ref;
5282 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5283 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5284 *ret_ref = C2Tuple_u64u64Z_new(a, b);
5285 return (long)ret_ref;
5288 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5290 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5291 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5292 LDKCVec_SignatureZ b_constr;
5293 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5294 if (b_constr.datalen > 0)
5295 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5297 b_constr.data = NULL;
5298 for (size_t i = 0; i < b_constr.datalen; i++) {
5299 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5300 LDKSignature arr_conv_8_ref;
5301 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5302 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5303 b_constr.data[i] = arr_conv_8_ref;
5305 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5306 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5307 return (long)ret_ref;
5310 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
5311 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5312 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5313 return (long)ret_conv;
5316 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
5317 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5318 *ret_conv = CResult_SignatureNoneZ_err();
5319 return (long)ret_conv;
5322 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
5323 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5324 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5325 return (long)ret_conv;
5328 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
5329 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5330 *ret_conv = CResult_NoneAPIErrorZ_ok();
5331 return (long)ret_conv;
5334 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
5335 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5336 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
5337 return (long)ret_conv;
5340 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
5341 LDKChannelAnnouncement a_conv;
5342 a_conv.inner = (void*)(a & (~1));
5343 a_conv.is_owned = (a & 1) || (a == 0);
5344 if (a_conv.inner != NULL)
5345 a_conv = ChannelAnnouncement_clone(&a_conv);
5346 LDKChannelUpdate b_conv;
5347 b_conv.inner = (void*)(b & (~1));
5348 b_conv.is_owned = (b & 1) || (b == 0);
5349 if (b_conv.inner != NULL)
5350 b_conv = ChannelUpdate_clone(&b_conv);
5351 LDKChannelUpdate c_conv;
5352 c_conv.inner = (void*)(c & (~1));
5353 c_conv.is_owned = (c & 1) || (c == 0);
5354 if (c_conv.inner != NULL)
5355 c_conv = ChannelUpdate_clone(&c_conv);
5356 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5357 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5358 return (long)ret_ref;
5361 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
5362 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5363 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5364 return (long)ret_conv;
5367 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5368 LDKHTLCOutputInCommitment a_conv;
5369 a_conv.inner = (void*)(a & (~1));
5370 a_conv.is_owned = (a & 1) || (a == 0);
5371 if (a_conv.inner != NULL)
5372 a_conv = HTLCOutputInCommitment_clone(&a_conv);
5374 CHECK((*_env)->GetArrayLength (_env, b) == 64);
5375 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
5376 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
5377 *ret_ref = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
5378 return (long)ret_ref;
5381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5382 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
5383 FREE((void*)this_ptr);
5384 Event_free(this_ptr_conv);
5387 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5388 LDKEvent* orig_conv = (LDKEvent*)orig;
5389 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
5390 *ret_copy = Event_clone(orig_conv);
5391 long ret_ref = (long)ret_copy;
5395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5396 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
5397 FREE((void*)this_ptr);
5398 MessageSendEvent_free(this_ptr_conv);
5401 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5402 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
5403 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5404 *ret_copy = MessageSendEvent_clone(orig_conv);
5405 long ret_ref = (long)ret_copy;
5409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5410 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
5411 FREE((void*)this_ptr);
5412 MessageSendEventsProvider_free(this_ptr_conv);
5415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5416 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
5417 FREE((void*)this_ptr);
5418 EventsProvider_free(this_ptr_conv);
5421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5422 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
5423 FREE((void*)this_ptr);
5424 APIError_free(this_ptr_conv);
5427 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5428 LDKAPIError* orig_conv = (LDKAPIError*)orig;
5429 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5430 *ret_copy = APIError_clone(orig_conv);
5431 long ret_ref = (long)ret_copy;
5435 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5436 LDKLevel* orig_conv = (LDKLevel*)orig;
5437 jclass ret_conv = LDKLevel_to_java(_env, Level_clone(orig_conv));
5441 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
5442 jclass ret_conv = LDKLevel_to_java(_env, Level_max());
5446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5447 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
5448 FREE((void*)this_ptr);
5449 Logger_free(this_ptr_conv);
5452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5453 LDKChannelHandshakeConfig this_ptr_conv;
5454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5455 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5456 ChannelHandshakeConfig_free(this_ptr_conv);
5459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5460 LDKChannelHandshakeConfig orig_conv;
5461 orig_conv.inner = (void*)(orig & (~1));
5462 orig_conv.is_owned = (orig & 1) || (orig == 0);
5463 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
5464 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5465 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5466 long ret_ref = (long)ret_var.inner;
5467 if (ret_var.is_owned) {
5473 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5474 LDKChannelHandshakeConfig this_ptr_conv;
5475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5476 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5477 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
5481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5482 LDKChannelHandshakeConfig this_ptr_conv;
5483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5484 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5485 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
5488 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5489 LDKChannelHandshakeConfig this_ptr_conv;
5490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5491 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5492 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
5496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5497 LDKChannelHandshakeConfig this_ptr_conv;
5498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5499 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5500 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
5503 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5504 LDKChannelHandshakeConfig this_ptr_conv;
5505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5506 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5507 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
5511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5512 LDKChannelHandshakeConfig this_ptr_conv;
5513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5514 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5515 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
5518 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) {
5519 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
5520 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5521 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5522 long ret_ref = (long)ret_var.inner;
5523 if (ret_var.is_owned) {
5529 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
5530 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
5531 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5532 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5533 long ret_ref = (long)ret_var.inner;
5534 if (ret_var.is_owned) {
5540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5541 LDKChannelHandshakeLimits this_ptr_conv;
5542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5544 ChannelHandshakeLimits_free(this_ptr_conv);
5547 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5548 LDKChannelHandshakeLimits orig_conv;
5549 orig_conv.inner = (void*)(orig & (~1));
5550 orig_conv.is_owned = (orig & 1) || (orig == 0);
5551 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
5552 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5553 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5554 long ret_ref = (long)ret_var.inner;
5555 if (ret_var.is_owned) {
5561 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5562 LDKChannelHandshakeLimits this_ptr_conv;
5563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5564 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5565 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
5569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5570 LDKChannelHandshakeLimits this_ptr_conv;
5571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5572 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5573 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
5576 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5577 LDKChannelHandshakeLimits this_ptr_conv;
5578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5579 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5580 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
5584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5585 LDKChannelHandshakeLimits this_ptr_conv;
5586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5587 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5588 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
5591 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5592 LDKChannelHandshakeLimits this_ptr_conv;
5593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5595 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
5599 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) {
5600 LDKChannelHandshakeLimits this_ptr_conv;
5601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5603 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
5606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5607 LDKChannelHandshakeLimits this_ptr_conv;
5608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5609 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5610 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
5614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5615 LDKChannelHandshakeLimits this_ptr_conv;
5616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5617 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5618 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
5621 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
5622 LDKChannelHandshakeLimits this_ptr_conv;
5623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5624 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5625 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
5629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5630 LDKChannelHandshakeLimits this_ptr_conv;
5631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5632 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5633 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
5636 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5637 LDKChannelHandshakeLimits this_ptr_conv;
5638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5639 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5640 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
5644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5645 LDKChannelHandshakeLimits this_ptr_conv;
5646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5647 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5648 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
5651 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5652 LDKChannelHandshakeLimits this_ptr_conv;
5653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5654 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5655 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
5659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5660 LDKChannelHandshakeLimits this_ptr_conv;
5661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5662 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5663 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
5666 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5667 LDKChannelHandshakeLimits this_ptr_conv;
5668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5670 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
5674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5675 LDKChannelHandshakeLimits this_ptr_conv;
5676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5677 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5678 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5681 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
5682 LDKChannelHandshakeLimits this_ptr_conv;
5683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5684 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5685 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5690 LDKChannelHandshakeLimits this_ptr_conv;
5691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5692 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5693 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5696 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5697 LDKChannelHandshakeLimits this_ptr_conv;
5698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5699 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5700 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5705 LDKChannelHandshakeLimits this_ptr_conv;
5706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5707 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5708 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5711 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) {
5712 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);
5713 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5714 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5715 long ret_ref = (long)ret_var.inner;
5716 if (ret_var.is_owned) {
5722 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5723 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
5724 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5725 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5726 long ret_ref = (long)ret_var.inner;
5727 if (ret_var.is_owned) {
5733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5734 LDKChannelConfig this_ptr_conv;
5735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5736 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5737 ChannelConfig_free(this_ptr_conv);
5740 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5741 LDKChannelConfig orig_conv;
5742 orig_conv.inner = (void*)(orig & (~1));
5743 orig_conv.is_owned = (orig & 1) || (orig == 0);
5744 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
5745 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5746 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5747 long ret_ref = (long)ret_var.inner;
5748 if (ret_var.is_owned) {
5754 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
5755 LDKChannelConfig this_ptr_conv;
5756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5757 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5758 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
5762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5763 LDKChannelConfig this_ptr_conv;
5764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5765 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5766 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
5769 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
5770 LDKChannelConfig this_ptr_conv;
5771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5772 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5773 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
5777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5778 LDKChannelConfig this_ptr_conv;
5779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5780 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5781 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5785 LDKChannelConfig this_ptr_conv;
5786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5787 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5788 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5793 LDKChannelConfig this_ptr_conv;
5794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5795 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5796 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5799 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) {
5800 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5801 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5802 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5803 long ret_ref = (long)ret_var.inner;
5804 if (ret_var.is_owned) {
5810 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
5811 LDKChannelConfig ret_var = ChannelConfig_default();
5812 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5813 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5814 long ret_ref = (long)ret_var.inner;
5815 if (ret_var.is_owned) {
5821 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
5822 LDKChannelConfig obj_conv;
5823 obj_conv.inner = (void*)(obj & (~1));
5824 obj_conv.is_owned = (obj & 1) || (obj == 0);
5825 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
5826 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5827 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5828 CVec_u8Z_free(arg_var);
5832 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5834 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5835 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5836 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
5837 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5838 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5839 long ret_ref = (long)ret_var.inner;
5840 if (ret_var.is_owned) {
5843 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5848 LDKUserConfig this_ptr_conv;
5849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5850 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5851 UserConfig_free(this_ptr_conv);
5854 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5855 LDKUserConfig orig_conv;
5856 orig_conv.inner = (void*)(orig & (~1));
5857 orig_conv.is_owned = (orig & 1) || (orig == 0);
5858 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
5859 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5860 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5861 long ret_ref = (long)ret_var.inner;
5862 if (ret_var.is_owned) {
5868 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
5869 LDKUserConfig this_ptr_conv;
5870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5871 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5872 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
5873 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5874 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5875 long ret_ref = (long)ret_var.inner;
5876 if (ret_var.is_owned) {
5882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5883 LDKUserConfig this_ptr_conv;
5884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5885 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5886 LDKChannelHandshakeConfig val_conv;
5887 val_conv.inner = (void*)(val & (~1));
5888 val_conv.is_owned = (val & 1) || (val == 0);
5889 if (val_conv.inner != NULL)
5890 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5891 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5894 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
5895 LDKUserConfig this_ptr_conv;
5896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5898 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5899 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5900 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5901 long ret_ref = (long)ret_var.inner;
5902 if (ret_var.is_owned) {
5908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5909 LDKUserConfig this_ptr_conv;
5910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5911 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5912 LDKChannelHandshakeLimits val_conv;
5913 val_conv.inner = (void*)(val & (~1));
5914 val_conv.is_owned = (val & 1) || (val == 0);
5915 if (val_conv.inner != NULL)
5916 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5917 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5920 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
5921 LDKUserConfig this_ptr_conv;
5922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5923 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5924 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
5925 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5926 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5927 long ret_ref = (long)ret_var.inner;
5928 if (ret_var.is_owned) {
5934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5935 LDKUserConfig this_ptr_conv;
5936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5937 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5938 LDKChannelConfig val_conv;
5939 val_conv.inner = (void*)(val & (~1));
5940 val_conv.is_owned = (val & 1) || (val == 0);
5941 if (val_conv.inner != NULL)
5942 val_conv = ChannelConfig_clone(&val_conv);
5943 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5946 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) {
5947 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5948 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5949 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5950 if (own_channel_config_arg_conv.inner != NULL)
5951 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5952 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5953 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5954 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5955 if (peer_channel_config_limits_arg_conv.inner != NULL)
5956 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5957 LDKChannelConfig channel_options_arg_conv;
5958 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5959 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5960 if (channel_options_arg_conv.inner != NULL)
5961 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5962 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5963 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5964 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5965 long ret_ref = (long)ret_var.inner;
5966 if (ret_var.is_owned) {
5972 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5973 LDKUserConfig ret_var = UserConfig_default();
5974 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5975 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5976 long ret_ref = (long)ret_var.inner;
5977 if (ret_var.is_owned) {
5983 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5984 LDKAccessError* orig_conv = (LDKAccessError*)orig;
5985 jclass ret_conv = LDKAccessError_to_java(_env, AccessError_clone(orig_conv));
5989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5990 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5991 FREE((void*)this_ptr);
5992 Access_free(this_ptr_conv);
5995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5996 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5997 FREE((void*)this_ptr);
5998 Watch_free(this_ptr_conv);
6001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6002 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
6003 FREE((void*)this_ptr);
6004 Filter_free(this_ptr_conv);
6007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6008 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
6009 FREE((void*)this_ptr);
6010 BroadcasterInterface_free(this_ptr_conv);
6013 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6014 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
6015 jclass ret_conv = LDKConfirmationTarget_to_java(_env, ConfirmationTarget_clone(orig_conv));
6019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6020 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
6021 FREE((void*)this_ptr);
6022 FeeEstimator_free(this_ptr_conv);
6025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6026 LDKChainMonitor this_ptr_conv;
6027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6028 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6029 ChainMonitor_free(this_ptr_conv);
6032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
6033 LDKChainMonitor this_arg_conv;
6034 this_arg_conv.inner = (void*)(this_arg & (~1));
6035 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6036 unsigned char header_arr[80];
6037 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6038 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6039 unsigned char (*header_ref)[80] = &header_arr;
6040 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6041 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6042 if (txdata_constr.datalen > 0)
6043 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6045 txdata_constr.data = NULL;
6046 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6047 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6048 long arr_conv_29 = txdata_vals[d];
6049 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6050 FREE((void*)arr_conv_29);
6051 txdata_constr.data[d] = arr_conv_29_conv;
6053 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6054 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
6058 LDKChainMonitor this_arg_conv;
6059 this_arg_conv.inner = (void*)(this_arg & (~1));
6060 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6061 unsigned char header_arr[80];
6062 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6063 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6064 unsigned char (*header_ref)[80] = &header_arr;
6065 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
6068 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
6069 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
6070 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6071 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6072 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6073 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6075 LDKLogger logger_conv = *(LDKLogger*)logger;
6076 if (logger_conv.free == LDKLogger_JCalls_free) {
6077 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6078 LDKLogger_JCalls_clone(logger_conv.this_arg);
6080 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
6081 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
6082 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6083 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
6085 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
6086 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6087 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6088 long ret_ref = (long)ret_var.inner;
6089 if (ret_var.is_owned) {
6095 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
6096 LDKChainMonitor this_arg_conv;
6097 this_arg_conv.inner = (void*)(this_arg & (~1));
6098 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6099 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
6100 *ret = ChainMonitor_as_Watch(&this_arg_conv);
6104 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6105 LDKChainMonitor this_arg_conv;
6106 this_arg_conv.inner = (void*)(this_arg & (~1));
6107 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6108 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6109 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
6113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6114 LDKChannelMonitorUpdate this_ptr_conv;
6115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6116 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6117 ChannelMonitorUpdate_free(this_ptr_conv);
6120 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6121 LDKChannelMonitorUpdate orig_conv;
6122 orig_conv.inner = (void*)(orig & (~1));
6123 orig_conv.is_owned = (orig & 1) || (orig == 0);
6124 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
6125 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6126 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6127 long ret_ref = (long)ret_var.inner;
6128 if (ret_var.is_owned) {
6134 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6135 LDKChannelMonitorUpdate this_ptr_conv;
6136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6137 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6138 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
6142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6143 LDKChannelMonitorUpdate this_ptr_conv;
6144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6145 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6146 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
6149 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6150 LDKChannelMonitorUpdate obj_conv;
6151 obj_conv.inner = (void*)(obj & (~1));
6152 obj_conv.is_owned = (obj & 1) || (obj == 0);
6153 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
6154 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6155 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6156 CVec_u8Z_free(arg_var);
6160 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6162 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6163 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6164 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_read(ser_ref);
6165 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6166 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6167 long ret_ref = (long)ret_var.inner;
6168 if (ret_var.is_owned) {
6171 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6175 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6176 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
6177 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(_env, ChannelMonitorUpdateErr_clone(orig_conv));
6181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6182 LDKMonitorUpdateError this_ptr_conv;
6183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6184 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6185 MonitorUpdateError_free(this_ptr_conv);
6188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6189 LDKMonitorEvent this_ptr_conv;
6190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6191 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6192 MonitorEvent_free(this_ptr_conv);
6195 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6196 LDKMonitorEvent orig_conv;
6197 orig_conv.inner = (void*)(orig & (~1));
6198 orig_conv.is_owned = (orig & 1) || (orig == 0);
6199 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
6200 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6201 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6202 long ret_ref = (long)ret_var.inner;
6203 if (ret_var.is_owned) {
6209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6210 LDKHTLCUpdate this_ptr_conv;
6211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6212 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6213 HTLCUpdate_free(this_ptr_conv);
6216 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6217 LDKHTLCUpdate orig_conv;
6218 orig_conv.inner = (void*)(orig & (~1));
6219 orig_conv.is_owned = (orig & 1) || (orig == 0);
6220 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
6221 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6222 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6223 long ret_ref = (long)ret_var.inner;
6224 if (ret_var.is_owned) {
6230 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6231 LDKHTLCUpdate obj_conv;
6232 obj_conv.inner = (void*)(obj & (~1));
6233 obj_conv.is_owned = (obj & 1) || (obj == 0);
6234 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
6235 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6236 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6237 CVec_u8Z_free(arg_var);
6241 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6243 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6244 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6245 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
6246 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6247 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6248 long ret_ref = (long)ret_var.inner;
6249 if (ret_var.is_owned) {
6252 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6257 LDKChannelMonitor this_ptr_conv;
6258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6259 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6260 ChannelMonitor_free(this_ptr_conv);
6263 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
6264 LDKChannelMonitor this_arg_conv;
6265 this_arg_conv.inner = (void*)(this_arg & (~1));
6266 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6267 LDKChannelMonitorUpdate updates_conv;
6268 updates_conv.inner = (void*)(updates & (~1));
6269 updates_conv.is_owned = (updates & 1) || (updates == 0);
6270 if (updates_conv.inner != NULL)
6271 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
6272 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
6273 LDKLogger* logger_conv = (LDKLogger*)logger;
6274 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6275 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
6276 return (long)ret_conv;
6279 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6280 LDKChannelMonitor this_arg_conv;
6281 this_arg_conv.inner = (void*)(this_arg & (~1));
6282 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6283 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
6287 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
6288 LDKChannelMonitor this_arg_conv;
6289 this_arg_conv.inner = (void*)(this_arg & (~1));
6290 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6291 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6292 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
6293 return (long)ret_ref;
6296 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6297 LDKChannelMonitor this_arg_conv;
6298 this_arg_conv.inner = (void*)(this_arg & (~1));
6299 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6300 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
6301 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6302 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6303 for (size_t o = 0; o < ret_var.datalen; o++) {
6304 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
6305 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6306 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6307 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
6308 if (arr_conv_14_var.is_owned) {
6309 arr_conv_14_ref |= 1;
6311 ret_arr_ptr[o] = arr_conv_14_ref;
6313 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6318 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6319 LDKChannelMonitor this_arg_conv;
6320 this_arg_conv.inner = (void*)(this_arg & (~1));
6321 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6322 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
6323 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6324 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6325 for (size_t h = 0; h < ret_var.datalen; h++) {
6326 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6327 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
6328 long arr_conv_7_ref = (long)arr_conv_7_copy;
6329 ret_arr_ptr[h] = arr_conv_7_ref;
6331 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6332 CVec_EventZ_free(ret_var);
6336 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
6337 LDKChannelMonitor this_arg_conv;
6338 this_arg_conv.inner = (void*)(this_arg & (~1));
6339 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6340 LDKLogger* logger_conv = (LDKLogger*)logger;
6341 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
6342 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6343 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6344 for (size_t n = 0; n < ret_var.datalen; n++) {
6345 LDKTransaction *arr_conv_13_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
6346 *arr_conv_13_copy = ret_var.data[n];
6347 long arr_conv_13_ref = (long)arr_conv_13_copy;
6348 ret_arr_ptr[n] = arr_conv_13_ref;
6350 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6351 CVec_TransactionZ_free(ret_var);
6355 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) {
6356 LDKChannelMonitor this_arg_conv;
6357 this_arg_conv.inner = (void*)(this_arg & (~1));
6358 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6359 unsigned char header_arr[80];
6360 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6361 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6362 unsigned char (*header_ref)[80] = &header_arr;
6363 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6364 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6365 if (txdata_constr.datalen > 0)
6366 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6368 txdata_constr.data = NULL;
6369 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6370 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6371 long arr_conv_29 = txdata_vals[d];
6372 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6373 FREE((void*)arr_conv_29);
6374 txdata_constr.data[d] = arr_conv_29_conv;
6376 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6377 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6378 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6379 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6380 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6382 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6383 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6384 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6385 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6387 LDKLogger logger_conv = *(LDKLogger*)logger;
6388 if (logger_conv.free == LDKLogger_JCalls_free) {
6389 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6390 LDKLogger_JCalls_clone(logger_conv.this_arg);
6392 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6393 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6394 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6395 for (size_t b = 0; b < ret_var.datalen; b++) {
6396 LDKC2Tuple_TxidCVec_TxOutZZ* arr_conv_27_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
6397 *arr_conv_27_ref = ret_var.data[b];
6398 ret_arr_ptr[b] = (long)arr_conv_27_ref;
6400 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6401 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(ret_var);
6405 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) {
6406 LDKChannelMonitor this_arg_conv;
6407 this_arg_conv.inner = (void*)(this_arg & (~1));
6408 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6409 unsigned char header_arr[80];
6410 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6411 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6412 unsigned char (*header_ref)[80] = &header_arr;
6413 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6414 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6415 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6416 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6418 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6419 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6420 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6421 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6423 LDKLogger logger_conv = *(LDKLogger*)logger;
6424 if (logger_conv.free == LDKLogger_JCalls_free) {
6425 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6426 LDKLogger_JCalls_clone(logger_conv.this_arg);
6428 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6432 LDKOutPoint this_ptr_conv;
6433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6434 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6435 OutPoint_free(this_ptr_conv);
6438 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6439 LDKOutPoint orig_conv;
6440 orig_conv.inner = (void*)(orig & (~1));
6441 orig_conv.is_owned = (orig & 1) || (orig == 0);
6442 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
6443 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6444 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6445 long ret_ref = (long)ret_var.inner;
6446 if (ret_var.is_owned) {
6452 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6453 LDKOutPoint this_ptr_conv;
6454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6455 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6456 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6457 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
6461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6462 LDKOutPoint this_ptr_conv;
6463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6464 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6465 LDKThirtyTwoBytes val_ref;
6466 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6467 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6468 OutPoint_set_txid(&this_ptr_conv, val_ref);
6471 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6472 LDKOutPoint this_ptr_conv;
6473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6474 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6475 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
6479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6480 LDKOutPoint this_ptr_conv;
6481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6482 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6483 OutPoint_set_index(&this_ptr_conv, val);
6486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
6487 LDKThirtyTwoBytes txid_arg_ref;
6488 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
6489 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
6490 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
6491 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6492 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6493 long ret_ref = (long)ret_var.inner;
6494 if (ret_var.is_owned) {
6500 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6501 LDKOutPoint this_arg_conv;
6502 this_arg_conv.inner = (void*)(this_arg & (~1));
6503 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6504 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
6505 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
6509 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
6510 LDKOutPoint obj_conv;
6511 obj_conv.inner = (void*)(obj & (~1));
6512 obj_conv.is_owned = (obj & 1) || (obj == 0);
6513 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
6514 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6515 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6516 CVec_u8Z_free(arg_var);
6520 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6522 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6523 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6524 LDKOutPoint ret_var = OutPoint_read(ser_ref);
6525 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6526 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6527 long ret_ref = (long)ret_var.inner;
6528 if (ret_var.is_owned) {
6531 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6536 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
6537 FREE((void*)this_ptr);
6538 SpendableOutputDescriptor_free(this_ptr_conv);
6541 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6542 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
6543 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
6544 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
6545 long ret_ref = (long)ret_copy;
6549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6550 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
6551 FREE((void*)this_ptr);
6552 ChannelKeys_free(this_ptr_conv);
6555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6556 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
6557 FREE((void*)this_ptr);
6558 KeysInterface_free(this_ptr_conv);
6561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6562 LDKInMemoryChannelKeys this_ptr_conv;
6563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6564 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6565 InMemoryChannelKeys_free(this_ptr_conv);
6568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6569 LDKInMemoryChannelKeys orig_conv;
6570 orig_conv.inner = (void*)(orig & (~1));
6571 orig_conv.is_owned = (orig & 1) || (orig == 0);
6572 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
6573 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6574 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6575 long ret_ref = (long)ret_var.inner;
6576 if (ret_var.is_owned) {
6582 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6583 LDKInMemoryChannelKeys this_ptr_conv;
6584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6585 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6586 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6587 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
6591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6592 LDKInMemoryChannelKeys this_ptr_conv;
6593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6595 LDKSecretKey val_ref;
6596 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6597 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6598 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
6601 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6602 LDKInMemoryChannelKeys this_ptr_conv;
6603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6604 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6605 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6606 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
6610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6611 LDKInMemoryChannelKeys this_ptr_conv;
6612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6613 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6614 LDKSecretKey val_ref;
6615 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6616 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6617 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
6620 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6621 LDKInMemoryChannelKeys this_ptr_conv;
6622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6623 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6624 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6625 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
6629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6630 LDKInMemoryChannelKeys this_ptr_conv;
6631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6632 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6633 LDKSecretKey val_ref;
6634 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6635 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6636 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
6639 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6640 LDKInMemoryChannelKeys this_ptr_conv;
6641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6642 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6643 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6644 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
6648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6649 LDKInMemoryChannelKeys this_ptr_conv;
6650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6651 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6652 LDKSecretKey val_ref;
6653 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6654 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6655 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
6658 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6659 LDKInMemoryChannelKeys this_ptr_conv;
6660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6661 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6662 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6663 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
6667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6668 LDKInMemoryChannelKeys this_ptr_conv;
6669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6670 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6671 LDKSecretKey val_ref;
6672 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6673 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6674 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6677 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
6678 LDKInMemoryChannelKeys this_ptr_conv;
6679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6680 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6681 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6682 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
6686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6687 LDKInMemoryChannelKeys this_ptr_conv;
6688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6690 LDKThirtyTwoBytes val_ref;
6691 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6692 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6693 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6696 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) {
6697 LDKSecretKey funding_key_ref;
6698 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
6699 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
6700 LDKSecretKey revocation_base_key_ref;
6701 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
6702 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
6703 LDKSecretKey payment_key_ref;
6704 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
6705 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
6706 LDKSecretKey delayed_payment_base_key_ref;
6707 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
6708 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
6709 LDKSecretKey htlc_base_key_ref;
6710 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
6711 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
6712 LDKThirtyTwoBytes commitment_seed_ref;
6713 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
6714 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
6715 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
6716 FREE((void*)key_derivation_params);
6717 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);
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 jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6728 LDKInMemoryChannelKeys this_arg_conv;
6729 this_arg_conv.inner = (void*)(this_arg & (~1));
6730 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6731 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
6732 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6733 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6734 long ret_ref = (long)ret_var.inner;
6735 if (ret_var.is_owned) {
6741 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6742 LDKInMemoryChannelKeys this_arg_conv;
6743 this_arg_conv.inner = (void*)(this_arg & (~1));
6744 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6745 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
6749 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6750 LDKInMemoryChannelKeys this_arg_conv;
6751 this_arg_conv.inner = (void*)(this_arg & (~1));
6752 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6753 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
6757 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6758 LDKInMemoryChannelKeys this_arg_conv;
6759 this_arg_conv.inner = (void*)(this_arg & (~1));
6760 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6761 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6762 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
6766 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
6767 LDKInMemoryChannelKeys obj_conv;
6768 obj_conv.inner = (void*)(obj & (~1));
6769 obj_conv.is_owned = (obj & 1) || (obj == 0);
6770 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
6771 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6772 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6773 CVec_u8Z_free(arg_var);
6777 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6779 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6780 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6781 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_read(ser_ref);
6782 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6783 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6784 long ret_ref = (long)ret_var.inner;
6785 if (ret_var.is_owned) {
6788 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6793 LDKKeysManager this_ptr_conv;
6794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6795 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6796 KeysManager_free(this_ptr_conv);
6799 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) {
6800 unsigned char seed_arr[32];
6801 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
6802 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
6803 unsigned char (*seed_ref)[32] = &seed_arr;
6804 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6805 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
6806 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6807 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6808 long ret_ref = (long)ret_var.inner;
6809 if (ret_var.is_owned) {
6815 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) {
6816 LDKKeysManager this_arg_conv;
6817 this_arg_conv.inner = (void*)(this_arg & (~1));
6818 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6819 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
6820 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6821 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6822 long ret_ref = (long)ret_var.inner;
6823 if (ret_var.is_owned) {
6829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
6830 LDKKeysManager this_arg_conv;
6831 this_arg_conv.inner = (void*)(this_arg & (~1));
6832 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6833 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6834 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
6838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6839 LDKChannelManager this_ptr_conv;
6840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6841 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6842 ChannelManager_free(this_ptr_conv);
6845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6846 LDKChannelDetails this_ptr_conv;
6847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6848 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6849 ChannelDetails_free(this_ptr_conv);
6852 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6853 LDKChannelDetails orig_conv;
6854 orig_conv.inner = (void*)(orig & (~1));
6855 orig_conv.is_owned = (orig & 1) || (orig == 0);
6856 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
6857 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6858 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6859 long ret_ref = (long)ret_var.inner;
6860 if (ret_var.is_owned) {
6866 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6867 LDKChannelDetails this_ptr_conv;
6868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6869 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6870 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6871 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
6875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6876 LDKChannelDetails this_ptr_conv;
6877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6879 LDKThirtyTwoBytes val_ref;
6880 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6881 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6882 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
6885 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6886 LDKChannelDetails this_ptr_conv;
6887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6888 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6889 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6890 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
6894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6895 LDKChannelDetails this_ptr_conv;
6896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6898 LDKPublicKey val_ref;
6899 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6900 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6901 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
6904 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
6905 LDKChannelDetails this_ptr_conv;
6906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6907 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6908 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
6909 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6910 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6911 long ret_ref = (long)ret_var.inner;
6912 if (ret_var.is_owned) {
6918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6919 LDKChannelDetails this_ptr_conv;
6920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6921 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6922 LDKInitFeatures val_conv;
6923 val_conv.inner = (void*)(val & (~1));
6924 val_conv.is_owned = (val & 1) || (val == 0);
6925 // Warning: we may need a move here but can't clone!
6926 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
6929 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6930 LDKChannelDetails this_ptr_conv;
6931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6932 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6933 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
6937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6938 LDKChannelDetails 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 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
6944 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6945 LDKChannelDetails this_ptr_conv;
6946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6947 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6948 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
6952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6953 LDKChannelDetails this_ptr_conv;
6954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6955 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6956 ChannelDetails_set_user_id(&this_ptr_conv, val);
6959 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6960 LDKChannelDetails this_ptr_conv;
6961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6962 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6963 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
6967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6968 LDKChannelDetails this_ptr_conv;
6969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6970 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6971 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
6974 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6975 LDKChannelDetails this_ptr_conv;
6976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6977 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6978 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
6982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6983 LDKChannelDetails this_ptr_conv;
6984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6985 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6986 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
6989 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
6990 LDKChannelDetails this_ptr_conv;
6991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6992 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6993 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
6997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6998 LDKChannelDetails this_ptr_conv;
6999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7000 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7001 ChannelDetails_set_is_live(&this_ptr_conv, val);
7004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7005 LDKPaymentSendFailure this_ptr_conv;
7006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7007 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7008 PaymentSendFailure_free(this_ptr_conv);
7011 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) {
7012 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
7013 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
7014 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
7015 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7016 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
7018 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7019 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7020 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7021 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7023 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7024 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7025 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7026 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7028 LDKLogger logger_conv = *(LDKLogger*)logger;
7029 if (logger_conv.free == LDKLogger_JCalls_free) {
7030 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7031 LDKLogger_JCalls_clone(logger_conv.this_arg);
7033 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7034 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7035 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7036 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7038 LDKUserConfig config_conv;
7039 config_conv.inner = (void*)(config & (~1));
7040 config_conv.is_owned = (config & 1) || (config == 0);
7041 if (config_conv.inner != NULL)
7042 config_conv = UserConfig_clone(&config_conv);
7043 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);
7044 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7045 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7046 long ret_ref = (long)ret_var.inner;
7047 if (ret_var.is_owned) {
7053 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) {
7054 LDKChannelManager this_arg_conv;
7055 this_arg_conv.inner = (void*)(this_arg & (~1));
7056 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7057 LDKPublicKey their_network_key_ref;
7058 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
7059 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
7060 LDKUserConfig override_config_conv;
7061 override_config_conv.inner = (void*)(override_config & (~1));
7062 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
7063 if (override_config_conv.inner != NULL)
7064 override_config_conv = UserConfig_clone(&override_config_conv);
7065 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7066 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
7067 return (long)ret_conv;
7070 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7071 LDKChannelManager this_arg_conv;
7072 this_arg_conv.inner = (void*)(this_arg & (~1));
7073 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7074 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
7075 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7076 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7077 for (size_t q = 0; q < ret_var.datalen; q++) {
7078 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7079 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7080 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7081 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7082 if (arr_conv_16_var.is_owned) {
7083 arr_conv_16_ref |= 1;
7085 ret_arr_ptr[q] = arr_conv_16_ref;
7087 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7092 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7093 LDKChannelManager this_arg_conv;
7094 this_arg_conv.inner = (void*)(this_arg & (~1));
7095 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7096 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
7097 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7098 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7099 for (size_t q = 0; q < ret_var.datalen; q++) {
7100 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7101 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7102 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7103 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7104 if (arr_conv_16_var.is_owned) {
7105 arr_conv_16_ref |= 1;
7107 ret_arr_ptr[q] = arr_conv_16_ref;
7109 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7114 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7115 LDKChannelManager this_arg_conv;
7116 this_arg_conv.inner = (void*)(this_arg & (~1));
7117 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7118 unsigned char channel_id_arr[32];
7119 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7120 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7121 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7122 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7123 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
7124 return (long)ret_conv;
7127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7128 LDKChannelManager this_arg_conv;
7129 this_arg_conv.inner = (void*)(this_arg & (~1));
7130 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7131 unsigned char channel_id_arr[32];
7132 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7133 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7134 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7135 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
7138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7139 LDKChannelManager this_arg_conv;
7140 this_arg_conv.inner = (void*)(this_arg & (~1));
7141 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7142 ChannelManager_force_close_all_channels(&this_arg_conv);
7145 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) {
7146 LDKChannelManager this_arg_conv;
7147 this_arg_conv.inner = (void*)(this_arg & (~1));
7148 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7149 LDKRoute route_conv;
7150 route_conv.inner = (void*)(route & (~1));
7151 route_conv.is_owned = (route & 1) || (route == 0);
7152 LDKThirtyTwoBytes payment_hash_ref;
7153 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7154 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
7155 LDKThirtyTwoBytes payment_secret_ref;
7156 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7157 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7158 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7159 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
7160 return (long)ret_conv;
7163 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) {
7164 LDKChannelManager this_arg_conv;
7165 this_arg_conv.inner = (void*)(this_arg & (~1));
7166 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7167 unsigned char temporary_channel_id_arr[32];
7168 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
7169 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
7170 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
7171 LDKOutPoint funding_txo_conv;
7172 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7173 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
7174 if (funding_txo_conv.inner != NULL)
7175 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7176 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
7179 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) {
7180 LDKChannelManager this_arg_conv;
7181 this_arg_conv.inner = (void*)(this_arg & (~1));
7182 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7183 LDKThreeBytes rgb_ref;
7184 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
7185 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
7186 LDKThirtyTwoBytes alias_ref;
7187 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
7188 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
7189 LDKCVec_NetAddressZ addresses_constr;
7190 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
7191 if (addresses_constr.datalen > 0)
7192 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7194 addresses_constr.data = NULL;
7195 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
7196 for (size_t m = 0; m < addresses_constr.datalen; m++) {
7197 long arr_conv_12 = addresses_vals[m];
7198 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
7199 FREE((void*)arr_conv_12);
7200 addresses_constr.data[m] = arr_conv_12_conv;
7202 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
7203 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
7206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
7207 LDKChannelManager this_arg_conv;
7208 this_arg_conv.inner = (void*)(this_arg & (~1));
7209 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7210 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
7213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
7214 LDKChannelManager this_arg_conv;
7215 this_arg_conv.inner = (void*)(this_arg & (~1));
7216 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7217 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
7220 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) {
7221 LDKChannelManager this_arg_conv;
7222 this_arg_conv.inner = (void*)(this_arg & (~1));
7223 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7224 unsigned char payment_hash_arr[32];
7225 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7226 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
7227 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
7228 LDKThirtyTwoBytes payment_secret_ref;
7229 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7230 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7231 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
7235 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) {
7236 LDKChannelManager this_arg_conv;
7237 this_arg_conv.inner = (void*)(this_arg & (~1));
7238 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7239 LDKThirtyTwoBytes payment_preimage_ref;
7240 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
7241 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
7242 LDKThirtyTwoBytes payment_secret_ref;
7243 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7244 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7245 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
7249 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
7250 LDKChannelManager this_arg_conv;
7251 this_arg_conv.inner = (void*)(this_arg & (~1));
7252 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7253 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7254 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
7258 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) {
7259 LDKChannelManager this_arg_conv;
7260 this_arg_conv.inner = (void*)(this_arg & (~1));
7261 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7262 LDKOutPoint funding_txo_conv;
7263 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7264 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
7265 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
7268 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7269 LDKChannelManager this_arg_conv;
7270 this_arg_conv.inner = (void*)(this_arg & (~1));
7271 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7272 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7273 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
7277 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7278 LDKChannelManager this_arg_conv;
7279 this_arg_conv.inner = (void*)(this_arg & (~1));
7280 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7281 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7282 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
7286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
7287 LDKChannelManager this_arg_conv;
7288 this_arg_conv.inner = (void*)(this_arg & (~1));
7289 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7290 unsigned char header_arr[80];
7291 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7292 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7293 unsigned char (*header_ref)[80] = &header_arr;
7294 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7295 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
7296 if (txdata_constr.datalen > 0)
7297 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7299 txdata_constr.data = NULL;
7300 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
7301 for (size_t d = 0; d < txdata_constr.datalen; d++) {
7302 long arr_conv_29 = txdata_vals[d];
7303 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
7304 FREE((void*)arr_conv_29);
7305 txdata_constr.data[d] = arr_conv_29_conv;
7307 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
7308 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
7311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
7312 LDKChannelManager this_arg_conv;
7313 this_arg_conv.inner = (void*)(this_arg & (~1));
7314 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7315 unsigned char header_arr[80];
7316 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7317 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7318 unsigned char (*header_ref)[80] = &header_arr;
7319 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
7322 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
7323 LDKChannelManager this_arg_conv;
7324 this_arg_conv.inner = (void*)(this_arg & (~1));
7325 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7326 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7327 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
7331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7332 LDKChannelManagerReadArgs this_ptr_conv;
7333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7334 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7335 ChannelManagerReadArgs_free(this_ptr_conv);
7338 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
7339 LDKChannelManagerReadArgs this_ptr_conv;
7340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7341 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7342 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
7346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7347 LDKChannelManagerReadArgs this_ptr_conv;
7348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7349 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7350 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
7351 if (val_conv.free == LDKKeysInterface_JCalls_free) {
7352 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7353 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
7355 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
7358 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
7359 LDKChannelManagerReadArgs this_ptr_conv;
7360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7361 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7362 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
7366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7367 LDKChannelManagerReadArgs this_ptr_conv;
7368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7369 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7370 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
7371 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
7372 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7373 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
7375 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
7378 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
7379 LDKChannelManagerReadArgs this_ptr_conv;
7380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7381 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7382 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
7386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7387 LDKChannelManagerReadArgs this_ptr_conv;
7388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7389 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7390 LDKWatch val_conv = *(LDKWatch*)val;
7391 if (val_conv.free == LDKWatch_JCalls_free) {
7392 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7393 LDKWatch_JCalls_clone(val_conv.this_arg);
7395 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
7398 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
7399 LDKChannelManagerReadArgs this_ptr_conv;
7400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7401 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7402 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
7406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7407 LDKChannelManagerReadArgs this_ptr_conv;
7408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7409 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7410 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
7411 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
7412 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7413 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
7415 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
7418 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
7419 LDKChannelManagerReadArgs this_ptr_conv;
7420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7421 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7422 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
7426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7427 LDKChannelManagerReadArgs this_ptr_conv;
7428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7429 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7430 LDKLogger val_conv = *(LDKLogger*)val;
7431 if (val_conv.free == LDKLogger_JCalls_free) {
7432 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7433 LDKLogger_JCalls_clone(val_conv.this_arg);
7435 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
7438 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
7439 LDKChannelManagerReadArgs this_ptr_conv;
7440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7441 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7442 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
7443 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7444 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7445 long ret_ref = (long)ret_var.inner;
7446 if (ret_var.is_owned) {
7452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7453 LDKChannelManagerReadArgs this_ptr_conv;
7454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7455 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7456 LDKUserConfig val_conv;
7457 val_conv.inner = (void*)(val & (~1));
7458 val_conv.is_owned = (val & 1) || (val == 0);
7459 if (val_conv.inner != NULL)
7460 val_conv = UserConfig_clone(&val_conv);
7461 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
7464 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) {
7465 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7466 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7467 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7468 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7470 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7471 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
7472 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7473 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
7475 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7476 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7477 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7478 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7480 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7481 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7482 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7483 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7485 LDKLogger logger_conv = *(LDKLogger*)logger;
7486 if (logger_conv.free == LDKLogger_JCalls_free) {
7487 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7488 LDKLogger_JCalls_clone(logger_conv.this_arg);
7490 LDKUserConfig default_config_conv;
7491 default_config_conv.inner = (void*)(default_config & (~1));
7492 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
7493 if (default_config_conv.inner != NULL)
7494 default_config_conv = UserConfig_clone(&default_config_conv);
7495 LDKCVec_ChannelMonitorZ channel_monitors_constr;
7496 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
7497 if (channel_monitors_constr.datalen > 0)
7498 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7500 channel_monitors_constr.data = NULL;
7501 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
7502 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
7503 long arr_conv_16 = channel_monitors_vals[q];
7504 LDKChannelMonitor arr_conv_16_conv;
7505 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7506 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7507 channel_monitors_constr.data[q] = arr_conv_16_conv;
7509 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
7510 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);
7511 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7512 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7513 long ret_ref = (long)ret_var.inner;
7514 if (ret_var.is_owned) {
7520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7521 LDKDecodeError this_ptr_conv;
7522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7523 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7524 DecodeError_free(this_ptr_conv);
7527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7528 LDKInit this_ptr_conv;
7529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7530 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7531 Init_free(this_ptr_conv);
7534 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7536 orig_conv.inner = (void*)(orig & (~1));
7537 orig_conv.is_owned = (orig & 1) || (orig == 0);
7538 LDKInit ret_var = Init_clone(&orig_conv);
7539 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7540 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7541 long ret_ref = (long)ret_var.inner;
7542 if (ret_var.is_owned) {
7548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7549 LDKErrorMessage this_ptr_conv;
7550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7551 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7552 ErrorMessage_free(this_ptr_conv);
7555 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7556 LDKErrorMessage orig_conv;
7557 orig_conv.inner = (void*)(orig & (~1));
7558 orig_conv.is_owned = (orig & 1) || (orig == 0);
7559 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
7560 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7561 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7562 long ret_ref = (long)ret_var.inner;
7563 if (ret_var.is_owned) {
7569 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7570 LDKErrorMessage this_ptr_conv;
7571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7572 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7573 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7574 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
7578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7579 LDKErrorMessage this_ptr_conv;
7580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7582 LDKThirtyTwoBytes val_ref;
7583 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7584 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7585 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
7588 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
7589 LDKErrorMessage this_ptr_conv;
7590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7591 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7592 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
7593 char* _buf = MALLOC(_str.len + 1, "str conv buf");
7594 memcpy(_buf, _str.chars, _str.len);
7596 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
7601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7602 LDKErrorMessage this_ptr_conv;
7603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7604 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7605 LDKCVec_u8Z val_ref;
7606 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
7607 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7608 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7609 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
7612 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
7613 LDKThirtyTwoBytes channel_id_arg_ref;
7614 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7615 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7616 LDKCVec_u8Z data_arg_ref;
7617 data_arg_ref.data = (*_env)->GetByteArrayElements (_env, data_arg, NULL);
7618 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
7619 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7620 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7621 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7622 long ret_ref = (long)ret_var.inner;
7623 if (ret_var.is_owned) {
7626 (*_env)->ReleaseByteArrayElements(_env, data_arg, (int8_t*)data_arg_ref.data, 0);
7630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7631 LDKPing this_ptr_conv;
7632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7633 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7634 Ping_free(this_ptr_conv);
7637 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7639 orig_conv.inner = (void*)(orig & (~1));
7640 orig_conv.is_owned = (orig & 1) || (orig == 0);
7641 LDKPing ret_var = Ping_clone(&orig_conv);
7642 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7643 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7644 long ret_ref = (long)ret_var.inner;
7645 if (ret_var.is_owned) {
7651 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7652 LDKPing this_ptr_conv;
7653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7654 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7655 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7660 LDKPing this_ptr_conv;
7661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7662 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7663 Ping_set_ponglen(&this_ptr_conv, val);
7666 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7667 LDKPing this_ptr_conv;
7668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7670 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7675 LDKPing this_ptr_conv;
7676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7677 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7678 Ping_set_byteslen(&this_ptr_conv, val);
7681 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
7682 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
7683 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7684 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7685 long ret_ref = (long)ret_var.inner;
7686 if (ret_var.is_owned) {
7692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7693 LDKPong this_ptr_conv;
7694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7695 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7696 Pong_free(this_ptr_conv);
7699 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7701 orig_conv.inner = (void*)(orig & (~1));
7702 orig_conv.is_owned = (orig & 1) || (orig == 0);
7703 LDKPong ret_var = Pong_clone(&orig_conv);
7704 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7705 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7706 long ret_ref = (long)ret_var.inner;
7707 if (ret_var.is_owned) {
7713 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7714 LDKPong this_ptr_conv;
7715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7717 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
7721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7722 LDKPong this_ptr_conv;
7723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7724 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7725 Pong_set_byteslen(&this_ptr_conv, val);
7728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
7729 LDKPong ret_var = Pong_new(byteslen_arg);
7730 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7731 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7732 long ret_ref = (long)ret_var.inner;
7733 if (ret_var.is_owned) {
7739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7740 LDKOpenChannel this_ptr_conv;
7741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7742 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7743 OpenChannel_free(this_ptr_conv);
7746 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7747 LDKOpenChannel orig_conv;
7748 orig_conv.inner = (void*)(orig & (~1));
7749 orig_conv.is_owned = (orig & 1) || (orig == 0);
7750 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
7751 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7752 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7753 long ret_ref = (long)ret_var.inner;
7754 if (ret_var.is_owned) {
7760 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7761 LDKOpenChannel this_ptr_conv;
7762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7763 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7764 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7765 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
7769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7770 LDKOpenChannel this_ptr_conv;
7771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7772 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7773 LDKThirtyTwoBytes val_ref;
7774 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7775 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7776 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
7779 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7780 LDKOpenChannel this_ptr_conv;
7781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7782 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7783 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7784 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
7788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7789 LDKOpenChannel this_ptr_conv;
7790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7791 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7792 LDKThirtyTwoBytes val_ref;
7793 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7794 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7795 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7798 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7799 LDKOpenChannel this_ptr_conv;
7800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7801 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7802 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
7806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7807 LDKOpenChannel this_ptr_conv;
7808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7809 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7810 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
7813 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7814 LDKOpenChannel this_ptr_conv;
7815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7816 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7817 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
7821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7822 LDKOpenChannel this_ptr_conv;
7823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7824 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7825 OpenChannel_set_push_msat(&this_ptr_conv, val);
7828 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7829 LDKOpenChannel this_ptr_conv;
7830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7831 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7832 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
7836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7837 LDKOpenChannel this_ptr_conv;
7838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7839 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7840 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7843 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7844 LDKOpenChannel this_ptr_conv;
7845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7846 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7847 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7851 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) {
7852 LDKOpenChannel this_ptr_conv;
7853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7854 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7855 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7858 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7859 LDKOpenChannel this_ptr_conv;
7860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7861 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7862 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7867 LDKOpenChannel this_ptr_conv;
7868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7869 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7870 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7873 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7874 LDKOpenChannel this_ptr_conv;
7875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7876 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7877 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
7881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7882 LDKOpenChannel this_ptr_conv;
7883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7884 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7885 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7888 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7889 LDKOpenChannel this_ptr_conv;
7890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7891 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7892 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
7896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7897 LDKOpenChannel this_ptr_conv;
7898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7899 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7900 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
7903 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7904 LDKOpenChannel this_ptr_conv;
7905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7906 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7907 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
7911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7912 LDKOpenChannel this_ptr_conv;
7913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7914 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7915 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
7918 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7919 LDKOpenChannel this_ptr_conv;
7920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7921 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7922 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
7926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7927 LDKOpenChannel this_ptr_conv;
7928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7929 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7930 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7933 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7934 LDKOpenChannel this_ptr_conv;
7935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7936 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7937 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7938 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7943 LDKOpenChannel this_ptr_conv;
7944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7945 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7946 LDKPublicKey val_ref;
7947 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7948 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7949 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7952 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7953 LDKOpenChannel this_ptr_conv;
7954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7955 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7956 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7957 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7962 LDKOpenChannel this_ptr_conv;
7963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7964 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7965 LDKPublicKey val_ref;
7966 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7967 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7968 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7971 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7972 LDKOpenChannel this_ptr_conv;
7973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7974 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7975 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7976 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
7980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7981 LDKOpenChannel this_ptr_conv;
7982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7983 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7984 LDKPublicKey val_ref;
7985 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7986 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7987 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
7990 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7991 LDKOpenChannel this_ptr_conv;
7992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7993 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7994 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7995 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8000 LDKOpenChannel this_ptr_conv;
8001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8002 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8003 LDKPublicKey val_ref;
8004 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8005 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8006 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8009 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8010 LDKOpenChannel this_ptr_conv;
8011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8012 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8013 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8014 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8019 LDKOpenChannel this_ptr_conv;
8020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8021 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8022 LDKPublicKey val_ref;
8023 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8024 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8025 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8028 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8029 LDKOpenChannel this_ptr_conv;
8030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8031 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8032 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8033 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8038 LDKOpenChannel this_ptr_conv;
8039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8040 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8041 LDKPublicKey val_ref;
8042 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8043 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8044 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8047 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8048 LDKOpenChannel this_ptr_conv;
8049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8051 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
8055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8056 LDKOpenChannel this_ptr_conv;
8057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8058 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8059 OpenChannel_set_channel_flags(&this_ptr_conv, val);
8062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8063 LDKAcceptChannel this_ptr_conv;
8064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8066 AcceptChannel_free(this_ptr_conv);
8069 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8070 LDKAcceptChannel orig_conv;
8071 orig_conv.inner = (void*)(orig & (~1));
8072 orig_conv.is_owned = (orig & 1) || (orig == 0);
8073 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
8074 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8075 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8076 long ret_ref = (long)ret_var.inner;
8077 if (ret_var.is_owned) {
8083 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8084 LDKAcceptChannel this_ptr_conv;
8085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8086 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8087 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8088 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
8092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8093 LDKAcceptChannel this_ptr_conv;
8094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8095 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8096 LDKThirtyTwoBytes val_ref;
8097 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8098 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8099 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8103 LDKAcceptChannel this_ptr_conv;
8104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8105 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8106 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
8110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8111 LDKAcceptChannel this_ptr_conv;
8112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8113 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8114 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8117 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8118 LDKAcceptChannel this_ptr_conv;
8119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8120 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8121 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8125 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) {
8126 LDKAcceptChannel this_ptr_conv;
8127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8128 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8129 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8132 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8133 LDKAcceptChannel this_ptr_conv;
8134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8135 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8136 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8141 LDKAcceptChannel this_ptr_conv;
8142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8143 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8144 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8147 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8148 LDKAcceptChannel this_ptr_conv;
8149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8150 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8151 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
8155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8156 LDKAcceptChannel this_ptr_conv;
8157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8158 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8159 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8162 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
8163 LDKAcceptChannel this_ptr_conv;
8164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8165 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8166 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
8170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8171 LDKAcceptChannel this_ptr_conv;
8172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8173 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8174 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
8177 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
8178 LDKAcceptChannel this_ptr_conv;
8179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8180 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8181 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
8185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8186 LDKAcceptChannel this_ptr_conv;
8187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8188 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8189 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
8192 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
8193 LDKAcceptChannel this_ptr_conv;
8194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8195 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8196 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
8200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8201 LDKAcceptChannel this_ptr_conv;
8202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8203 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8204 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8207 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8212 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8217 LDKAcceptChannel this_ptr_conv;
8218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8219 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8220 LDKPublicKey val_ref;
8221 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8222 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8223 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8226 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8227 LDKAcceptChannel this_ptr_conv;
8228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8229 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8230 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8231 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8236 LDKAcceptChannel this_ptr_conv;
8237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8238 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8239 LDKPublicKey val_ref;
8240 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8241 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8242 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8245 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8246 LDKAcceptChannel this_ptr_conv;
8247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8248 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8249 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8250 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
8254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8255 LDKAcceptChannel this_ptr_conv;
8256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8257 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8258 LDKPublicKey val_ref;
8259 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8260 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8261 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
8264 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8265 LDKAcceptChannel this_ptr_conv;
8266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8268 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8269 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8274 LDKAcceptChannel this_ptr_conv;
8275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8276 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8277 LDKPublicKey val_ref;
8278 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8279 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8280 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8283 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8284 LDKAcceptChannel this_ptr_conv;
8285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8286 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8287 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8288 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8293 LDKAcceptChannel this_ptr_conv;
8294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8295 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8296 LDKPublicKey val_ref;
8297 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8298 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8299 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8302 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8303 LDKAcceptChannel this_ptr_conv;
8304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8305 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8306 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8307 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8312 LDKAcceptChannel this_ptr_conv;
8313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8314 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8315 LDKPublicKey val_ref;
8316 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8317 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8318 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8322 LDKFundingCreated this_ptr_conv;
8323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8324 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8325 FundingCreated_free(this_ptr_conv);
8328 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8329 LDKFundingCreated orig_conv;
8330 orig_conv.inner = (void*)(orig & (~1));
8331 orig_conv.is_owned = (orig & 1) || (orig == 0);
8332 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
8333 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8334 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8335 long ret_ref = (long)ret_var.inner;
8336 if (ret_var.is_owned) {
8342 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8343 LDKFundingCreated this_ptr_conv;
8344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8345 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8346 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8347 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
8351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8352 LDKFundingCreated this_ptr_conv;
8353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8354 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8355 LDKThirtyTwoBytes val_ref;
8356 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8357 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8358 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
8361 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
8362 LDKFundingCreated this_ptr_conv;
8363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8364 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8365 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8366 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
8370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8371 LDKFundingCreated this_ptr_conv;
8372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8373 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8374 LDKThirtyTwoBytes val_ref;
8375 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8376 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8377 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
8380 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
8381 LDKFundingCreated this_ptr_conv;
8382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8383 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8384 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
8388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8389 LDKFundingCreated this_ptr_conv;
8390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8391 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8392 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
8395 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8396 LDKFundingCreated this_ptr_conv;
8397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8398 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8399 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8400 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
8404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8405 LDKFundingCreated this_ptr_conv;
8406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8408 LDKSignature val_ref;
8409 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8410 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8411 FundingCreated_set_signature(&this_ptr_conv, val_ref);
8414 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) {
8415 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
8416 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
8417 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
8418 LDKThirtyTwoBytes funding_txid_arg_ref;
8419 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
8420 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
8421 LDKSignature signature_arg_ref;
8422 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8423 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8424 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
8425 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8426 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8427 long ret_ref = (long)ret_var.inner;
8428 if (ret_var.is_owned) {
8434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8435 LDKFundingSigned this_ptr_conv;
8436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8437 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8438 FundingSigned_free(this_ptr_conv);
8441 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8442 LDKFundingSigned orig_conv;
8443 orig_conv.inner = (void*)(orig & (~1));
8444 orig_conv.is_owned = (orig & 1) || (orig == 0);
8445 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
8446 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8447 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8448 long ret_ref = (long)ret_var.inner;
8449 if (ret_var.is_owned) {
8455 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8456 LDKFundingSigned this_ptr_conv;
8457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8458 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8459 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8460 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
8464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8465 LDKFundingSigned this_ptr_conv;
8466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8467 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8468 LDKThirtyTwoBytes val_ref;
8469 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8470 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8471 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
8474 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8475 LDKFundingSigned this_ptr_conv;
8476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8477 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8478 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8479 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
8483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8484 LDKFundingSigned this_ptr_conv;
8485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8487 LDKSignature val_ref;
8488 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8489 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8490 FundingSigned_set_signature(&this_ptr_conv, val_ref);
8493 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
8494 LDKThirtyTwoBytes channel_id_arg_ref;
8495 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8496 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8497 LDKSignature signature_arg_ref;
8498 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8499 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8500 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
8501 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8502 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8503 long ret_ref = (long)ret_var.inner;
8504 if (ret_var.is_owned) {
8510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8511 LDKFundingLocked this_ptr_conv;
8512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8513 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8514 FundingLocked_free(this_ptr_conv);
8517 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8518 LDKFundingLocked orig_conv;
8519 orig_conv.inner = (void*)(orig & (~1));
8520 orig_conv.is_owned = (orig & 1) || (orig == 0);
8521 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
8522 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8523 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8524 long ret_ref = (long)ret_var.inner;
8525 if (ret_var.is_owned) {
8531 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8532 LDKFundingLocked this_ptr_conv;
8533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8534 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8535 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8536 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
8540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8541 LDKFundingLocked this_ptr_conv;
8542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8544 LDKThirtyTwoBytes val_ref;
8545 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8546 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8547 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
8550 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8551 LDKFundingLocked this_ptr_conv;
8552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8554 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8555 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8560 LDKFundingLocked this_ptr_conv;
8561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8562 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8563 LDKPublicKey val_ref;
8564 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8565 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8566 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8569 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
8570 LDKThirtyTwoBytes channel_id_arg_ref;
8571 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8572 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8573 LDKPublicKey next_per_commitment_point_arg_ref;
8574 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8575 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8576 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
8577 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8578 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8579 long ret_ref = (long)ret_var.inner;
8580 if (ret_var.is_owned) {
8586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8587 LDKShutdown this_ptr_conv;
8588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8589 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8590 Shutdown_free(this_ptr_conv);
8593 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8594 LDKShutdown orig_conv;
8595 orig_conv.inner = (void*)(orig & (~1));
8596 orig_conv.is_owned = (orig & 1) || (orig == 0);
8597 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
8598 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8599 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8600 long ret_ref = (long)ret_var.inner;
8601 if (ret_var.is_owned) {
8607 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8608 LDKShutdown this_ptr_conv;
8609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8610 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8611 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8612 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
8616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8617 LDKShutdown this_ptr_conv;
8618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8619 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8620 LDKThirtyTwoBytes val_ref;
8621 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8622 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8623 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8626 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8627 LDKShutdown this_ptr_conv;
8628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8629 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8630 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8631 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8632 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8637 LDKShutdown this_ptr_conv;
8638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8639 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8640 LDKCVec_u8Z val_ref;
8641 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
8642 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
8643 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8644 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
8647 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
8648 LDKThirtyTwoBytes channel_id_arg_ref;
8649 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8650 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8651 LDKCVec_u8Z scriptpubkey_arg_ref;
8652 scriptpubkey_arg_ref.data = (*_env)->GetByteArrayElements (_env, scriptpubkey_arg, NULL);
8653 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
8654 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8655 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8656 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8657 long ret_ref = (long)ret_var.inner;
8658 if (ret_var.is_owned) {
8661 (*_env)->ReleaseByteArrayElements(_env, scriptpubkey_arg, (int8_t*)scriptpubkey_arg_ref.data, 0);
8665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8666 LDKClosingSigned this_ptr_conv;
8667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8668 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8669 ClosingSigned_free(this_ptr_conv);
8672 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8673 LDKClosingSigned orig_conv;
8674 orig_conv.inner = (void*)(orig & (~1));
8675 orig_conv.is_owned = (orig & 1) || (orig == 0);
8676 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
8677 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8678 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8679 long ret_ref = (long)ret_var.inner;
8680 if (ret_var.is_owned) {
8686 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8687 LDKClosingSigned this_ptr_conv;
8688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8690 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8691 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
8695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8696 LDKClosingSigned this_ptr_conv;
8697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8699 LDKThirtyTwoBytes val_ref;
8700 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8701 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8702 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
8705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8706 LDKClosingSigned this_ptr_conv;
8707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8709 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
8713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8714 LDKClosingSigned this_ptr_conv;
8715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8717 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
8720 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8721 LDKClosingSigned this_ptr_conv;
8722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8724 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8725 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
8729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8730 LDKClosingSigned this_ptr_conv;
8731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8732 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8733 LDKSignature val_ref;
8734 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8735 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8736 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
8739 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) {
8740 LDKThirtyTwoBytes channel_id_arg_ref;
8741 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8742 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8743 LDKSignature signature_arg_ref;
8744 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8745 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8746 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
8747 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8748 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8749 long ret_ref = (long)ret_var.inner;
8750 if (ret_var.is_owned) {
8756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8757 LDKUpdateAddHTLC this_ptr_conv;
8758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8759 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8760 UpdateAddHTLC_free(this_ptr_conv);
8763 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8764 LDKUpdateAddHTLC orig_conv;
8765 orig_conv.inner = (void*)(orig & (~1));
8766 orig_conv.is_owned = (orig & 1) || (orig == 0);
8767 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
8768 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8769 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8770 long ret_ref = (long)ret_var.inner;
8771 if (ret_var.is_owned) {
8777 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8778 LDKUpdateAddHTLC this_ptr_conv;
8779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8780 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8781 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8782 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
8786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8787 LDKUpdateAddHTLC this_ptr_conv;
8788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8789 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8790 LDKThirtyTwoBytes val_ref;
8791 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8792 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8793 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
8796 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8797 LDKUpdateAddHTLC this_ptr_conv;
8798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8799 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8800 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
8804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8805 LDKUpdateAddHTLC this_ptr_conv;
8806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8808 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
8811 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8812 LDKUpdateAddHTLC this_ptr_conv;
8813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8814 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8815 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
8819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8820 LDKUpdateAddHTLC this_ptr_conv;
8821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8822 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8823 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
8826 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8827 LDKUpdateAddHTLC this_ptr_conv;
8828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8829 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8830 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8831 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
8835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8836 LDKUpdateAddHTLC this_ptr_conv;
8837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8838 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8839 LDKThirtyTwoBytes val_ref;
8840 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8841 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8842 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
8845 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
8846 LDKUpdateAddHTLC this_ptr_conv;
8847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8848 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8849 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
8853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8854 LDKUpdateAddHTLC this_ptr_conv;
8855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8856 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8857 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
8860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8861 LDKUpdateFulfillHTLC this_ptr_conv;
8862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8863 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8864 UpdateFulfillHTLC_free(this_ptr_conv);
8867 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8868 LDKUpdateFulfillHTLC orig_conv;
8869 orig_conv.inner = (void*)(orig & (~1));
8870 orig_conv.is_owned = (orig & 1) || (orig == 0);
8871 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
8872 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8873 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8874 long ret_ref = (long)ret_var.inner;
8875 if (ret_var.is_owned) {
8881 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8882 LDKUpdateFulfillHTLC this_ptr_conv;
8883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8884 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8885 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8886 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
8890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8891 LDKUpdateFulfillHTLC this_ptr_conv;
8892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8893 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8894 LDKThirtyTwoBytes val_ref;
8895 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8896 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8897 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
8900 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8901 LDKUpdateFulfillHTLC this_ptr_conv;
8902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8903 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8904 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
8908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8909 LDKUpdateFulfillHTLC this_ptr_conv;
8910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8911 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8912 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
8915 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
8916 LDKUpdateFulfillHTLC this_ptr_conv;
8917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8918 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8919 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8920 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
8924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8925 LDKUpdateFulfillHTLC this_ptr_conv;
8926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8927 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8928 LDKThirtyTwoBytes val_ref;
8929 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8930 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8931 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
8934 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) {
8935 LDKThirtyTwoBytes channel_id_arg_ref;
8936 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8937 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8938 LDKThirtyTwoBytes payment_preimage_arg_ref;
8939 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
8940 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
8941 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
8942 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8943 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8944 long ret_ref = (long)ret_var.inner;
8945 if (ret_var.is_owned) {
8951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8952 LDKUpdateFailHTLC this_ptr_conv;
8953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8954 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8955 UpdateFailHTLC_free(this_ptr_conv);
8958 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8959 LDKUpdateFailHTLC orig_conv;
8960 orig_conv.inner = (void*)(orig & (~1));
8961 orig_conv.is_owned = (orig & 1) || (orig == 0);
8962 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
8963 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8964 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8965 long ret_ref = (long)ret_var.inner;
8966 if (ret_var.is_owned) {
8972 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8973 LDKUpdateFailHTLC this_ptr_conv;
8974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8975 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8976 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8977 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
8981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8982 LDKUpdateFailHTLC this_ptr_conv;
8983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8984 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8985 LDKThirtyTwoBytes val_ref;
8986 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8987 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8988 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
8991 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8992 LDKUpdateFailHTLC this_ptr_conv;
8993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8994 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8995 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
8999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9000 LDKUpdateFailHTLC this_ptr_conv;
9001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9002 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9003 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
9006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9007 LDKUpdateFailMalformedHTLC this_ptr_conv;
9008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9009 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9010 UpdateFailMalformedHTLC_free(this_ptr_conv);
9013 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9014 LDKUpdateFailMalformedHTLC orig_conv;
9015 orig_conv.inner = (void*)(orig & (~1));
9016 orig_conv.is_owned = (orig & 1) || (orig == 0);
9017 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
9018 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9019 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9020 long ret_ref = (long)ret_var.inner;
9021 if (ret_var.is_owned) {
9027 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9028 LDKUpdateFailMalformedHTLC this_ptr_conv;
9029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9030 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9031 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9032 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
9036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9037 LDKUpdateFailMalformedHTLC this_ptr_conv;
9038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9039 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9040 LDKThirtyTwoBytes val_ref;
9041 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9042 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9043 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
9046 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9047 LDKUpdateFailMalformedHTLC this_ptr_conv;
9048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9049 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9050 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
9054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9055 LDKUpdateFailMalformedHTLC this_ptr_conv;
9056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9057 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9058 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
9061 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
9062 LDKUpdateFailMalformedHTLC this_ptr_conv;
9063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9064 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9065 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
9069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9070 LDKUpdateFailMalformedHTLC this_ptr_conv;
9071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9072 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9073 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
9076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9077 LDKCommitmentSigned this_ptr_conv;
9078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9079 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9080 CommitmentSigned_free(this_ptr_conv);
9083 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9084 LDKCommitmentSigned orig_conv;
9085 orig_conv.inner = (void*)(orig & (~1));
9086 orig_conv.is_owned = (orig & 1) || (orig == 0);
9087 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
9088 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9089 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9090 long ret_ref = (long)ret_var.inner;
9091 if (ret_var.is_owned) {
9097 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9098 LDKCommitmentSigned this_ptr_conv;
9099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9100 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9101 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9102 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
9106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9107 LDKCommitmentSigned this_ptr_conv;
9108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9109 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9110 LDKThirtyTwoBytes val_ref;
9111 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9112 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9113 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
9116 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9117 LDKCommitmentSigned this_ptr_conv;
9118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9119 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9120 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9121 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
9125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9126 LDKCommitmentSigned this_ptr_conv;
9127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9128 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9129 LDKSignature val_ref;
9130 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9131 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9132 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
9135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
9136 LDKCommitmentSigned this_ptr_conv;
9137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9138 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9139 LDKCVec_SignatureZ val_constr;
9140 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9141 if (val_constr.datalen > 0)
9142 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9144 val_constr.data = NULL;
9145 for (size_t i = 0; i < val_constr.datalen; i++) {
9146 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
9147 LDKSignature arr_conv_8_ref;
9148 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9149 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9150 val_constr.data[i] = arr_conv_8_ref;
9152 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
9155 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) {
9156 LDKThirtyTwoBytes channel_id_arg_ref;
9157 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9158 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9159 LDKSignature signature_arg_ref;
9160 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9161 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9162 LDKCVec_SignatureZ htlc_signatures_arg_constr;
9163 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
9164 if (htlc_signatures_arg_constr.datalen > 0)
9165 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9167 htlc_signatures_arg_constr.data = NULL;
9168 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
9169 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
9170 LDKSignature arr_conv_8_ref;
9171 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9172 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9173 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
9175 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
9176 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9177 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9178 long ret_ref = (long)ret_var.inner;
9179 if (ret_var.is_owned) {
9185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9186 LDKRevokeAndACK this_ptr_conv;
9187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9188 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9189 RevokeAndACK_free(this_ptr_conv);
9192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9193 LDKRevokeAndACK orig_conv;
9194 orig_conv.inner = (void*)(orig & (~1));
9195 orig_conv.is_owned = (orig & 1) || (orig == 0);
9196 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
9197 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9198 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9199 long ret_ref = (long)ret_var.inner;
9200 if (ret_var.is_owned) {
9206 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9207 LDKRevokeAndACK this_ptr_conv;
9208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9209 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9210 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9211 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
9215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9216 LDKRevokeAndACK this_ptr_conv;
9217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9218 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9219 LDKThirtyTwoBytes val_ref;
9220 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9221 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9222 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
9225 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9226 LDKRevokeAndACK this_ptr_conv;
9227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9228 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9229 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9230 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
9234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9235 LDKRevokeAndACK this_ptr_conv;
9236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9237 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9238 LDKThirtyTwoBytes val_ref;
9239 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9240 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9241 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
9244 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9245 LDKRevokeAndACK this_ptr_conv;
9246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9247 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9248 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9249 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
9253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9254 LDKRevokeAndACK this_ptr_conv;
9255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9256 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9257 LDKPublicKey val_ref;
9258 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9259 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9260 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
9263 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) {
9264 LDKThirtyTwoBytes channel_id_arg_ref;
9265 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9266 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9267 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
9268 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
9269 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
9270 LDKPublicKey next_per_commitment_point_arg_ref;
9271 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
9272 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
9273 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
9274 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9275 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9276 long ret_ref = (long)ret_var.inner;
9277 if (ret_var.is_owned) {
9283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9284 LDKUpdateFee this_ptr_conv;
9285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9286 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9287 UpdateFee_free(this_ptr_conv);
9290 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9291 LDKUpdateFee orig_conv;
9292 orig_conv.inner = (void*)(orig & (~1));
9293 orig_conv.is_owned = (orig & 1) || (orig == 0);
9294 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
9295 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9296 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9297 long ret_ref = (long)ret_var.inner;
9298 if (ret_var.is_owned) {
9304 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9305 LDKUpdateFee this_ptr_conv;
9306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9308 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9309 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
9313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9314 LDKUpdateFee this_ptr_conv;
9315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9316 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9317 LDKThirtyTwoBytes val_ref;
9318 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9319 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9320 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
9323 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
9324 LDKUpdateFee this_ptr_conv;
9325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9326 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9327 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
9331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9332 LDKUpdateFee this_ptr_conv;
9333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9334 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9335 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
9338 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
9339 LDKThirtyTwoBytes channel_id_arg_ref;
9340 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9341 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9342 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
9343 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9344 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9345 long ret_ref = (long)ret_var.inner;
9346 if (ret_var.is_owned) {
9352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9353 LDKDataLossProtect this_ptr_conv;
9354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9355 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9356 DataLossProtect_free(this_ptr_conv);
9359 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9360 LDKDataLossProtect orig_conv;
9361 orig_conv.inner = (void*)(orig & (~1));
9362 orig_conv.is_owned = (orig & 1) || (orig == 0);
9363 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
9364 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9365 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9366 long ret_ref = (long)ret_var.inner;
9367 if (ret_var.is_owned) {
9373 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9374 LDKDataLossProtect this_ptr_conv;
9375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9376 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9377 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9378 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
9382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9383 LDKDataLossProtect this_ptr_conv;
9384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9385 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9386 LDKThirtyTwoBytes val_ref;
9387 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9388 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9389 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
9392 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9393 LDKDataLossProtect this_ptr_conv;
9394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9395 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9396 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9397 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
9401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9402 LDKDataLossProtect this_ptr_conv;
9403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9404 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9405 LDKPublicKey val_ref;
9406 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9407 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9408 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
9411 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) {
9412 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
9413 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
9414 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
9415 LDKPublicKey my_current_per_commitment_point_arg_ref;
9416 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
9417 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
9418 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_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_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9429 LDKChannelReestablish 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 ChannelReestablish_free(this_ptr_conv);
9435 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9436 LDKChannelReestablish orig_conv;
9437 orig_conv.inner = (void*)(orig & (~1));
9438 orig_conv.is_owned = (orig & 1) || (orig == 0);
9439 LDKChannelReestablish ret_var = ChannelReestablish_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_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9450 LDKChannelReestablish this_ptr_conv;
9451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9452 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9453 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9454 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
9458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9459 LDKChannelReestablish this_ptr_conv;
9460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9462 LDKThirtyTwoBytes val_ref;
9463 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9464 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9465 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
9468 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9469 LDKChannelReestablish this_ptr_conv;
9470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9471 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9472 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
9476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9477 LDKChannelReestablish this_ptr_conv;
9478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9479 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9480 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
9483 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9484 LDKChannelReestablish this_ptr_conv;
9485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9487 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
9491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9492 LDKChannelReestablish this_ptr_conv;
9493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9494 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9495 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
9498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9499 LDKAnnouncementSignatures this_ptr_conv;
9500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9501 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9502 AnnouncementSignatures_free(this_ptr_conv);
9505 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9506 LDKAnnouncementSignatures orig_conv;
9507 orig_conv.inner = (void*)(orig & (~1));
9508 orig_conv.is_owned = (orig & 1) || (orig == 0);
9509 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
9510 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9511 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9512 long ret_ref = (long)ret_var.inner;
9513 if (ret_var.is_owned) {
9519 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9520 LDKAnnouncementSignatures this_ptr_conv;
9521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9523 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9524 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
9528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9529 LDKAnnouncementSignatures this_ptr_conv;
9530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9531 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9532 LDKThirtyTwoBytes val_ref;
9533 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9534 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9535 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
9538 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9539 LDKAnnouncementSignatures this_ptr_conv;
9540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9541 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9542 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
9546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9547 LDKAnnouncementSignatures this_ptr_conv;
9548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9549 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9550 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
9553 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9554 LDKAnnouncementSignatures this_ptr_conv;
9555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9556 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9557 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9558 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
9562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9563 LDKAnnouncementSignatures this_ptr_conv;
9564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9565 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9566 LDKSignature val_ref;
9567 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9568 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9569 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
9572 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9573 LDKAnnouncementSignatures this_ptr_conv;
9574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9576 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9577 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
9581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9582 LDKAnnouncementSignatures this_ptr_conv;
9583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9585 LDKSignature val_ref;
9586 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9587 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9588 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
9591 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) {
9592 LDKThirtyTwoBytes channel_id_arg_ref;
9593 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9594 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9595 LDKSignature node_signature_arg_ref;
9596 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
9597 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
9598 LDKSignature bitcoin_signature_arg_ref;
9599 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
9600 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
9601 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
9602 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9603 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9604 long ret_ref = (long)ret_var.inner;
9605 if (ret_var.is_owned) {
9611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9612 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
9613 FREE((void*)this_ptr);
9614 NetAddress_free(this_ptr_conv);
9617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9618 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
9619 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9620 *ret_copy = NetAddress_clone(orig_conv);
9621 long ret_ref = (long)ret_copy;
9625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9626 LDKUnsignedNodeAnnouncement this_ptr_conv;
9627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9628 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9629 UnsignedNodeAnnouncement_free(this_ptr_conv);
9632 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9633 LDKUnsignedNodeAnnouncement orig_conv;
9634 orig_conv.inner = (void*)(orig & (~1));
9635 orig_conv.is_owned = (orig & 1) || (orig == 0);
9636 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
9637 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9638 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9639 long ret_ref = (long)ret_var.inner;
9640 if (ret_var.is_owned) {
9646 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9647 LDKUnsignedNodeAnnouncement this_ptr_conv;
9648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9650 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9651 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9652 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9653 long ret_ref = (long)ret_var.inner;
9654 if (ret_var.is_owned) {
9660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9661 LDKUnsignedNodeAnnouncement this_ptr_conv;
9662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9663 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9664 LDKNodeFeatures val_conv;
9665 val_conv.inner = (void*)(val & (~1));
9666 val_conv.is_owned = (val & 1) || (val == 0);
9667 // Warning: we may need a move here but can't clone!
9668 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9671 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9672 LDKUnsignedNodeAnnouncement this_ptr_conv;
9673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9674 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9675 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9680 LDKUnsignedNodeAnnouncement this_ptr_conv;
9681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9682 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9683 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9686 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9687 LDKUnsignedNodeAnnouncement this_ptr_conv;
9688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9690 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9691 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
9695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9696 LDKUnsignedNodeAnnouncement this_ptr_conv;
9697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9699 LDKPublicKey val_ref;
9700 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9701 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9702 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
9705 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
9706 LDKUnsignedNodeAnnouncement this_ptr_conv;
9707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9709 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
9710 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
9714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9715 LDKUnsignedNodeAnnouncement this_ptr_conv;
9716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9717 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9718 LDKThreeBytes val_ref;
9719 CHECK((*_env)->GetArrayLength (_env, val) == 3);
9720 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
9721 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
9724 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
9725 LDKUnsignedNodeAnnouncement this_ptr_conv;
9726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9728 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9729 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
9733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9734 LDKUnsignedNodeAnnouncement this_ptr_conv;
9735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9736 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9737 LDKThirtyTwoBytes val_ref;
9738 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9739 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9740 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
9743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9744 LDKUnsignedNodeAnnouncement this_ptr_conv;
9745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9746 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9747 LDKCVec_NetAddressZ val_constr;
9748 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9749 if (val_constr.datalen > 0)
9750 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9752 val_constr.data = NULL;
9753 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9754 for (size_t m = 0; m < val_constr.datalen; m++) {
9755 long arr_conv_12 = val_vals[m];
9756 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9757 FREE((void*)arr_conv_12);
9758 val_constr.data[m] = arr_conv_12_conv;
9760 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9761 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
9764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9765 LDKNodeAnnouncement this_ptr_conv;
9766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9767 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9768 NodeAnnouncement_free(this_ptr_conv);
9771 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9772 LDKNodeAnnouncement orig_conv;
9773 orig_conv.inner = (void*)(orig & (~1));
9774 orig_conv.is_owned = (orig & 1) || (orig == 0);
9775 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
9776 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9777 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9778 long ret_ref = (long)ret_var.inner;
9779 if (ret_var.is_owned) {
9785 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9786 LDKNodeAnnouncement this_ptr_conv;
9787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9788 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9789 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9790 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
9794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9795 LDKNodeAnnouncement this_ptr_conv;
9796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9798 LDKSignature val_ref;
9799 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9800 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9801 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
9804 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9805 LDKNodeAnnouncement this_ptr_conv;
9806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9808 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
9809 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9810 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9811 long ret_ref = (long)ret_var.inner;
9812 if (ret_var.is_owned) {
9818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9819 LDKNodeAnnouncement this_ptr_conv;
9820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9821 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9822 LDKUnsignedNodeAnnouncement val_conv;
9823 val_conv.inner = (void*)(val & (~1));
9824 val_conv.is_owned = (val & 1) || (val == 0);
9825 if (val_conv.inner != NULL)
9826 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
9827 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
9830 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9831 LDKSignature signature_arg_ref;
9832 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9833 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9834 LDKUnsignedNodeAnnouncement contents_arg_conv;
9835 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9836 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9837 if (contents_arg_conv.inner != NULL)
9838 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
9839 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
9840 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9841 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9842 long ret_ref = (long)ret_var.inner;
9843 if (ret_var.is_owned) {
9849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9850 LDKUnsignedChannelAnnouncement this_ptr_conv;
9851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9852 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9853 UnsignedChannelAnnouncement_free(this_ptr_conv);
9856 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9857 LDKUnsignedChannelAnnouncement orig_conv;
9858 orig_conv.inner = (void*)(orig & (~1));
9859 orig_conv.is_owned = (orig & 1) || (orig == 0);
9860 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
9861 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9862 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9863 long ret_ref = (long)ret_var.inner;
9864 if (ret_var.is_owned) {
9870 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9871 LDKUnsignedChannelAnnouncement this_ptr_conv;
9872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9873 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9874 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
9875 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9876 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9877 long ret_ref = (long)ret_var.inner;
9878 if (ret_var.is_owned) {
9884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9885 LDKUnsignedChannelAnnouncement this_ptr_conv;
9886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9887 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9888 LDKChannelFeatures val_conv;
9889 val_conv.inner = (void*)(val & (~1));
9890 val_conv.is_owned = (val & 1) || (val == 0);
9891 // Warning: we may need a move here but can't clone!
9892 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
9895 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9896 LDKUnsignedChannelAnnouncement this_ptr_conv;
9897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9898 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9899 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9900 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
9904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9905 LDKUnsignedChannelAnnouncement this_ptr_conv;
9906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9907 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9908 LDKThirtyTwoBytes val_ref;
9909 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9910 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9911 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
9914 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9915 LDKUnsignedChannelAnnouncement this_ptr_conv;
9916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9917 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9918 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
9922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9923 LDKUnsignedChannelAnnouncement this_ptr_conv;
9924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9925 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9926 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
9929 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9930 LDKUnsignedChannelAnnouncement this_ptr_conv;
9931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9932 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9933 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9934 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
9938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9939 LDKUnsignedChannelAnnouncement this_ptr_conv;
9940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9941 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9942 LDKPublicKey val_ref;
9943 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9944 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9945 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
9948 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9949 LDKUnsignedChannelAnnouncement this_ptr_conv;
9950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9951 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9952 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9953 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
9957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9958 LDKUnsignedChannelAnnouncement this_ptr_conv;
9959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9961 LDKPublicKey val_ref;
9962 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9963 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9964 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
9967 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9968 LDKUnsignedChannelAnnouncement this_ptr_conv;
9969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9970 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9971 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9972 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
9976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9977 LDKUnsignedChannelAnnouncement this_ptr_conv;
9978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9979 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9980 LDKPublicKey val_ref;
9981 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9982 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9983 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
9986 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9987 LDKUnsignedChannelAnnouncement this_ptr_conv;
9988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9989 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9990 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9991 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
9995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9996 LDKUnsignedChannelAnnouncement this_ptr_conv;
9997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9998 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9999 LDKPublicKey val_ref;
10000 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10001 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10002 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
10005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10006 LDKChannelAnnouncement this_ptr_conv;
10007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10008 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10009 ChannelAnnouncement_free(this_ptr_conv);
10012 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10013 LDKChannelAnnouncement orig_conv;
10014 orig_conv.inner = (void*)(orig & (~1));
10015 orig_conv.is_owned = (orig & 1) || (orig == 0);
10016 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
10017 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10018 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10019 long ret_ref = (long)ret_var.inner;
10020 if (ret_var.is_owned) {
10026 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10027 LDKChannelAnnouncement this_ptr_conv;
10028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10029 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10030 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10031 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
10035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10036 LDKChannelAnnouncement this_ptr_conv;
10037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10038 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10039 LDKSignature val_ref;
10040 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10041 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10042 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
10045 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10046 LDKChannelAnnouncement this_ptr_conv;
10047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10048 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10049 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10050 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
10054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10055 LDKChannelAnnouncement this_ptr_conv;
10056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10057 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10058 LDKSignature val_ref;
10059 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10060 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10061 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
10064 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10065 LDKChannelAnnouncement this_ptr_conv;
10066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10067 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10068 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10069 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
10073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10074 LDKChannelAnnouncement this_ptr_conv;
10075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10076 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10077 LDKSignature val_ref;
10078 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10079 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10080 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
10083 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10084 LDKChannelAnnouncement this_ptr_conv;
10085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10086 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10087 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10088 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
10092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10093 LDKChannelAnnouncement this_ptr_conv;
10094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10095 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10096 LDKSignature val_ref;
10097 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10098 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10099 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
10102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10103 LDKChannelAnnouncement this_ptr_conv;
10104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10105 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10106 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
10107 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10108 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10109 long ret_ref = (long)ret_var.inner;
10110 if (ret_var.is_owned) {
10116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10117 LDKChannelAnnouncement this_ptr_conv;
10118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10119 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10120 LDKUnsignedChannelAnnouncement val_conv;
10121 val_conv.inner = (void*)(val & (~1));
10122 val_conv.is_owned = (val & 1) || (val == 0);
10123 if (val_conv.inner != NULL)
10124 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
10125 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
10128 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) {
10129 LDKSignature node_signature_1_arg_ref;
10130 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
10131 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
10132 LDKSignature node_signature_2_arg_ref;
10133 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
10134 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
10135 LDKSignature bitcoin_signature_1_arg_ref;
10136 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
10137 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
10138 LDKSignature bitcoin_signature_2_arg_ref;
10139 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
10140 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
10141 LDKUnsignedChannelAnnouncement contents_arg_conv;
10142 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10143 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10144 if (contents_arg_conv.inner != NULL)
10145 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
10146 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);
10147 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10148 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10149 long ret_ref = (long)ret_var.inner;
10150 if (ret_var.is_owned) {
10156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10157 LDKUnsignedChannelUpdate this_ptr_conv;
10158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10159 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10160 UnsignedChannelUpdate_free(this_ptr_conv);
10163 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10164 LDKUnsignedChannelUpdate orig_conv;
10165 orig_conv.inner = (void*)(orig & (~1));
10166 orig_conv.is_owned = (orig & 1) || (orig == 0);
10167 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
10168 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10169 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10170 long ret_ref = (long)ret_var.inner;
10171 if (ret_var.is_owned) {
10177 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10178 LDKUnsignedChannelUpdate this_ptr_conv;
10179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10180 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10181 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10182 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
10186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10187 LDKUnsignedChannelUpdate this_ptr_conv;
10188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10189 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10190 LDKThirtyTwoBytes val_ref;
10191 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10192 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10193 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
10196 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10197 LDKUnsignedChannelUpdate this_ptr_conv;
10198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10199 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10200 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
10204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10205 LDKUnsignedChannelUpdate this_ptr_conv;
10206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10207 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10208 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
10211 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10212 LDKUnsignedChannelUpdate this_ptr_conv;
10213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10214 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10215 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
10219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10220 LDKUnsignedChannelUpdate this_ptr_conv;
10221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10222 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10223 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
10226 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
10227 LDKUnsignedChannelUpdate this_ptr_conv;
10228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10229 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10230 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
10234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
10235 LDKUnsignedChannelUpdate this_ptr_conv;
10236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10237 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10238 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
10241 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10242 LDKUnsignedChannelUpdate this_ptr_conv;
10243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10244 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10245 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
10249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10250 LDKUnsignedChannelUpdate this_ptr_conv;
10251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10252 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10253 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
10256 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10257 LDKUnsignedChannelUpdate this_ptr_conv;
10258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10259 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10260 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
10264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10265 LDKUnsignedChannelUpdate this_ptr_conv;
10266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10268 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
10271 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10272 LDKUnsignedChannelUpdate this_ptr_conv;
10273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10274 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10275 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
10279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10280 LDKUnsignedChannelUpdate this_ptr_conv;
10281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10282 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10283 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
10286 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
10287 LDKUnsignedChannelUpdate this_ptr_conv;
10288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10289 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10290 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
10294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10295 LDKUnsignedChannelUpdate this_ptr_conv;
10296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10297 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10298 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
10301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10302 LDKChannelUpdate 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 ChannelUpdate_free(this_ptr_conv);
10308 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10309 LDKChannelUpdate orig_conv;
10310 orig_conv.inner = (void*)(orig & (~1));
10311 orig_conv.is_owned = (orig & 1) || (orig == 0);
10312 LDKChannelUpdate ret_var = ChannelUpdate_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_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10323 LDKChannelUpdate this_ptr_conv;
10324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10325 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10326 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10327 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
10331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10332 LDKChannelUpdate this_ptr_conv;
10333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10334 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10335 LDKSignature val_ref;
10336 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10337 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10338 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
10341 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10342 LDKChannelUpdate this_ptr_conv;
10343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10344 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10345 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
10346 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10347 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10348 long ret_ref = (long)ret_var.inner;
10349 if (ret_var.is_owned) {
10355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10356 LDKChannelUpdate this_ptr_conv;
10357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10358 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10359 LDKUnsignedChannelUpdate val_conv;
10360 val_conv.inner = (void*)(val & (~1));
10361 val_conv.is_owned = (val & 1) || (val == 0);
10362 if (val_conv.inner != NULL)
10363 val_conv = UnsignedChannelUpdate_clone(&val_conv);
10364 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
10367 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
10368 LDKSignature signature_arg_ref;
10369 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10370 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10371 LDKUnsignedChannelUpdate contents_arg_conv;
10372 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10373 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10374 if (contents_arg_conv.inner != NULL)
10375 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
10376 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
10377 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10378 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10379 long ret_ref = (long)ret_var.inner;
10380 if (ret_var.is_owned) {
10386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10387 LDKQueryChannelRange this_ptr_conv;
10388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10389 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10390 QueryChannelRange_free(this_ptr_conv);
10393 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10394 LDKQueryChannelRange orig_conv;
10395 orig_conv.inner = (void*)(orig & (~1));
10396 orig_conv.is_owned = (orig & 1) || (orig == 0);
10397 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
10398 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10399 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10400 long ret_ref = (long)ret_var.inner;
10401 if (ret_var.is_owned) {
10407 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10408 LDKQueryChannelRange this_ptr_conv;
10409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10410 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10411 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10412 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
10416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10417 LDKQueryChannelRange this_ptr_conv;
10418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10419 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10420 LDKThirtyTwoBytes val_ref;
10421 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10422 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10423 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10426 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10427 LDKQueryChannelRange this_ptr_conv;
10428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10429 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10430 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
10434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10435 LDKQueryChannelRange this_ptr_conv;
10436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10437 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10438 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
10441 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10442 LDKQueryChannelRange this_ptr_conv;
10443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10444 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10445 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
10449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10450 LDKQueryChannelRange this_ptr_conv;
10451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10452 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10453 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10456 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) {
10457 LDKThirtyTwoBytes chain_hash_arg_ref;
10458 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10459 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10460 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
10461 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10462 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10463 long ret_ref = (long)ret_var.inner;
10464 if (ret_var.is_owned) {
10470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10471 LDKReplyChannelRange this_ptr_conv;
10472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10473 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10474 ReplyChannelRange_free(this_ptr_conv);
10477 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10478 LDKReplyChannelRange orig_conv;
10479 orig_conv.inner = (void*)(orig & (~1));
10480 orig_conv.is_owned = (orig & 1) || (orig == 0);
10481 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
10482 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10483 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10484 long ret_ref = (long)ret_var.inner;
10485 if (ret_var.is_owned) {
10491 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10492 LDKReplyChannelRange this_ptr_conv;
10493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10494 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10495 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10496 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
10500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10501 LDKReplyChannelRange this_ptr_conv;
10502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10503 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10504 LDKThirtyTwoBytes val_ref;
10505 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10506 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10507 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10510 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10511 LDKReplyChannelRange this_ptr_conv;
10512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10513 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10514 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
10518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10519 LDKReplyChannelRange this_ptr_conv;
10520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10521 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10522 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
10525 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10526 LDKReplyChannelRange this_ptr_conv;
10527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10528 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10529 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
10533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10534 LDKReplyChannelRange this_ptr_conv;
10535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10536 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10537 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10540 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10541 LDKReplyChannelRange this_ptr_conv;
10542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10544 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
10548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10549 LDKReplyChannelRange this_ptr_conv;
10550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10551 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10552 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
10555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10556 LDKReplyChannelRange this_ptr_conv;
10557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10558 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10559 LDKCVec_u64Z val_constr;
10560 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10561 if (val_constr.datalen > 0)
10562 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10564 val_constr.data = NULL;
10565 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10566 for (size_t g = 0; g < val_constr.datalen; g++) {
10567 long arr_conv_6 = val_vals[g];
10568 val_constr.data[g] = arr_conv_6;
10570 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10571 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
10574 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) {
10575 LDKThirtyTwoBytes chain_hash_arg_ref;
10576 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10577 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10578 LDKCVec_u64Z short_channel_ids_arg_constr;
10579 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10580 if (short_channel_ids_arg_constr.datalen > 0)
10581 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10583 short_channel_ids_arg_constr.data = NULL;
10584 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10585 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10586 long arr_conv_6 = short_channel_ids_arg_vals[g];
10587 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10589 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10590 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
10591 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10592 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10593 long ret_ref = (long)ret_var.inner;
10594 if (ret_var.is_owned) {
10600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10601 LDKQueryShortChannelIds this_ptr_conv;
10602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10603 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10604 QueryShortChannelIds_free(this_ptr_conv);
10607 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10608 LDKQueryShortChannelIds orig_conv;
10609 orig_conv.inner = (void*)(orig & (~1));
10610 orig_conv.is_owned = (orig & 1) || (orig == 0);
10611 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
10612 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10613 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10614 long ret_ref = (long)ret_var.inner;
10615 if (ret_var.is_owned) {
10621 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10622 LDKQueryShortChannelIds this_ptr_conv;
10623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10624 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10625 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10626 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
10630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10631 LDKQueryShortChannelIds this_ptr_conv;
10632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10633 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10634 LDKThirtyTwoBytes val_ref;
10635 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10636 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10637 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
10640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10641 LDKQueryShortChannelIds this_ptr_conv;
10642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10643 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10644 LDKCVec_u64Z val_constr;
10645 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10646 if (val_constr.datalen > 0)
10647 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10649 val_constr.data = NULL;
10650 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10651 for (size_t g = 0; g < val_constr.datalen; g++) {
10652 long arr_conv_6 = val_vals[g];
10653 val_constr.data[g] = arr_conv_6;
10655 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10656 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
10659 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
10660 LDKThirtyTwoBytes chain_hash_arg_ref;
10661 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10662 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10663 LDKCVec_u64Z short_channel_ids_arg_constr;
10664 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10665 if (short_channel_ids_arg_constr.datalen > 0)
10666 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10668 short_channel_ids_arg_constr.data = NULL;
10669 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10670 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10671 long arr_conv_6 = short_channel_ids_arg_vals[g];
10672 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10674 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10675 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
10676 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10677 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10678 long ret_ref = (long)ret_var.inner;
10679 if (ret_var.is_owned) {
10685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10686 LDKReplyShortChannelIdsEnd this_ptr_conv;
10687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10688 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10689 ReplyShortChannelIdsEnd_free(this_ptr_conv);
10692 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10693 LDKReplyShortChannelIdsEnd orig_conv;
10694 orig_conv.inner = (void*)(orig & (~1));
10695 orig_conv.is_owned = (orig & 1) || (orig == 0);
10696 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
10697 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10698 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10699 long ret_ref = (long)ret_var.inner;
10700 if (ret_var.is_owned) {
10706 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10707 LDKReplyShortChannelIdsEnd this_ptr_conv;
10708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10710 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10711 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
10715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10716 LDKReplyShortChannelIdsEnd this_ptr_conv;
10717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10718 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10719 LDKThirtyTwoBytes val_ref;
10720 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10721 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10722 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
10725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10726 LDKReplyShortChannelIdsEnd this_ptr_conv;
10727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10728 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10729 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
10733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10734 LDKReplyShortChannelIdsEnd this_ptr_conv;
10735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10736 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10737 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
10740 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
10741 LDKThirtyTwoBytes chain_hash_arg_ref;
10742 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10743 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10744 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
10745 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10746 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10747 long ret_ref = (long)ret_var.inner;
10748 if (ret_var.is_owned) {
10754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10755 LDKGossipTimestampFilter this_ptr_conv;
10756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10757 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10758 GossipTimestampFilter_free(this_ptr_conv);
10761 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10762 LDKGossipTimestampFilter orig_conv;
10763 orig_conv.inner = (void*)(orig & (~1));
10764 orig_conv.is_owned = (orig & 1) || (orig == 0);
10765 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
10766 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10767 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10768 long ret_ref = (long)ret_var.inner;
10769 if (ret_var.is_owned) {
10775 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10776 LDKGossipTimestampFilter this_ptr_conv;
10777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10778 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10779 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10780 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
10784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10785 LDKGossipTimestampFilter this_ptr_conv;
10786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10787 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10788 LDKThirtyTwoBytes val_ref;
10789 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10790 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10791 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
10794 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10795 LDKGossipTimestampFilter this_ptr_conv;
10796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10798 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
10802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10803 LDKGossipTimestampFilter this_ptr_conv;
10804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10806 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
10809 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
10810 LDKGossipTimestampFilter this_ptr_conv;
10811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10812 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10813 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
10817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10818 LDKGossipTimestampFilter this_ptr_conv;
10819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10820 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10821 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
10824 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) {
10825 LDKThirtyTwoBytes chain_hash_arg_ref;
10826 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10827 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10828 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
10829 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10830 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10831 long ret_ref = (long)ret_var.inner;
10832 if (ret_var.is_owned) {
10838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10839 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
10840 FREE((void*)this_ptr);
10841 ErrorAction_free(this_ptr_conv);
10844 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10845 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
10846 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10847 *ret_copy = ErrorAction_clone(orig_conv);
10848 long ret_ref = (long)ret_copy;
10852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10853 LDKLightningError this_ptr_conv;
10854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10855 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10856 LightningError_free(this_ptr_conv);
10859 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
10860 LDKLightningError this_ptr_conv;
10861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10863 LDKStr _str = LightningError_get_err(&this_ptr_conv);
10864 char* _buf = MALLOC(_str.len + 1, "str conv buf");
10865 memcpy(_buf, _str.chars, _str.len);
10866 _buf[_str.len] = 0;
10867 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
10872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10873 LDKLightningError this_ptr_conv;
10874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10875 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10876 LDKCVec_u8Z val_ref;
10877 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
10878 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
10879 LightningError_set_err(&this_ptr_conv, val_ref);
10880 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
10883 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
10884 LDKLightningError this_ptr_conv;
10885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10886 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10887 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10888 *ret_copy = LightningError_get_action(&this_ptr_conv);
10889 long ret_ref = (long)ret_copy;
10893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10894 LDKLightningError this_ptr_conv;
10895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10896 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10897 LDKErrorAction val_conv = *(LDKErrorAction*)val;
10899 LightningError_set_action(&this_ptr_conv, val_conv);
10902 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
10903 LDKCVec_u8Z err_arg_ref;
10904 err_arg_ref.data = (*_env)->GetByteArrayElements (_env, err_arg, NULL);
10905 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
10906 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
10907 FREE((void*)action_arg);
10908 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
10909 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10910 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10911 long ret_ref = (long)ret_var.inner;
10912 if (ret_var.is_owned) {
10915 (*_env)->ReleaseByteArrayElements(_env, err_arg, (int8_t*)err_arg_ref.data, 0);
10919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10920 LDKCommitmentUpdate this_ptr_conv;
10921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10922 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10923 CommitmentUpdate_free(this_ptr_conv);
10926 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10927 LDKCommitmentUpdate orig_conv;
10928 orig_conv.inner = (void*)(orig & (~1));
10929 orig_conv.is_owned = (orig & 1) || (orig == 0);
10930 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
10931 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10932 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10933 long ret_ref = (long)ret_var.inner;
10934 if (ret_var.is_owned) {
10940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10941 LDKCommitmentUpdate this_ptr_conv;
10942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10943 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10944 LDKCVec_UpdateAddHTLCZ val_constr;
10945 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10946 if (val_constr.datalen > 0)
10947 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10949 val_constr.data = NULL;
10950 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10951 for (size_t p = 0; p < val_constr.datalen; p++) {
10952 long arr_conv_15 = val_vals[p];
10953 LDKUpdateAddHTLC arr_conv_15_conv;
10954 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10955 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10956 if (arr_conv_15_conv.inner != NULL)
10957 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10958 val_constr.data[p] = arr_conv_15_conv;
10960 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10961 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
10964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10965 LDKCommitmentUpdate this_ptr_conv;
10966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10967 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10968 LDKCVec_UpdateFulfillHTLCZ val_constr;
10969 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10970 if (val_constr.datalen > 0)
10971 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10973 val_constr.data = NULL;
10974 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10975 for (size_t t = 0; t < val_constr.datalen; t++) {
10976 long arr_conv_19 = val_vals[t];
10977 LDKUpdateFulfillHTLC arr_conv_19_conv;
10978 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10979 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10980 if (arr_conv_19_conv.inner != NULL)
10981 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10982 val_constr.data[t] = arr_conv_19_conv;
10984 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10985 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
10988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10989 LDKCommitmentUpdate this_ptr_conv;
10990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10991 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10992 LDKCVec_UpdateFailHTLCZ val_constr;
10993 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10994 if (val_constr.datalen > 0)
10995 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10997 val_constr.data = NULL;
10998 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10999 for (size_t q = 0; q < val_constr.datalen; q++) {
11000 long arr_conv_16 = val_vals[q];
11001 LDKUpdateFailHTLC arr_conv_16_conv;
11002 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11003 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11004 if (arr_conv_16_conv.inner != NULL)
11005 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11006 val_constr.data[q] = arr_conv_16_conv;
11008 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11009 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
11012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11013 LDKCommitmentUpdate this_ptr_conv;
11014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11015 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11016 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
11017 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11018 if (val_constr.datalen > 0)
11019 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11021 val_constr.data = NULL;
11022 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11023 for (size_t z = 0; z < val_constr.datalen; z++) {
11024 long arr_conv_25 = val_vals[z];
11025 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11026 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11027 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11028 if (arr_conv_25_conv.inner != NULL)
11029 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11030 val_constr.data[z] = arr_conv_25_conv;
11032 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11033 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
11036 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
11037 LDKCommitmentUpdate this_ptr_conv;
11038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11039 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11040 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
11041 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11042 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11043 long ret_ref = (long)ret_var.inner;
11044 if (ret_var.is_owned) {
11050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11051 LDKCommitmentUpdate this_ptr_conv;
11052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11053 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11054 LDKUpdateFee val_conv;
11055 val_conv.inner = (void*)(val & (~1));
11056 val_conv.is_owned = (val & 1) || (val == 0);
11057 if (val_conv.inner != NULL)
11058 val_conv = UpdateFee_clone(&val_conv);
11059 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
11062 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
11063 LDKCommitmentUpdate this_ptr_conv;
11064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11066 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
11067 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11068 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11069 long ret_ref = (long)ret_var.inner;
11070 if (ret_var.is_owned) {
11076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11077 LDKCommitmentUpdate this_ptr_conv;
11078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11079 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11080 LDKCommitmentSigned val_conv;
11081 val_conv.inner = (void*)(val & (~1));
11082 val_conv.is_owned = (val & 1) || (val == 0);
11083 if (val_conv.inner != NULL)
11084 val_conv = CommitmentSigned_clone(&val_conv);
11085 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
11088 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) {
11089 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
11090 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
11091 if (update_add_htlcs_arg_constr.datalen > 0)
11092 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11094 update_add_htlcs_arg_constr.data = NULL;
11095 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
11096 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
11097 long arr_conv_15 = update_add_htlcs_arg_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 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
11105 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
11106 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
11107 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
11108 if (update_fulfill_htlcs_arg_constr.datalen > 0)
11109 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11111 update_fulfill_htlcs_arg_constr.data = NULL;
11112 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
11113 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
11114 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
11115 LDKUpdateFulfillHTLC arr_conv_19_conv;
11116 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11117 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11118 if (arr_conv_19_conv.inner != NULL)
11119 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11120 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
11122 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
11123 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
11124 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
11125 if (update_fail_htlcs_arg_constr.datalen > 0)
11126 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11128 update_fail_htlcs_arg_constr.data = NULL;
11129 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
11130 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
11131 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
11132 LDKUpdateFailHTLC arr_conv_16_conv;
11133 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11134 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11135 if (arr_conv_16_conv.inner != NULL)
11136 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11137 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
11139 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
11140 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
11141 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
11142 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
11143 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11145 update_fail_malformed_htlcs_arg_constr.data = NULL;
11146 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
11147 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
11148 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
11149 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11150 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11151 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11152 if (arr_conv_25_conv.inner != NULL)
11153 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11154 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
11156 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
11157 LDKUpdateFee update_fee_arg_conv;
11158 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
11159 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
11160 if (update_fee_arg_conv.inner != NULL)
11161 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
11162 LDKCommitmentSigned commitment_signed_arg_conv;
11163 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
11164 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
11165 if (commitment_signed_arg_conv.inner != NULL)
11166 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
11167 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);
11168 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11169 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11170 long ret_ref = (long)ret_var.inner;
11171 if (ret_var.is_owned) {
11177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11178 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
11179 FREE((void*)this_ptr);
11180 HTLCFailChannelUpdate_free(this_ptr_conv);
11183 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11184 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
11185 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
11186 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
11187 long ret_ref = (long)ret_copy;
11191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11192 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
11193 FREE((void*)this_ptr);
11194 ChannelMessageHandler_free(this_ptr_conv);
11197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11198 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
11199 FREE((void*)this_ptr);
11200 RoutingMessageHandler_free(this_ptr_conv);
11203 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11204 LDKAcceptChannel obj_conv;
11205 obj_conv.inner = (void*)(obj & (~1));
11206 obj_conv.is_owned = (obj & 1) || (obj == 0);
11207 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
11208 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11209 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11210 CVec_u8Z_free(arg_var);
11214 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11215 LDKu8slice ser_ref;
11216 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11217 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11218 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
11219 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11220 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11221 long ret_ref = (long)ret_var.inner;
11222 if (ret_var.is_owned) {
11225 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11229 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
11230 LDKAnnouncementSignatures obj_conv;
11231 obj_conv.inner = (void*)(obj & (~1));
11232 obj_conv.is_owned = (obj & 1) || (obj == 0);
11233 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
11234 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11235 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11236 CVec_u8Z_free(arg_var);
11240 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11241 LDKu8slice ser_ref;
11242 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11243 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11244 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
11245 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11246 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11247 long ret_ref = (long)ret_var.inner;
11248 if (ret_var.is_owned) {
11251 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11255 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
11256 LDKChannelReestablish obj_conv;
11257 obj_conv.inner = (void*)(obj & (~1));
11258 obj_conv.is_owned = (obj & 1) || (obj == 0);
11259 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
11260 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11261 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11262 CVec_u8Z_free(arg_var);
11266 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11267 LDKu8slice ser_ref;
11268 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11269 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11270 LDKChannelReestablish ret_var = ChannelReestablish_read(ser_ref);
11271 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11272 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11273 long ret_ref = (long)ret_var.inner;
11274 if (ret_var.is_owned) {
11277 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11281 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11282 LDKClosingSigned obj_conv;
11283 obj_conv.inner = (void*)(obj & (~1));
11284 obj_conv.is_owned = (obj & 1) || (obj == 0);
11285 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
11286 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11287 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11288 CVec_u8Z_free(arg_var);
11292 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11293 LDKu8slice ser_ref;
11294 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11295 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11296 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
11297 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11298 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11299 long ret_ref = (long)ret_var.inner;
11300 if (ret_var.is_owned) {
11303 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11307 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11308 LDKCommitmentSigned obj_conv;
11309 obj_conv.inner = (void*)(obj & (~1));
11310 obj_conv.is_owned = (obj & 1) || (obj == 0);
11311 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
11312 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11313 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11314 CVec_u8Z_free(arg_var);
11318 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11319 LDKu8slice ser_ref;
11320 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11321 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11322 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
11323 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11324 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11325 long ret_ref = (long)ret_var.inner;
11326 if (ret_var.is_owned) {
11329 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11333 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
11334 LDKFundingCreated obj_conv;
11335 obj_conv.inner = (void*)(obj & (~1));
11336 obj_conv.is_owned = (obj & 1) || (obj == 0);
11337 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
11338 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11339 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11340 CVec_u8Z_free(arg_var);
11344 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11345 LDKu8slice ser_ref;
11346 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11347 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11348 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
11349 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11350 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11351 long ret_ref = (long)ret_var.inner;
11352 if (ret_var.is_owned) {
11355 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11359 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11360 LDKFundingSigned obj_conv;
11361 obj_conv.inner = (void*)(obj & (~1));
11362 obj_conv.is_owned = (obj & 1) || (obj == 0);
11363 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
11364 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11365 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11366 CVec_u8Z_free(arg_var);
11370 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11371 LDKu8slice ser_ref;
11372 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11373 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11374 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
11375 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11376 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11377 long ret_ref = (long)ret_var.inner;
11378 if (ret_var.is_owned) {
11381 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11385 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
11386 LDKFundingLocked obj_conv;
11387 obj_conv.inner = (void*)(obj & (~1));
11388 obj_conv.is_owned = (obj & 1) || (obj == 0);
11389 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
11390 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11391 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11392 CVec_u8Z_free(arg_var);
11396 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11397 LDKu8slice ser_ref;
11398 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11399 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11400 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
11401 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11402 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11403 long ret_ref = (long)ret_var.inner;
11404 if (ret_var.is_owned) {
11407 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11411 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
11413 obj_conv.inner = (void*)(obj & (~1));
11414 obj_conv.is_owned = (obj & 1) || (obj == 0);
11415 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
11416 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11417 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11418 CVec_u8Z_free(arg_var);
11422 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11423 LDKu8slice ser_ref;
11424 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11425 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11426 LDKInit ret_var = Init_read(ser_ref);
11427 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11428 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11429 long ret_ref = (long)ret_var.inner;
11430 if (ret_var.is_owned) {
11433 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11437 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11438 LDKOpenChannel obj_conv;
11439 obj_conv.inner = (void*)(obj & (~1));
11440 obj_conv.is_owned = (obj & 1) || (obj == 0);
11441 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
11442 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11443 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11444 CVec_u8Z_free(arg_var);
11448 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11449 LDKu8slice ser_ref;
11450 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11451 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11452 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
11453 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11454 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11455 long ret_ref = (long)ret_var.inner;
11456 if (ret_var.is_owned) {
11459 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11463 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
11464 LDKRevokeAndACK obj_conv;
11465 obj_conv.inner = (void*)(obj & (~1));
11466 obj_conv.is_owned = (obj & 1) || (obj == 0);
11467 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
11468 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11469 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11470 CVec_u8Z_free(arg_var);
11474 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11475 LDKu8slice ser_ref;
11476 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11477 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11478 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
11479 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11480 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11481 long ret_ref = (long)ret_var.inner;
11482 if (ret_var.is_owned) {
11485 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11489 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
11490 LDKShutdown obj_conv;
11491 obj_conv.inner = (void*)(obj & (~1));
11492 obj_conv.is_owned = (obj & 1) || (obj == 0);
11493 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
11494 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11495 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11496 CVec_u8Z_free(arg_var);
11500 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11501 LDKu8slice ser_ref;
11502 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11503 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11504 LDKShutdown ret_var = Shutdown_read(ser_ref);
11505 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11506 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11507 long ret_ref = (long)ret_var.inner;
11508 if (ret_var.is_owned) {
11511 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11515 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11516 LDKUpdateFailHTLC obj_conv;
11517 obj_conv.inner = (void*)(obj & (~1));
11518 obj_conv.is_owned = (obj & 1) || (obj == 0);
11519 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
11520 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11521 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11522 CVec_u8Z_free(arg_var);
11526 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11527 LDKu8slice ser_ref;
11528 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11529 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11530 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
11531 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11532 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11533 long ret_ref = (long)ret_var.inner;
11534 if (ret_var.is_owned) {
11537 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11541 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11542 LDKUpdateFailMalformedHTLC obj_conv;
11543 obj_conv.inner = (void*)(obj & (~1));
11544 obj_conv.is_owned = (obj & 1) || (obj == 0);
11545 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
11546 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11547 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11548 CVec_u8Z_free(arg_var);
11552 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11553 LDKu8slice ser_ref;
11554 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11555 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11556 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
11557 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11558 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11559 long ret_ref = (long)ret_var.inner;
11560 if (ret_var.is_owned) {
11563 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11567 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
11568 LDKUpdateFee obj_conv;
11569 obj_conv.inner = (void*)(obj & (~1));
11570 obj_conv.is_owned = (obj & 1) || (obj == 0);
11571 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
11572 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11573 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11574 CVec_u8Z_free(arg_var);
11578 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11579 LDKu8slice ser_ref;
11580 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11581 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11582 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
11583 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11584 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11585 long ret_ref = (long)ret_var.inner;
11586 if (ret_var.is_owned) {
11589 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11593 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11594 LDKUpdateFulfillHTLC obj_conv;
11595 obj_conv.inner = (void*)(obj & (~1));
11596 obj_conv.is_owned = (obj & 1) || (obj == 0);
11597 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
11598 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11599 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11600 CVec_u8Z_free(arg_var);
11604 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11605 LDKu8slice ser_ref;
11606 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11607 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11608 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
11609 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11610 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11611 long ret_ref = (long)ret_var.inner;
11612 if (ret_var.is_owned) {
11615 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11619 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11620 LDKUpdateAddHTLC obj_conv;
11621 obj_conv.inner = (void*)(obj & (~1));
11622 obj_conv.is_owned = (obj & 1) || (obj == 0);
11623 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
11624 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11625 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11626 CVec_u8Z_free(arg_var);
11630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11631 LDKu8slice ser_ref;
11632 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11633 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11634 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
11635 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11636 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11637 long ret_ref = (long)ret_var.inner;
11638 if (ret_var.is_owned) {
11641 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11645 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
11647 obj_conv.inner = (void*)(obj & (~1));
11648 obj_conv.is_owned = (obj & 1) || (obj == 0);
11649 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
11650 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11651 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11652 CVec_u8Z_free(arg_var);
11656 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11657 LDKu8slice ser_ref;
11658 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11659 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11660 LDKPing ret_var = Ping_read(ser_ref);
11661 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11662 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11663 long ret_ref = (long)ret_var.inner;
11664 if (ret_var.is_owned) {
11667 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11671 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
11673 obj_conv.inner = (void*)(obj & (~1));
11674 obj_conv.is_owned = (obj & 1) || (obj == 0);
11675 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
11676 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11677 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11678 CVec_u8Z_free(arg_var);
11682 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11683 LDKu8slice ser_ref;
11684 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11685 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11686 LDKPong ret_var = Pong_read(ser_ref);
11687 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11688 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11689 long ret_ref = (long)ret_var.inner;
11690 if (ret_var.is_owned) {
11693 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11697 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11698 LDKUnsignedChannelAnnouncement obj_conv;
11699 obj_conv.inner = (void*)(obj & (~1));
11700 obj_conv.is_owned = (obj & 1) || (obj == 0);
11701 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
11702 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11703 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11704 CVec_u8Z_free(arg_var);
11708 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11709 LDKu8slice ser_ref;
11710 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11711 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11712 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_read(ser_ref);
11713 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11714 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11715 long ret_ref = (long)ret_var.inner;
11716 if (ret_var.is_owned) {
11719 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11723 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11724 LDKChannelAnnouncement obj_conv;
11725 obj_conv.inner = (void*)(obj & (~1));
11726 obj_conv.is_owned = (obj & 1) || (obj == 0);
11727 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
11728 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11729 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11730 CVec_u8Z_free(arg_var);
11734 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11735 LDKu8slice ser_ref;
11736 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11737 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11738 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
11739 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11740 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11741 long ret_ref = (long)ret_var.inner;
11742 if (ret_var.is_owned) {
11745 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11749 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
11750 LDKUnsignedChannelUpdate obj_conv;
11751 obj_conv.inner = (void*)(obj & (~1));
11752 obj_conv.is_owned = (obj & 1) || (obj == 0);
11753 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
11754 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11755 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11756 CVec_u8Z_free(arg_var);
11760 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11761 LDKu8slice ser_ref;
11762 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11763 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11764 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_read(ser_ref);
11765 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11766 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11767 long ret_ref = (long)ret_var.inner;
11768 if (ret_var.is_owned) {
11771 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11775 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
11776 LDKChannelUpdate obj_conv;
11777 obj_conv.inner = (void*)(obj & (~1));
11778 obj_conv.is_owned = (obj & 1) || (obj == 0);
11779 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
11780 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11781 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11782 CVec_u8Z_free(arg_var);
11786 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11787 LDKu8slice ser_ref;
11788 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11789 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11790 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
11791 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11792 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11793 long ret_ref = (long)ret_var.inner;
11794 if (ret_var.is_owned) {
11797 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11801 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
11802 LDKErrorMessage obj_conv;
11803 obj_conv.inner = (void*)(obj & (~1));
11804 obj_conv.is_owned = (obj & 1) || (obj == 0);
11805 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
11806 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11807 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11808 CVec_u8Z_free(arg_var);
11812 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11813 LDKu8slice ser_ref;
11814 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11815 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11816 LDKErrorMessage ret_var = ErrorMessage_read(ser_ref);
11817 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11818 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11819 long ret_ref = (long)ret_var.inner;
11820 if (ret_var.is_owned) {
11823 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11827 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11828 LDKUnsignedNodeAnnouncement obj_conv;
11829 obj_conv.inner = (void*)(obj & (~1));
11830 obj_conv.is_owned = (obj & 1) || (obj == 0);
11831 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
11832 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11833 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11834 CVec_u8Z_free(arg_var);
11838 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11839 LDKu8slice ser_ref;
11840 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11841 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11842 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_read(ser_ref);
11843 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11844 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11845 long ret_ref = (long)ret_var.inner;
11846 if (ret_var.is_owned) {
11849 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11853 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11854 LDKNodeAnnouncement obj_conv;
11855 obj_conv.inner = (void*)(obj & (~1));
11856 obj_conv.is_owned = (obj & 1) || (obj == 0);
11857 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
11858 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11859 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11860 CVec_u8Z_free(arg_var);
11864 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11865 LDKu8slice ser_ref;
11866 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11867 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11868 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
11869 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11870 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11871 long ret_ref = (long)ret_var.inner;
11872 if (ret_var.is_owned) {
11875 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_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 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_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_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
11895 LDKQueryShortChannelIds obj_conv;
11896 obj_conv.inner = (void*)(obj & (~1));
11897 obj_conv.is_owned = (obj & 1) || (obj == 0);
11898 LDKCVec_u8Z arg_var = QueryShortChannelIds_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_ReplyShortChannelIdsEnd_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 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_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_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
11921 LDKReplyShortChannelIdsEnd obj_conv;
11922 obj_conv.inner = (void*)(obj & (~1));
11923 obj_conv.is_owned = (obj & 1) || (obj == 0);
11924 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_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_QueryChannelRange_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 LDKQueryChannelRange ret_var = QueryChannelRange_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_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
11947 LDKQueryChannelRange obj_conv;
11948 obj_conv.inner = (void*)(obj & (~1));
11949 obj_conv.is_owned = (obj & 1) || (obj == 0);
11950 LDKCVec_u8Z arg_var = QueryChannelRange_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_ReplyChannelRange_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 LDKReplyChannelRange ret_var = ReplyChannelRange_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_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
11973 LDKReplyChannelRange obj_conv;
11974 obj_conv.inner = (void*)(obj & (~1));
11975 obj_conv.is_owned = (obj & 1) || (obj == 0);
11976 LDKCVec_u8Z arg_var = ReplyChannelRange_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_GossipTimestampFilter_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 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_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_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
11999 LDKGossipTimestampFilter obj_conv;
12000 obj_conv.inner = (void*)(obj & (~1));
12001 obj_conv.is_owned = (obj & 1) || (obj == 0);
12002 LDKCVec_u8Z arg_var = GossipTimestampFilter_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 void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12010 LDKMessageHandler this_ptr_conv;
12011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12012 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12013 MessageHandler_free(this_ptr_conv);
12016 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12017 LDKMessageHandler this_ptr_conv;
12018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12019 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12020 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
12024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12025 LDKMessageHandler this_ptr_conv;
12026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12027 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12028 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
12029 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
12030 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12031 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
12033 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
12036 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12037 LDKMessageHandler this_ptr_conv;
12038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12039 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12040 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
12044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12045 LDKMessageHandler this_ptr_conv;
12046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12047 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12048 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
12049 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12050 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12051 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
12053 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
12056 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
12057 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
12058 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
12059 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12060 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
12062 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
12063 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12064 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12065 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
12067 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
12068 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12069 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12070 long ret_ref = (long)ret_var.inner;
12071 if (ret_var.is_owned) {
12077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12078 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
12079 FREE((void*)this_ptr);
12080 SocketDescriptor_free(this_ptr_conv);
12083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12084 LDKPeerHandleError this_ptr_conv;
12085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12086 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12087 PeerHandleError_free(this_ptr_conv);
12090 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
12091 LDKPeerHandleError this_ptr_conv;
12092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12094 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
12098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12099 LDKPeerHandleError this_ptr_conv;
12100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12101 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12102 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
12105 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
12106 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
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) {
12116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12117 LDKPeerManager this_ptr_conv;
12118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12119 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12120 PeerManager_free(this_ptr_conv);
12123 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) {
12124 LDKMessageHandler message_handler_conv;
12125 message_handler_conv.inner = (void*)(message_handler & (~1));
12126 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
12127 // Warning: we may need a move here but can't clone!
12128 LDKSecretKey our_node_secret_ref;
12129 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
12130 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
12131 unsigned char ephemeral_random_data_arr[32];
12132 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
12133 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
12134 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
12135 LDKLogger logger_conv = *(LDKLogger*)logger;
12136 if (logger_conv.free == LDKLogger_JCalls_free) {
12137 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12138 LDKLogger_JCalls_clone(logger_conv.this_arg);
12140 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
12141 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12142 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12143 long ret_ref = (long)ret_var.inner;
12144 if (ret_var.is_owned) {
12150 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
12151 LDKPeerManager this_arg_conv;
12152 this_arg_conv.inner = (void*)(this_arg & (~1));
12153 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12154 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
12155 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, arr_of_B_clz, NULL);
12156 for (size_t i = 0; i < ret_var.datalen; i++) {
12157 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
12158 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
12159 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
12161 CVec_PublicKeyZ_free(ret_var);
12165 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) {
12166 LDKPeerManager this_arg_conv;
12167 this_arg_conv.inner = (void*)(this_arg & (~1));
12168 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12169 LDKPublicKey their_node_id_ref;
12170 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
12171 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12172 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12173 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12174 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12175 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12177 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
12178 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
12179 return (long)ret_conv;
12182 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12183 LDKPeerManager this_arg_conv;
12184 this_arg_conv.inner = (void*)(this_arg & (~1));
12185 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12186 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12187 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12188 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12189 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12191 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12192 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
12193 return (long)ret_conv;
12196 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12197 LDKPeerManager this_arg_conv;
12198 this_arg_conv.inner = (void*)(this_arg & (~1));
12199 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12200 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12201 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12202 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
12203 return (long)ret_conv;
12206 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
12207 LDKPeerManager this_arg_conv;
12208 this_arg_conv.inner = (void*)(this_arg & (~1));
12209 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12210 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
12211 LDKu8slice data_ref;
12212 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
12213 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
12214 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12215 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
12216 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
12217 return (long)ret_conv;
12220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
12221 LDKPeerManager this_arg_conv;
12222 this_arg_conv.inner = (void*)(this_arg & (~1));
12223 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12224 PeerManager_process_events(&this_arg_conv);
12227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12228 LDKPeerManager this_arg_conv;
12229 this_arg_conv.inner = (void*)(this_arg & (~1));
12230 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12231 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12232 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
12235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
12236 LDKPeerManager this_arg_conv;
12237 this_arg_conv.inner = (void*)(this_arg & (~1));
12238 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12239 PeerManager_timer_tick_occured(&this_arg_conv);
12242 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
12243 unsigned char commitment_seed_arr[32];
12244 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
12245 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
12246 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
12247 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
12248 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
12252 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
12253 LDKPublicKey per_commitment_point_ref;
12254 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12255 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12256 unsigned char base_secret_arr[32];
12257 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
12258 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
12259 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
12260 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12261 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
12262 return (long)ret_conv;
12265 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
12266 LDKPublicKey per_commitment_point_ref;
12267 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12268 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12269 LDKPublicKey base_point_ref;
12270 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
12271 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
12272 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12273 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
12274 return (long)ret_conv;
12277 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) {
12278 unsigned char per_commitment_secret_arr[32];
12279 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
12280 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
12281 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
12282 unsigned char countersignatory_revocation_base_secret_arr[32];
12283 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
12284 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
12285 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
12286 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12287 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
12288 return (long)ret_conv;
12291 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) {
12292 LDKPublicKey per_commitment_point_ref;
12293 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12294 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12295 LDKPublicKey countersignatory_revocation_base_point_ref;
12296 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
12297 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
12298 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12299 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
12300 return (long)ret_conv;
12303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12304 LDKTxCreationKeys this_ptr_conv;
12305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12306 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12307 TxCreationKeys_free(this_ptr_conv);
12310 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12311 LDKTxCreationKeys orig_conv;
12312 orig_conv.inner = (void*)(orig & (~1));
12313 orig_conv.is_owned = (orig & 1) || (orig == 0);
12314 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
12315 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12316 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12317 long ret_ref = (long)ret_var.inner;
12318 if (ret_var.is_owned) {
12324 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12325 LDKTxCreationKeys this_ptr_conv;
12326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12327 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12328 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12329 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
12333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12334 LDKTxCreationKeys this_ptr_conv;
12335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12336 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12337 LDKPublicKey val_ref;
12338 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12339 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12340 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
12343 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12344 LDKTxCreationKeys this_ptr_conv;
12345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12346 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12347 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12348 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
12352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12353 LDKTxCreationKeys this_ptr_conv;
12354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12355 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12356 LDKPublicKey val_ref;
12357 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12358 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12359 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
12362 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12363 LDKTxCreationKeys this_ptr_conv;
12364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12365 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12366 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12367 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
12371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12372 LDKTxCreationKeys this_ptr_conv;
12373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12374 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12375 LDKPublicKey val_ref;
12376 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12377 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12378 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
12381 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12382 LDKTxCreationKeys this_ptr_conv;
12383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12384 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12385 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12386 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
12390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12391 LDKTxCreationKeys this_ptr_conv;
12392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12393 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12394 LDKPublicKey val_ref;
12395 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12396 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12397 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
12400 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12401 LDKTxCreationKeys this_ptr_conv;
12402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12404 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12405 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
12409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12410 LDKTxCreationKeys this_ptr_conv;
12411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12412 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12413 LDKPublicKey val_ref;
12414 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12415 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12416 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
12419 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) {
12420 LDKPublicKey per_commitment_point_arg_ref;
12421 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
12422 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
12423 LDKPublicKey revocation_key_arg_ref;
12424 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
12425 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
12426 LDKPublicKey broadcaster_htlc_key_arg_ref;
12427 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
12428 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
12429 LDKPublicKey countersignatory_htlc_key_arg_ref;
12430 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
12431 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
12432 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
12433 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
12434 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
12435 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);
12436 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12437 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12438 long ret_ref = (long)ret_var.inner;
12439 if (ret_var.is_owned) {
12445 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12446 LDKTxCreationKeys obj_conv;
12447 obj_conv.inner = (void*)(obj & (~1));
12448 obj_conv.is_owned = (obj & 1) || (obj == 0);
12449 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
12450 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12451 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12452 CVec_u8Z_free(arg_var);
12456 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12457 LDKu8slice ser_ref;
12458 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12459 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12460 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
12461 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12462 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12463 long ret_ref = (long)ret_var.inner;
12464 if (ret_var.is_owned) {
12467 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12472 LDKPreCalculatedTxCreationKeys this_ptr_conv;
12473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12474 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12475 PreCalculatedTxCreationKeys_free(this_ptr_conv);
12478 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
12479 LDKTxCreationKeys keys_conv;
12480 keys_conv.inner = (void*)(keys & (~1));
12481 keys_conv.is_owned = (keys & 1) || (keys == 0);
12482 if (keys_conv.inner != NULL)
12483 keys_conv = TxCreationKeys_clone(&keys_conv);
12484 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_new(keys_conv);
12485 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12486 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12487 long ret_ref = (long)ret_var.inner;
12488 if (ret_var.is_owned) {
12494 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
12495 LDKPreCalculatedTxCreationKeys this_arg_conv;
12496 this_arg_conv.inner = (void*)(this_arg & (~1));
12497 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12498 LDKTxCreationKeys ret_var = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
12499 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12500 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12501 long ret_ref = (long)ret_var.inner;
12502 if (ret_var.is_owned) {
12508 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
12509 LDKPreCalculatedTxCreationKeys this_arg_conv;
12510 this_arg_conv.inner = (void*)(this_arg & (~1));
12511 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12512 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12513 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
12517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12518 LDKChannelPublicKeys this_ptr_conv;
12519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12520 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12521 ChannelPublicKeys_free(this_ptr_conv);
12524 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12525 LDKChannelPublicKeys orig_conv;
12526 orig_conv.inner = (void*)(orig & (~1));
12527 orig_conv.is_owned = (orig & 1) || (orig == 0);
12528 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
12529 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12530 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12531 long ret_ref = (long)ret_var.inner;
12532 if (ret_var.is_owned) {
12538 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
12539 LDKChannelPublicKeys this_ptr_conv;
12540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12541 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12542 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12543 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
12547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12548 LDKChannelPublicKeys this_ptr_conv;
12549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12551 LDKPublicKey val_ref;
12552 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12553 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12554 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
12557 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12558 LDKChannelPublicKeys this_ptr_conv;
12559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12560 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12561 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12562 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
12566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12567 LDKChannelPublicKeys this_ptr_conv;
12568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12569 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12570 LDKPublicKey val_ref;
12571 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12572 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12573 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
12576 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12577 LDKChannelPublicKeys this_ptr_conv;
12578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12579 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12580 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12581 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
12585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12586 LDKChannelPublicKeys this_ptr_conv;
12587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12588 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12589 LDKPublicKey val_ref;
12590 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12591 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12592 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
12595 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12596 LDKChannelPublicKeys this_ptr_conv;
12597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12599 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12600 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
12604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12605 LDKChannelPublicKeys this_ptr_conv;
12606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12607 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12608 LDKPublicKey val_ref;
12609 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12610 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12611 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12614 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12615 LDKChannelPublicKeys this_ptr_conv;
12616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12617 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12618 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12619 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
12623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12624 LDKChannelPublicKeys this_ptr_conv;
12625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12626 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12627 LDKPublicKey val_ref;
12628 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12629 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12630 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
12633 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) {
12634 LDKPublicKey funding_pubkey_arg_ref;
12635 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
12636 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
12637 LDKPublicKey revocation_basepoint_arg_ref;
12638 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
12639 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
12640 LDKPublicKey payment_point_arg_ref;
12641 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
12642 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
12643 LDKPublicKey delayed_payment_basepoint_arg_ref;
12644 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
12645 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
12646 LDKPublicKey htlc_basepoint_arg_ref;
12647 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
12648 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
12649 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);
12650 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12651 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12652 long ret_ref = (long)ret_var.inner;
12653 if (ret_var.is_owned) {
12659 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12660 LDKChannelPublicKeys obj_conv;
12661 obj_conv.inner = (void*)(obj & (~1));
12662 obj_conv.is_owned = (obj & 1) || (obj == 0);
12663 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
12664 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12665 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12666 CVec_u8Z_free(arg_var);
12670 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12671 LDKu8slice ser_ref;
12672 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12673 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12674 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
12675 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12676 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12677 long ret_ref = (long)ret_var.inner;
12678 if (ret_var.is_owned) {
12681 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12685 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) {
12686 LDKPublicKey per_commitment_point_ref;
12687 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12688 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12689 LDKPublicKey broadcaster_delayed_payment_base_ref;
12690 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
12691 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
12692 LDKPublicKey broadcaster_htlc_base_ref;
12693 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
12694 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
12695 LDKPublicKey countersignatory_revocation_base_ref;
12696 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
12697 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
12698 LDKPublicKey countersignatory_htlc_base_ref;
12699 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
12700 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
12701 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
12702 *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);
12703 return (long)ret_conv;
12706 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) {
12707 LDKPublicKey revocation_key_ref;
12708 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
12709 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
12710 LDKPublicKey broadcaster_delayed_payment_key_ref;
12711 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
12712 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
12713 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
12714 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12715 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12716 CVec_u8Z_free(arg_var);
12720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12721 LDKHTLCOutputInCommitment this_ptr_conv;
12722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12724 HTLCOutputInCommitment_free(this_ptr_conv);
12727 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12728 LDKHTLCOutputInCommitment orig_conv;
12729 orig_conv.inner = (void*)(orig & (~1));
12730 orig_conv.is_owned = (orig & 1) || (orig == 0);
12731 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
12732 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12733 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12734 long ret_ref = (long)ret_var.inner;
12735 if (ret_var.is_owned) {
12741 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
12742 LDKHTLCOutputInCommitment this_ptr_conv;
12743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12744 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12745 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
12749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12750 LDKHTLCOutputInCommitment this_ptr_conv;
12751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12752 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12753 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
12756 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12757 LDKHTLCOutputInCommitment this_ptr_conv;
12758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12759 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12760 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
12764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12765 LDKHTLCOutputInCommitment this_ptr_conv;
12766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12767 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12768 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
12771 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
12772 LDKHTLCOutputInCommitment this_ptr_conv;
12773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12774 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12775 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
12779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12780 LDKHTLCOutputInCommitment this_ptr_conv;
12781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12782 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12783 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
12786 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
12787 LDKHTLCOutputInCommitment this_ptr_conv;
12788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12789 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12790 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12791 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
12795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12796 LDKHTLCOutputInCommitment this_ptr_conv;
12797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12799 LDKThirtyTwoBytes val_ref;
12800 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12801 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12802 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
12805 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
12806 LDKHTLCOutputInCommitment obj_conv;
12807 obj_conv.inner = (void*)(obj & (~1));
12808 obj_conv.is_owned = (obj & 1) || (obj == 0);
12809 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
12810 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12811 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12812 CVec_u8Z_free(arg_var);
12816 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12817 LDKu8slice ser_ref;
12818 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12819 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12820 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
12821 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12822 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12823 long ret_ref = (long)ret_var.inner;
12824 if (ret_var.is_owned) {
12827 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12831 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
12832 LDKHTLCOutputInCommitment htlc_conv;
12833 htlc_conv.inner = (void*)(htlc & (~1));
12834 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
12835 LDKTxCreationKeys keys_conv;
12836 keys_conv.inner = (void*)(keys & (~1));
12837 keys_conv.is_owned = (keys & 1) || (keys == 0);
12838 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
12839 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12840 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12841 CVec_u8Z_free(arg_var);
12845 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
12846 LDKPublicKey broadcaster_ref;
12847 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
12848 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
12849 LDKPublicKey countersignatory_ref;
12850 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
12851 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
12852 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
12853 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12854 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12855 CVec_u8Z_free(arg_var);
12859 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) {
12860 unsigned char prev_hash_arr[32];
12861 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
12862 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
12863 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
12864 LDKHTLCOutputInCommitment htlc_conv;
12865 htlc_conv.inner = (void*)(htlc & (~1));
12866 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
12867 LDKPublicKey broadcaster_delayed_payment_key_ref;
12868 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
12869 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
12870 LDKPublicKey revocation_key_ref;
12871 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
12872 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
12873 LDKTransaction *ret_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
12874 *ret_copy = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
12875 long ret_ref = (long)ret_copy;
12879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12880 LDKHolderCommitmentTransaction 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 HolderCommitmentTransaction_free(this_ptr_conv);
12886 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12887 LDKHolderCommitmentTransaction orig_conv;
12888 orig_conv.inner = (void*)(orig & (~1));
12889 orig_conv.is_owned = (orig & 1) || (orig == 0);
12890 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_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 jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
12901 LDKHolderCommitmentTransaction this_ptr_conv;
12902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12903 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12904 LDKTransaction *ret_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
12905 *ret_copy = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
12906 long ret_ref = (long)ret_copy;
12910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12911 LDKHolderCommitmentTransaction this_ptr_conv;
12912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12913 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12914 LDKTransaction val_conv = *(LDKTransaction*)val;
12915 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
12918 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
12919 LDKHolderCommitmentTransaction this_ptr_conv;
12920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12921 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12922 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
12923 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
12927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12928 LDKHolderCommitmentTransaction this_ptr_conv;
12929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12930 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12931 LDKSignature val_ref;
12932 CHECK((*_env)->GetArrayLength (_env, val) == 64);
12933 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
12934 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
12937 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
12938 LDKHolderCommitmentTransaction this_ptr_conv;
12939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12940 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12941 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
12945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12946 LDKHolderCommitmentTransaction this_ptr_conv;
12947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12948 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12949 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
12952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
12953 LDKHolderCommitmentTransaction this_ptr_conv;
12954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12955 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12956 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_constr;
12957 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12958 if (val_constr.datalen > 0)
12959 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
12961 val_constr.data = NULL;
12962 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
12963 for (size_t q = 0; q < val_constr.datalen; q++) {
12964 long arr_conv_42 = val_vals[q];
12965 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
12966 FREE((void*)arr_conv_42);
12967 val_constr.data[q] = arr_conv_42_conv;
12969 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
12970 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_constr);
12973 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) {
12974 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
12975 LDKSignature counterparty_sig_ref;
12976 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
12977 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
12978 LDKPublicKey holder_funding_key_ref;
12979 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
12980 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
12981 LDKPublicKey counterparty_funding_key_ref;
12982 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
12983 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
12984 LDKTxCreationKeys keys_conv;
12985 keys_conv.inner = (void*)(keys & (~1));
12986 keys_conv.is_owned = (keys & 1) || (keys == 0);
12987 if (keys_conv.inner != NULL)
12988 keys_conv = TxCreationKeys_clone(&keys_conv);
12989 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_constr;
12990 htlc_data_constr.datalen = (*_env)->GetArrayLength (_env, htlc_data);
12991 if (htlc_data_constr.datalen > 0)
12992 htlc_data_constr.data = MALLOC(htlc_data_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
12994 htlc_data_constr.data = NULL;
12995 long* htlc_data_vals = (*_env)->GetLongArrayElements (_env, htlc_data, NULL);
12996 for (size_t q = 0; q < htlc_data_constr.datalen; q++) {
12997 long arr_conv_42 = htlc_data_vals[q];
12998 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
12999 FREE((void*)arr_conv_42);
13000 htlc_data_constr.data[q] = arr_conv_42_conv;
13002 (*_env)->ReleaseLongArrayElements (_env, htlc_data, htlc_data_vals, 0);
13003 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);
13004 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13005 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13006 long ret_ref = (long)ret_var.inner;
13007 if (ret_var.is_owned) {
13013 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
13014 LDKHolderCommitmentTransaction this_arg_conv;
13015 this_arg_conv.inner = (void*)(this_arg & (~1));
13016 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13017 LDKTxCreationKeys ret_var = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
13018 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13019 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13020 long ret_ref = (long)ret_var.inner;
13021 if (ret_var.is_owned) {
13027 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
13028 LDKHolderCommitmentTransaction this_arg_conv;
13029 this_arg_conv.inner = (void*)(this_arg & (~1));
13030 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13031 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
13032 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
13036 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) {
13037 LDKHolderCommitmentTransaction this_arg_conv;
13038 this_arg_conv.inner = (void*)(this_arg & (~1));
13039 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13040 unsigned char funding_key_arr[32];
13041 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
13042 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
13043 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
13044 LDKu8slice funding_redeemscript_ref;
13045 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
13046 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
13047 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
13048 (*_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);
13049 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
13053 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) {
13054 LDKHolderCommitmentTransaction this_arg_conv;
13055 this_arg_conv.inner = (void*)(this_arg & (~1));
13056 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13057 unsigned char htlc_base_key_arr[32];
13058 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
13059 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
13060 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
13061 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
13062 *ret_conv = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
13063 return (long)ret_conv;
13066 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
13067 LDKHolderCommitmentTransaction obj_conv;
13068 obj_conv.inner = (void*)(obj & (~1));
13069 obj_conv.is_owned = (obj & 1) || (obj == 0);
13070 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
13071 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13072 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13073 CVec_u8Z_free(arg_var);
13077 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13078 LDKu8slice ser_ref;
13079 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13080 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13081 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
13082 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13083 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13084 long ret_ref = (long)ret_var.inner;
13085 if (ret_var.is_owned) {
13088 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13093 LDKInitFeatures this_ptr_conv;
13094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13095 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13096 InitFeatures_free(this_ptr_conv);
13099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13100 LDKNodeFeatures this_ptr_conv;
13101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13102 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13103 NodeFeatures_free(this_ptr_conv);
13106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13107 LDKChannelFeatures this_ptr_conv;
13108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13109 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13110 ChannelFeatures_free(this_ptr_conv);
13113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13114 LDKRouteHop this_ptr_conv;
13115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13116 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13117 RouteHop_free(this_ptr_conv);
13120 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13121 LDKRouteHop orig_conv;
13122 orig_conv.inner = (void*)(orig & (~1));
13123 orig_conv.is_owned = (orig & 1) || (orig == 0);
13124 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
13125 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13126 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13127 long ret_ref = (long)ret_var.inner;
13128 if (ret_var.is_owned) {
13134 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
13135 LDKRouteHop this_ptr_conv;
13136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13137 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13138 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13139 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
13143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13144 LDKRouteHop this_ptr_conv;
13145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13146 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13147 LDKPublicKey val_ref;
13148 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13149 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13150 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
13153 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13154 LDKRouteHop this_ptr_conv;
13155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13156 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13157 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
13158 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13159 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13160 long ret_ref = (long)ret_var.inner;
13161 if (ret_var.is_owned) {
13167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13168 LDKRouteHop this_ptr_conv;
13169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13170 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13171 LDKNodeFeatures val_conv;
13172 val_conv.inner = (void*)(val & (~1));
13173 val_conv.is_owned = (val & 1) || (val == 0);
13174 // Warning: we may need a move here but can't clone!
13175 RouteHop_set_node_features(&this_ptr_conv, val_conv);
13178 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13179 LDKRouteHop this_ptr_conv;
13180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13181 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13182 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
13186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13187 LDKRouteHop this_ptr_conv;
13188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13189 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13190 RouteHop_set_short_channel_id(&this_ptr_conv, val);
13193 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13194 LDKRouteHop this_ptr_conv;
13195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13196 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13197 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
13198 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13199 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13200 long ret_ref = (long)ret_var.inner;
13201 if (ret_var.is_owned) {
13207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13208 LDKRouteHop this_ptr_conv;
13209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13210 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13211 LDKChannelFeatures val_conv;
13212 val_conv.inner = (void*)(val & (~1));
13213 val_conv.is_owned = (val & 1) || (val == 0);
13214 // Warning: we may need a move here but can't clone!
13215 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
13218 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13219 LDKRouteHop this_ptr_conv;
13220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13221 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13222 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
13226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13227 LDKRouteHop this_ptr_conv;
13228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13229 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13230 RouteHop_set_fee_msat(&this_ptr_conv, val);
13233 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13234 LDKRouteHop this_ptr_conv;
13235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13236 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13237 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
13241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13242 LDKRouteHop this_ptr_conv;
13243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13244 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13245 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
13248 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) {
13249 LDKPublicKey pubkey_arg_ref;
13250 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
13251 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
13252 LDKNodeFeatures node_features_arg_conv;
13253 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
13254 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
13255 // Warning: we may need a move here but can't clone!
13256 LDKChannelFeatures channel_features_arg_conv;
13257 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
13258 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
13259 // Warning: we may need a move here but can't clone!
13260 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);
13261 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13262 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13263 long ret_ref = (long)ret_var.inner;
13264 if (ret_var.is_owned) {
13270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13271 LDKRoute this_ptr_conv;
13272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13273 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13274 Route_free(this_ptr_conv);
13277 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13278 LDKRoute orig_conv;
13279 orig_conv.inner = (void*)(orig & (~1));
13280 orig_conv.is_owned = (orig & 1) || (orig == 0);
13281 LDKRoute ret_var = Route_clone(&orig_conv);
13282 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13283 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13284 long ret_ref = (long)ret_var.inner;
13285 if (ret_var.is_owned) {
13291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
13292 LDKRoute this_ptr_conv;
13293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13294 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13295 LDKCVec_CVec_RouteHopZZ val_constr;
13296 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13297 if (val_constr.datalen > 0)
13298 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13300 val_constr.data = NULL;
13301 for (size_t m = 0; m < val_constr.datalen; m++) {
13302 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
13303 LDKCVec_RouteHopZ arr_conv_12_constr;
13304 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13305 if (arr_conv_12_constr.datalen > 0)
13306 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13308 arr_conv_12_constr.data = NULL;
13309 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13310 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13311 long arr_conv_10 = arr_conv_12_vals[k];
13312 LDKRouteHop arr_conv_10_conv;
13313 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13314 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13315 if (arr_conv_10_conv.inner != NULL)
13316 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13317 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13319 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13320 val_constr.data[m] = arr_conv_12_constr;
13322 Route_set_paths(&this_ptr_conv, val_constr);
13325 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
13326 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
13327 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
13328 if (paths_arg_constr.datalen > 0)
13329 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13331 paths_arg_constr.data = NULL;
13332 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
13333 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
13334 LDKCVec_RouteHopZ arr_conv_12_constr;
13335 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13336 if (arr_conv_12_constr.datalen > 0)
13337 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13339 arr_conv_12_constr.data = NULL;
13340 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13341 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13342 long arr_conv_10 = arr_conv_12_vals[k];
13343 LDKRouteHop arr_conv_10_conv;
13344 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13345 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13346 if (arr_conv_10_conv.inner != NULL)
13347 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13348 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13350 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13351 paths_arg_constr.data[m] = arr_conv_12_constr;
13353 LDKRoute ret_var = Route_new(paths_arg_constr);
13354 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13355 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13356 long ret_ref = (long)ret_var.inner;
13357 if (ret_var.is_owned) {
13363 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
13365 obj_conv.inner = (void*)(obj & (~1));
13366 obj_conv.is_owned = (obj & 1) || (obj == 0);
13367 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
13368 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13369 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13370 CVec_u8Z_free(arg_var);
13374 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13375 LDKu8slice ser_ref;
13376 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13377 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13378 LDKRoute ret_var = Route_read(ser_ref);
13379 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13380 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13381 long ret_ref = (long)ret_var.inner;
13382 if (ret_var.is_owned) {
13385 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13390 LDKRouteHint this_ptr_conv;
13391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13392 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13393 RouteHint_free(this_ptr_conv);
13396 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13397 LDKRouteHint orig_conv;
13398 orig_conv.inner = (void*)(orig & (~1));
13399 orig_conv.is_owned = (orig & 1) || (orig == 0);
13400 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
13401 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13402 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13403 long ret_ref = (long)ret_var.inner;
13404 if (ret_var.is_owned) {
13410 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13411 LDKRouteHint this_ptr_conv;
13412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13413 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13414 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13415 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
13419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13420 LDKRouteHint this_ptr_conv;
13421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13422 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13423 LDKPublicKey val_ref;
13424 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13425 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13426 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
13429 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13430 LDKRouteHint 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 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
13437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13438 LDKRouteHint this_ptr_conv;
13439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13440 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13441 RouteHint_set_short_channel_id(&this_ptr_conv, val);
13444 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
13445 LDKRouteHint this_ptr_conv;
13446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13447 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13448 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
13449 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13450 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13451 long ret_ref = (long)ret_var.inner;
13452 if (ret_var.is_owned) {
13458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13459 LDKRouteHint this_ptr_conv;
13460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13462 LDKRoutingFees val_conv;
13463 val_conv.inner = (void*)(val & (~1));
13464 val_conv.is_owned = (val & 1) || (val == 0);
13465 if (val_conv.inner != NULL)
13466 val_conv = RoutingFees_clone(&val_conv);
13467 RouteHint_set_fees(&this_ptr_conv, val_conv);
13470 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13471 LDKRouteHint this_ptr_conv;
13472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13473 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13474 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
13478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13479 LDKRouteHint this_ptr_conv;
13480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13481 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13482 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
13485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13486 LDKRouteHint this_ptr_conv;
13487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13488 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13489 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
13493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13494 LDKRouteHint this_ptr_conv;
13495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13496 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13497 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
13500 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) {
13501 LDKPublicKey src_node_id_arg_ref;
13502 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
13503 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
13504 LDKRoutingFees fees_arg_conv;
13505 fees_arg_conv.inner = (void*)(fees_arg & (~1));
13506 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
13507 if (fees_arg_conv.inner != NULL)
13508 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
13509 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);
13510 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13511 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13512 long ret_ref = (long)ret_var.inner;
13513 if (ret_var.is_owned) {
13519 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) {
13520 LDKPublicKey our_node_id_ref;
13521 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
13522 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
13523 LDKNetworkGraph network_conv;
13524 network_conv.inner = (void*)(network & (~1));
13525 network_conv.is_owned = (network & 1) || (network == 0);
13526 LDKPublicKey target_ref;
13527 CHECK((*_env)->GetArrayLength (_env, target) == 33);
13528 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
13529 LDKCVec_ChannelDetailsZ first_hops_constr;
13530 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
13531 if (first_hops_constr.datalen > 0)
13532 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13534 first_hops_constr.data = NULL;
13535 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
13536 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13537 long arr_conv_16 = first_hops_vals[q];
13538 LDKChannelDetails arr_conv_16_conv;
13539 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13540 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13541 first_hops_constr.data[q] = arr_conv_16_conv;
13543 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
13544 LDKCVec_RouteHintZ last_hops_constr;
13545 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
13546 if (last_hops_constr.datalen > 0)
13547 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13549 last_hops_constr.data = NULL;
13550 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
13551 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
13552 long arr_conv_11 = last_hops_vals[l];
13553 LDKRouteHint arr_conv_11_conv;
13554 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
13555 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
13556 if (arr_conv_11_conv.inner != NULL)
13557 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
13558 last_hops_constr.data[l] = arr_conv_11_conv;
13560 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
13561 LDKLogger logger_conv = *(LDKLogger*)logger;
13562 if (logger_conv.free == LDKLogger_JCalls_free) {
13563 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13564 LDKLogger_JCalls_clone(logger_conv.this_arg);
13566 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13567 *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);
13568 FREE(first_hops_constr.data);
13569 return (long)ret_conv;
13572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13573 LDKNetworkGraph this_ptr_conv;
13574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13576 NetworkGraph_free(this_ptr_conv);
13579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13580 LDKLockedNetworkGraph this_ptr_conv;
13581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13582 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13583 LockedNetworkGraph_free(this_ptr_conv);
13586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13587 LDKNetGraphMsgHandler this_ptr_conv;
13588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13589 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13590 NetGraphMsgHandler_free(this_ptr_conv);
13593 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
13594 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13595 LDKLogger logger_conv = *(LDKLogger*)logger;
13596 if (logger_conv.free == LDKLogger_JCalls_free) {
13597 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13598 LDKLogger_JCalls_clone(logger_conv.this_arg);
13600 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
13601 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13602 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13603 long ret_ref = (long)ret_var.inner;
13604 if (ret_var.is_owned) {
13610 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
13611 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13612 LDKLogger logger_conv = *(LDKLogger*)logger;
13613 if (logger_conv.free == LDKLogger_JCalls_free) {
13614 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13615 LDKLogger_JCalls_clone(logger_conv.this_arg);
13617 LDKNetworkGraph network_graph_conv;
13618 network_graph_conv.inner = (void*)(network_graph & (~1));
13619 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
13620 // Warning: we may need a move here but can't clone!
13621 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
13622 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13623 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13624 long ret_ref = (long)ret_var.inner;
13625 if (ret_var.is_owned) {
13631 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13632 LDKNetGraphMsgHandler this_arg_conv;
13633 this_arg_conv.inner = (void*)(this_arg & (~1));
13634 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13635 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
13636 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13637 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13638 long ret_ref = (long)ret_var.inner;
13639 if (ret_var.is_owned) {
13645 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13646 LDKLockedNetworkGraph this_arg_conv;
13647 this_arg_conv.inner = (void*)(this_arg & (~1));
13648 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13649 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
13650 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13651 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13652 long ret_ref = (long)ret_var.inner;
13653 if (ret_var.is_owned) {
13659 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
13660 LDKNetGraphMsgHandler this_arg_conv;
13661 this_arg_conv.inner = (void*)(this_arg & (~1));
13662 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13663 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13664 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
13668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13669 LDKDirectionalChannelInfo this_ptr_conv;
13670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13671 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13672 DirectionalChannelInfo_free(this_ptr_conv);
13675 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
13676 LDKDirectionalChannelInfo this_ptr_conv;
13677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13678 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13679 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
13683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13684 LDKDirectionalChannelInfo this_ptr_conv;
13685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13686 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13687 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
13690 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
13691 LDKDirectionalChannelInfo this_ptr_conv;
13692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13693 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13694 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
13698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
13699 LDKDirectionalChannelInfo this_ptr_conv;
13700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13701 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13702 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
13705 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13706 LDKDirectionalChannelInfo this_ptr_conv;
13707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13709 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
13713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13714 LDKDirectionalChannelInfo this_ptr_conv;
13715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13717 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
13720 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13721 LDKDirectionalChannelInfo this_ptr_conv;
13722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13724 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
13728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13729 LDKDirectionalChannelInfo this_ptr_conv;
13730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13731 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13732 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
13735 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
13736 LDKDirectionalChannelInfo this_ptr_conv;
13737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13739 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
13740 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13741 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13742 long ret_ref = (long)ret_var.inner;
13743 if (ret_var.is_owned) {
13749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13750 LDKDirectionalChannelInfo this_ptr_conv;
13751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13752 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13753 LDKChannelUpdate val_conv;
13754 val_conv.inner = (void*)(val & (~1));
13755 val_conv.is_owned = (val & 1) || (val == 0);
13756 if (val_conv.inner != NULL)
13757 val_conv = ChannelUpdate_clone(&val_conv);
13758 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
13761 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13762 LDKDirectionalChannelInfo obj_conv;
13763 obj_conv.inner = (void*)(obj & (~1));
13764 obj_conv.is_owned = (obj & 1) || (obj == 0);
13765 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
13766 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13767 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13768 CVec_u8Z_free(arg_var);
13772 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13773 LDKu8slice ser_ref;
13774 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13775 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13776 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
13777 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13778 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13779 long ret_ref = (long)ret_var.inner;
13780 if (ret_var.is_owned) {
13783 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13788 LDKChannelInfo this_ptr_conv;
13789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13790 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13791 ChannelInfo_free(this_ptr_conv);
13794 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13795 LDKChannelInfo this_ptr_conv;
13796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13798 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
13799 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13800 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13801 long ret_ref = (long)ret_var.inner;
13802 if (ret_var.is_owned) {
13808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13809 LDKChannelInfo this_ptr_conv;
13810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13811 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13812 LDKChannelFeatures val_conv;
13813 val_conv.inner = (void*)(val & (~1));
13814 val_conv.is_owned = (val & 1) || (val == 0);
13815 // Warning: we may need a move here but can't clone!
13816 ChannelInfo_set_features(&this_ptr_conv, val_conv);
13819 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
13820 LDKChannelInfo this_ptr_conv;
13821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13822 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13823 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13824 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
13828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13829 LDKChannelInfo this_ptr_conv;
13830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13831 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13832 LDKPublicKey val_ref;
13833 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13834 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13835 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
13838 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
13839 LDKChannelInfo this_ptr_conv;
13840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13841 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13842 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
13843 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13844 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13845 long ret_ref = (long)ret_var.inner;
13846 if (ret_var.is_owned) {
13852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13853 LDKChannelInfo this_ptr_conv;
13854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13855 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13856 LDKDirectionalChannelInfo val_conv;
13857 val_conv.inner = (void*)(val & (~1));
13858 val_conv.is_owned = (val & 1) || (val == 0);
13859 // Warning: we may need a move here but can't clone!
13860 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
13863 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
13864 LDKChannelInfo this_ptr_conv;
13865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13866 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13867 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13868 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
13872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13873 LDKChannelInfo this_ptr_conv;
13874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13875 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13876 LDKPublicKey val_ref;
13877 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13878 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13879 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
13882 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
13883 LDKChannelInfo this_ptr_conv;
13884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13885 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13886 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
13887 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13888 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13889 long ret_ref = (long)ret_var.inner;
13890 if (ret_var.is_owned) {
13896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13897 LDKChannelInfo this_ptr_conv;
13898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13899 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13900 LDKDirectionalChannelInfo val_conv;
13901 val_conv.inner = (void*)(val & (~1));
13902 val_conv.is_owned = (val & 1) || (val == 0);
13903 // Warning: we may need a move here but can't clone!
13904 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
13907 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
13908 LDKChannelInfo this_ptr_conv;
13909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13910 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13911 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
13912 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13913 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13914 long ret_ref = (long)ret_var.inner;
13915 if (ret_var.is_owned) {
13921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13922 LDKChannelInfo this_ptr_conv;
13923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13924 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13925 LDKChannelAnnouncement val_conv;
13926 val_conv.inner = (void*)(val & (~1));
13927 val_conv.is_owned = (val & 1) || (val == 0);
13928 if (val_conv.inner != NULL)
13929 val_conv = ChannelAnnouncement_clone(&val_conv);
13930 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
13933 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13934 LDKChannelInfo obj_conv;
13935 obj_conv.inner = (void*)(obj & (~1));
13936 obj_conv.is_owned = (obj & 1) || (obj == 0);
13937 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
13938 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13939 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13940 CVec_u8Z_free(arg_var);
13944 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13945 LDKu8slice ser_ref;
13946 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13947 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13948 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
13949 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13950 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13951 long ret_ref = (long)ret_var.inner;
13952 if (ret_var.is_owned) {
13955 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13960 LDKRoutingFees this_ptr_conv;
13961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13962 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13963 RoutingFees_free(this_ptr_conv);
13966 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13967 LDKRoutingFees orig_conv;
13968 orig_conv.inner = (void*)(orig & (~1));
13969 orig_conv.is_owned = (orig & 1) || (orig == 0);
13970 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
13971 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13972 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13973 long ret_ref = (long)ret_var.inner;
13974 if (ret_var.is_owned) {
13980 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13981 LDKRoutingFees this_ptr_conv;
13982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13983 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13984 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
13988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13989 LDKRoutingFees this_ptr_conv;
13990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13991 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13992 RoutingFees_set_base_msat(&this_ptr_conv, val);
13995 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
13996 LDKRoutingFees this_ptr_conv;
13997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13998 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13999 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
14003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14004 LDKRoutingFees this_ptr_conv;
14005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14006 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14007 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
14010 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
14011 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
14012 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14013 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14014 long ret_ref = (long)ret_var.inner;
14015 if (ret_var.is_owned) {
14021 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14022 LDKu8slice ser_ref;
14023 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14024 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14025 LDKRoutingFees ret_var = RoutingFees_read(ser_ref);
14026 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14027 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14028 long ret_ref = (long)ret_var.inner;
14029 if (ret_var.is_owned) {
14032 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14036 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
14037 LDKRoutingFees obj_conv;
14038 obj_conv.inner = (void*)(obj & (~1));
14039 obj_conv.is_owned = (obj & 1) || (obj == 0);
14040 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
14041 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14042 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14043 CVec_u8Z_free(arg_var);
14047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14048 LDKNodeAnnouncementInfo this_ptr_conv;
14049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14051 NodeAnnouncementInfo_free(this_ptr_conv);
14054 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
14055 LDKNodeAnnouncementInfo this_ptr_conv;
14056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14057 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14058 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
14059 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14060 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14061 long ret_ref = (long)ret_var.inner;
14062 if (ret_var.is_owned) {
14068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14069 LDKNodeAnnouncementInfo this_ptr_conv;
14070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14072 LDKNodeFeatures val_conv;
14073 val_conv.inner = (void*)(val & (~1));
14074 val_conv.is_owned = (val & 1) || (val == 0);
14075 // Warning: we may need a move here but can't clone!
14076 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
14079 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
14080 LDKNodeAnnouncementInfo this_ptr_conv;
14081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14082 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14083 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
14087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14088 LDKNodeAnnouncementInfo this_ptr_conv;
14089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14090 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14091 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
14094 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
14095 LDKNodeAnnouncementInfo this_ptr_conv;
14096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14097 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14098 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
14099 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
14103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14104 LDKNodeAnnouncementInfo this_ptr_conv;
14105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14106 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14107 LDKThreeBytes val_ref;
14108 CHECK((*_env)->GetArrayLength (_env, val) == 3);
14109 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
14110 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
14113 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
14114 LDKNodeAnnouncementInfo this_ptr_conv;
14115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14116 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14117 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
14118 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
14122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14123 LDKNodeAnnouncementInfo this_ptr_conv;
14124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14125 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14126 LDKThirtyTwoBytes val_ref;
14127 CHECK((*_env)->GetArrayLength (_env, val) == 32);
14128 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
14129 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
14132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14133 LDKNodeAnnouncementInfo this_ptr_conv;
14134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14135 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14136 LDKCVec_NetAddressZ val_constr;
14137 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14138 if (val_constr.datalen > 0)
14139 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14141 val_constr.data = NULL;
14142 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14143 for (size_t m = 0; m < val_constr.datalen; m++) {
14144 long arr_conv_12 = val_vals[m];
14145 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14146 FREE((void*)arr_conv_12);
14147 val_constr.data[m] = arr_conv_12_conv;
14149 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14150 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
14153 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14154 LDKNodeAnnouncementInfo this_ptr_conv;
14155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14156 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14157 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
14158 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14159 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14160 long ret_ref = (long)ret_var.inner;
14161 if (ret_var.is_owned) {
14167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14168 LDKNodeAnnouncementInfo this_ptr_conv;
14169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14170 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14171 LDKNodeAnnouncement val_conv;
14172 val_conv.inner = (void*)(val & (~1));
14173 val_conv.is_owned = (val & 1) || (val == 0);
14174 if (val_conv.inner != NULL)
14175 val_conv = NodeAnnouncement_clone(&val_conv);
14176 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
14179 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) {
14180 LDKNodeFeatures features_arg_conv;
14181 features_arg_conv.inner = (void*)(features_arg & (~1));
14182 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
14183 // Warning: we may need a move here but can't clone!
14184 LDKThreeBytes rgb_arg_ref;
14185 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
14186 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
14187 LDKThirtyTwoBytes alias_arg_ref;
14188 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
14189 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
14190 LDKCVec_NetAddressZ addresses_arg_constr;
14191 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
14192 if (addresses_arg_constr.datalen > 0)
14193 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14195 addresses_arg_constr.data = NULL;
14196 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
14197 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
14198 long arr_conv_12 = addresses_arg_vals[m];
14199 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14200 FREE((void*)arr_conv_12);
14201 addresses_arg_constr.data[m] = arr_conv_12_conv;
14203 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
14204 LDKNodeAnnouncement announcement_message_arg_conv;
14205 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
14206 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
14207 if (announcement_message_arg_conv.inner != NULL)
14208 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
14209 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
14210 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14211 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14212 long ret_ref = (long)ret_var.inner;
14213 if (ret_var.is_owned) {
14219 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14220 LDKNodeAnnouncementInfo obj_conv;
14221 obj_conv.inner = (void*)(obj & (~1));
14222 obj_conv.is_owned = (obj & 1) || (obj == 0);
14223 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
14224 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14225 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14226 CVec_u8Z_free(arg_var);
14230 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14231 LDKu8slice ser_ref;
14232 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14233 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14234 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_read(ser_ref);
14235 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14236 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14237 long ret_ref = (long)ret_var.inner;
14238 if (ret_var.is_owned) {
14241 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14246 LDKNodeInfo this_ptr_conv;
14247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14248 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14249 NodeInfo_free(this_ptr_conv);
14252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14253 LDKNodeInfo this_ptr_conv;
14254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14255 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14256 LDKCVec_u64Z val_constr;
14257 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14258 if (val_constr.datalen > 0)
14259 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14261 val_constr.data = NULL;
14262 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14263 for (size_t g = 0; g < val_constr.datalen; g++) {
14264 long arr_conv_6 = val_vals[g];
14265 val_constr.data[g] = arr_conv_6;
14267 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14268 NodeInfo_set_channels(&this_ptr_conv, val_constr);
14271 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
14272 LDKNodeInfo this_ptr_conv;
14273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14274 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14275 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
14276 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14277 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14278 long ret_ref = (long)ret_var.inner;
14279 if (ret_var.is_owned) {
14285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14286 LDKNodeInfo this_ptr_conv;
14287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14288 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14289 LDKRoutingFees val_conv;
14290 val_conv.inner = (void*)(val & (~1));
14291 val_conv.is_owned = (val & 1) || (val == 0);
14292 if (val_conv.inner != NULL)
14293 val_conv = RoutingFees_clone(&val_conv);
14294 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
14297 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
14298 LDKNodeInfo this_ptr_conv;
14299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14300 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14301 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
14302 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14303 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14304 long ret_ref = (long)ret_var.inner;
14305 if (ret_var.is_owned) {
14311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14312 LDKNodeInfo this_ptr_conv;
14313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14314 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14315 LDKNodeAnnouncementInfo val_conv;
14316 val_conv.inner = (void*)(val & (~1));
14317 val_conv.is_owned = (val & 1) || (val == 0);
14318 // Warning: we may need a move here but can't clone!
14319 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
14322 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) {
14323 LDKCVec_u64Z channels_arg_constr;
14324 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
14325 if (channels_arg_constr.datalen > 0)
14326 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14328 channels_arg_constr.data = NULL;
14329 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
14330 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
14331 long arr_conv_6 = channels_arg_vals[g];
14332 channels_arg_constr.data[g] = arr_conv_6;
14334 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
14335 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
14336 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
14337 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
14338 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
14339 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
14340 LDKNodeAnnouncementInfo announcement_info_arg_conv;
14341 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
14342 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
14343 // Warning: we may need a move here but can't clone!
14344 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
14345 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14346 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14347 long ret_ref = (long)ret_var.inner;
14348 if (ret_var.is_owned) {
14354 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14355 LDKNodeInfo obj_conv;
14356 obj_conv.inner = (void*)(obj & (~1));
14357 obj_conv.is_owned = (obj & 1) || (obj == 0);
14358 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
14359 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14360 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14361 CVec_u8Z_free(arg_var);
14365 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14366 LDKu8slice ser_ref;
14367 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14368 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14369 LDKNodeInfo ret_var = NodeInfo_read(ser_ref);
14370 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14371 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14372 long ret_ref = (long)ret_var.inner;
14373 if (ret_var.is_owned) {
14376 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14380 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
14381 LDKNetworkGraph obj_conv;
14382 obj_conv.inner = (void*)(obj & (~1));
14383 obj_conv.is_owned = (obj & 1) || (obj == 0);
14384 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
14385 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14386 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14387 CVec_u8Z_free(arg_var);
14391 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14392 LDKu8slice ser_ref;
14393 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14394 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14395 LDKNetworkGraph ret_var = NetworkGraph_read(ser_ref);
14396 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14397 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14398 long ret_ref = (long)ret_var.inner;
14399 if (ret_var.is_owned) {
14402 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14406 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
14407 LDKNetworkGraph ret_var = NetworkGraph_new();
14408 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14409 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14410 long ret_ref = (long)ret_var.inner;
14411 if (ret_var.is_owned) {
14417 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) {
14418 LDKNetworkGraph this_arg_conv;
14419 this_arg_conv.inner = (void*)(this_arg & (~1));
14420 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
14421 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);