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);
116 static jmethodID ordinal_meth = NULL;
117 static jmethodID slicedef_meth = NULL;
118 static jclass slicedef_cls = NULL;
119 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
120 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
121 CHECK(ordinal_meth != NULL);
122 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
123 CHECK(slicedef_meth != NULL);
124 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
125 CHECK(slicedef_cls != NULL);
128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
129 return *((bool*)ptr);
131 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
132 return *((long*)ptr);
134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
137 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * _env, jclass _b, jlong ptr, jlong len) {
138 jbyteArray ret_arr = (*_env)->NewByteArray(_env, len);
139 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, len, (unsigned char*)ptr);
142 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * _env, jclass _b, jlong slice_ptr) {
143 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
144 jbyteArray ret_arr = (*_env)->NewByteArray(_env, slice->datalen);
145 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, slice->datalen, slice->data);
148 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * _env, jclass _b, jbyteArray bytes) {
149 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
150 vec->datalen = (*_env)->GetArrayLength(_env, bytes);
151 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
152 (*_env)->GetByteArrayRegion (_env, bytes, 0, vec->datalen, vec->data);
155 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
156 LDKTransaction *txdata = (LDKTransaction*)ptr;
158 slice.data = txdata->data;
159 slice.datalen = txdata->datalen;
160 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (long)&slice);
162 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
163 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
164 txdata->datalen = (*env)->GetArrayLength(env, bytes);
165 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
166 txdata->data_is_owned = false;
167 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
171 LDKTransaction *tx = (LDKTransaction*)ptr;
172 tx->data_is_owned = true;
173 Transaction_free(*tx);
176 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
177 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
178 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
179 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
180 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
181 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
182 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
183 return (long)vec->datalen;
185 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * _env, jclass _b) {
186 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
187 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
188 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
189 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
190 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
191 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
197 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
198 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
199 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
200 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
202 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
203 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
204 case 0: return LDKAccessError_UnknownChain;
205 case 1: return LDKAccessError_UnknownTx;
209 static jclass LDKAccessError_class = NULL;
210 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
211 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
212 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv * env, jclass clz) {
213 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
214 CHECK(LDKAccessError_class != NULL);
215 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
216 CHECK(LDKAccessError_LDKAccessError_UnknownChain != NULL);
217 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
218 CHECK(LDKAccessError_LDKAccessError_UnknownTx != NULL);
220 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
222 case LDKAccessError_UnknownChain:
223 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
224 case LDKAccessError_UnknownTx:
225 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
230 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
231 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
232 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
233 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
237 static jclass LDKChannelMonitorUpdateErr_class = NULL;
238 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
239 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
240 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv * env, jclass clz) {
241 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
242 CHECK(LDKChannelMonitorUpdateErr_class != NULL);
243 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
244 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
245 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
246 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
248 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
250 case LDKChannelMonitorUpdateErr_TemporaryFailure:
251 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
252 case LDKChannelMonitorUpdateErr_PermanentFailure:
253 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
258 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
259 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
260 case 0: return LDKConfirmationTarget_Background;
261 case 1: return LDKConfirmationTarget_Normal;
262 case 2: return LDKConfirmationTarget_HighPriority;
266 static jclass LDKConfirmationTarget_class = NULL;
267 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
268 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
269 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
270 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv * env, jclass clz) {
271 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
272 CHECK(LDKConfirmationTarget_class != NULL);
273 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
274 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
275 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
276 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
277 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
278 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
280 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
282 case LDKConfirmationTarget_Background:
283 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
284 case LDKConfirmationTarget_Normal:
285 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
286 case LDKConfirmationTarget_HighPriority:
287 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
292 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
293 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
294 case 0: return LDKLevel_Off;
295 case 1: return LDKLevel_Error;
296 case 2: return LDKLevel_Warn;
297 case 3: return LDKLevel_Info;
298 case 4: return LDKLevel_Debug;
299 case 5: return LDKLevel_Trace;
303 static jclass LDKLevel_class = NULL;
304 static jfieldID LDKLevel_LDKLevel_Off = NULL;
305 static jfieldID LDKLevel_LDKLevel_Error = NULL;
306 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
307 static jfieldID LDKLevel_LDKLevel_Info = NULL;
308 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
309 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
310 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv * env, jclass clz) {
311 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
312 CHECK(LDKLevel_class != NULL);
313 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
314 CHECK(LDKLevel_LDKLevel_Off != NULL);
315 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
316 CHECK(LDKLevel_LDKLevel_Error != NULL);
317 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
318 CHECK(LDKLevel_LDKLevel_Warn != NULL);
319 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
320 CHECK(LDKLevel_LDKLevel_Info != NULL);
321 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
322 CHECK(LDKLevel_LDKLevel_Debug != NULL);
323 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
324 CHECK(LDKLevel_LDKLevel_Trace != NULL);
326 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
329 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
331 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
333 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
335 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
337 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
339 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
344 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
345 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
346 case 0: return LDKNetwork_Bitcoin;
347 case 1: return LDKNetwork_Testnet;
348 case 2: return LDKNetwork_Regtest;
352 static jclass LDKNetwork_class = NULL;
353 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
354 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
355 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
356 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv * env, jclass clz) {
357 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
358 CHECK(LDKNetwork_class != NULL);
359 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
360 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
361 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
362 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
363 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
364 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
366 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
368 case LDKNetwork_Bitcoin:
369 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
370 case LDKNetwork_Testnet:
371 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
372 case LDKNetwork_Regtest:
373 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
378 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
379 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
380 case 0: return LDKSecp256k1Error_IncorrectSignature;
381 case 1: return LDKSecp256k1Error_InvalidMessage;
382 case 2: return LDKSecp256k1Error_InvalidPublicKey;
383 case 3: return LDKSecp256k1Error_InvalidSignature;
384 case 4: return LDKSecp256k1Error_InvalidSecretKey;
385 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
386 case 6: return LDKSecp256k1Error_InvalidTweak;
387 case 7: return LDKSecp256k1Error_NotEnoughMemory;
388 case 8: return LDKSecp256k1Error_CallbackPanicked;
392 static jclass LDKSecp256k1Error_class = NULL;
393 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
394 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
395 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
396 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
397 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
398 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
399 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
400 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
401 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
402 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv * env, jclass clz) {
403 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
404 CHECK(LDKSecp256k1Error_class != NULL);
405 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
406 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
407 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
408 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
409 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
410 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
411 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
412 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
413 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
414 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
415 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
416 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
417 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
418 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
419 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
420 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
421 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
422 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
424 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
426 case LDKSecp256k1Error_IncorrectSignature:
427 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
428 case LDKSecp256k1Error_InvalidMessage:
429 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
430 case LDKSecp256k1Error_InvalidPublicKey:
431 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
432 case LDKSecp256k1Error_InvalidSignature:
433 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
434 case LDKSecp256k1Error_InvalidSecretKey:
435 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
436 case LDKSecp256k1Error_InvalidRecoveryId:
437 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
438 case LDKSecp256k1Error_InvalidTweak:
439 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
440 case LDKSecp256k1Error_NotEnoughMemory:
441 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
442 case LDKSecp256k1Error_CallbackPanicked:
443 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
448 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
449 LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr;
450 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1new(JNIEnv *env, jclass _b, jbyteArray elems){
453 LDKCVecTempl_u8 *ret = MALLOC(sizeof(LDKCVecTempl_u8), "LDKCVecTempl_u8");
454 ret->datalen = (*env)->GetArrayLength(env, elems);
455 if (ret->datalen == 0) {
458 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVecTempl_u8 Data");
459 jbyte *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
460 for (size_t i = 0; i < ret->datalen; i++) {
461 ret->data[i] = java_elems[i];
463 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
467 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
468 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
470 LDKTransaction b_conv = *(LDKTransaction*)b;
474 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
475 LDKC2TupleTempl_usize__Transaction *tuple = (LDKC2TupleTempl_usize__Transaction*)ptr;
478 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
479 LDKC2TupleTempl_usize__Transaction *tuple = (LDKC2TupleTempl_usize__Transaction*)ptr;
480 LDKTransaction *b_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
482 long b_ref = (long)b_copy;
485 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
486 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
488 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
489 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
490 CHECK(val->result_ok);
491 return *val->contents.result;
493 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
494 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
495 CHECK(!val->result_ok);
496 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(_env, (*val->contents.err));
499 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
500 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
502 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
503 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
504 CHECK(val->result_ok);
505 return *val->contents.result;
507 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
508 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
509 CHECK(!val->result_ok);
510 LDKMonitorUpdateError err_var = (*val->contents.err);
511 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
512 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
513 long err_ref = (long)err_var.inner & ~1;
516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
517 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
519 a_conv.inner = (void*)(a & (~1));
520 a_conv.is_owned = (a & 1) || (a == 0);
521 if (a_conv.inner != NULL)
522 a_conv = OutPoint_clone(&a_conv);
525 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
526 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
528 //TODO: Really need to call (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0); here
531 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
532 LDKC2TupleTempl_OutPoint__CVec_u8Z *tuple = (LDKC2TupleTempl_OutPoint__CVec_u8Z*)ptr;
533 LDKOutPoint a_var = tuple->a;
534 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
535 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
536 long a_ref = (long)a_var.inner & ~1;
539 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
540 LDKC2TupleTempl_OutPoint__CVec_u8Z *tuple = (LDKC2TupleTempl_OutPoint__CVec_u8Z*)ptr;
541 LDKCVec_u8Z b_var = tuple->b;
542 jbyteArray b_arr = (*_env)->NewByteArray(_env, b_var.datalen);
543 (*_env)->SetByteArrayRegion(_env, b_arr, 0, b_var.datalen, b_var.data);
546 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
547 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
548 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
550 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
551 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
552 ret->datalen = (*env)->GetArrayLength(env, elems);
553 if (ret->datalen == 0) {
556 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
557 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
558 for (size_t i = 0; i < ret->datalen; i++) {
559 jlong arr_elem = java_elems[i];
560 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
561 FREE((void*)arr_elem);
562 ret->data[i] = arr_elem_conv;
564 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlongArray b) {
569 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
570 LDKThirtyTwoBytes a_ref;
571 CHECK((*_env)->GetArrayLength (_env, a) == 32);
572 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
574 LDKCVecTempl_TxOut b_constr;
575 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
576 if (b_constr.datalen > 0)
577 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVecTempl_TxOut Elements");
579 b_constr.data = NULL;
580 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
581 for (size_t h = 0; h < b_constr.datalen; h++) {
582 long arr_conv_7 = b_vals[h];
583 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
584 FREE((void*)arr_conv_7);
585 b_constr.data[h] = arr_conv_7_conv;
587 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
591 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1TxOutZZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
592 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *tuple = (LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
593 jbyteArray a_arr = (*_env)->NewByteArray(_env, 32);
594 (*_env)->SetByteArrayRegion(_env, a_arr, 0, 32, tuple->a.data);
597 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1TxOutZZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
598 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *tuple = (LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
599 LDKCVecTempl_TxOut b_var = tuple->b;
600 jlongArray b_arr = (*_env)->NewLongArray(_env, b_var.datalen);
601 jlong *b_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, b_arr, NULL);
602 for (size_t h = 0; h < b_var.datalen; h++) {
603 long arr_conv_7_ref = (long)&b_var.data[h];
604 b_arr_ptr[h] = arr_conv_7_ref;
606 (*_env)->ReleasePrimitiveArrayCritical(_env, b_arr, b_arr_ptr, 0);
609 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
610 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
615 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
616 LDKC2TupleTempl_u64__u64 *tuple = (LDKC2TupleTempl_u64__u64*)ptr;
619 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
620 LDKC2TupleTempl_u64__u64 *tuple = (LDKC2TupleTempl_u64__u64*)ptr;
623 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
624 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
625 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
627 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jbyteArray a, jobjectArray b) {
628 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
630 CHECK((*_env)->GetArrayLength (_env, a) == 64);
631 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
633 LDKCVecTempl_Signature b_constr;
634 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
635 if (b_constr.datalen > 0)
636 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVecTempl_Signature Elements");
638 b_constr.data = NULL;
639 for (size_t i = 0; i < b_constr.datalen; i++) {
640 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
641 LDKSignature arr_conv_8_ref;
642 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
643 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
644 b_constr.data[i] = arr_conv_8_ref;
649 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
650 LDKC2TupleTempl_Signature__CVecTempl_Signature *tuple = (LDKC2TupleTempl_Signature__CVecTempl_Signature*)ptr;
651 jbyteArray a_arr = (*_env)->NewByteArray(_env, 64);
652 (*_env)->SetByteArrayRegion(_env, a_arr, 0, 64, tuple->a.compact_form);
655 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
656 LDKC2TupleTempl_Signature__CVecTempl_Signature *tuple = (LDKC2TupleTempl_Signature__CVecTempl_Signature*)ptr;
657 LDKCVecTempl_Signature b_var = tuple->b;
658 jobjectArray b_arr = (*_env)->NewObjectArray(_env, b_var.datalen, NULL, NULL);
659 for (size_t i = 0; i < b_var.datalen; i++) {
660 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
661 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, b_var.data[i].compact_form);
662 (*_env)->SetObjectArrayElement(_env, b_arr, i, arr_conv_8_arr);
666 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
667 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
669 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
670 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
671 CHECK(val->result_ok);
672 long res_ref = (long)&(*val->contents.result);
675 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
676 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
677 CHECK(!val->result_ok);
678 return *val->contents.err;
680 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
681 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
683 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
684 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
685 CHECK(val->result_ok);
686 jbyteArray res_arr = (*_env)->NewByteArray(_env, 64);
687 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 64, (*val->contents.result).compact_form);
690 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
691 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
692 CHECK(!val->result_ok);
693 return *val->contents.err;
695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
696 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
698 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
699 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
700 CHECK(val->result_ok);
701 LDKCVecTempl_Signature res_var = (*val->contents.result);
702 jobjectArray res_arr = (*_env)->NewObjectArray(_env, res_var.datalen, NULL, NULL);
703 for (size_t i = 0; i < res_var.datalen; i++) {
704 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
705 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
706 (*_env)->SetObjectArrayElement(_env, res_arr, i, arr_conv_8_arr);
710 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
711 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
712 CHECK(!val->result_ok);
713 return *val->contents.err;
715 static jclass LDKAPIError_APIMisuseError_class = NULL;
716 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
717 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
718 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
719 static jclass LDKAPIError_RouteError_class = NULL;
720 static jmethodID LDKAPIError_RouteError_meth = NULL;
721 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
722 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
723 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
724 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
726 LDKAPIError_APIMisuseError_class =
727 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
728 CHECK(LDKAPIError_APIMisuseError_class != NULL);
729 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
730 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
731 LDKAPIError_FeeRateTooHigh_class =
732 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
733 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
734 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
735 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
736 LDKAPIError_RouteError_class =
737 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
738 CHECK(LDKAPIError_RouteError_class != NULL);
739 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
740 CHECK(LDKAPIError_RouteError_meth != NULL);
741 LDKAPIError_ChannelUnavailable_class =
742 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
743 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
744 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
745 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
746 LDKAPIError_MonitorUpdateFailed_class =
747 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
748 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
749 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
750 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
752 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
753 LDKAPIError *obj = (LDKAPIError*)ptr;
755 case LDKAPIError_APIMisuseError: {
756 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
757 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
758 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
759 return (*_env)->NewObject(_env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
761 case LDKAPIError_FeeRateTooHigh: {
762 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
763 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
764 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
765 return (*_env)->NewObject(_env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
767 case LDKAPIError_RouteError: {
768 LDKStr err_str = obj->route_error.err;
769 char* err_buf = MALLOC(err_str.len + 1, "str conv buf");
770 memcpy(err_buf, err_str.chars, err_str.len);
771 err_buf[err_str.len] = 0;
772 jstring err_conv = (*_env)->NewStringUTF(_env, err_str.chars);
774 return (*_env)->NewObject(_env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
776 case LDKAPIError_ChannelUnavailable: {
777 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
778 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
779 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
780 return (*_env)->NewObject(_env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
782 case LDKAPIError_MonitorUpdateFailed: {
783 return (*_env)->NewObject(_env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
788 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
789 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
791 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
792 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
793 CHECK(val->result_ok);
794 return *val->contents.result;
796 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
797 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
798 CHECK(!val->result_ok);
799 long err_ref = (long)&(*val->contents.err);
802 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
803 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
805 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
806 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
807 CHECK(val->result_ok);
808 return *val->contents.result;
810 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
811 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
812 CHECK(!val->result_ok);
813 LDKPaymentSendFailure err_var = (*val->contents.err);
814 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
815 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
816 long err_ref = (long)err_var.inner & ~1;
819 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) {
820 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
821 LDKChannelAnnouncement a_conv;
822 a_conv.inner = (void*)(a & (~1));
823 a_conv.is_owned = (a & 1) || (a == 0);
824 if (a_conv.inner != NULL)
825 a_conv = ChannelAnnouncement_clone(&a_conv);
827 LDKChannelUpdate b_conv;
828 b_conv.inner = (void*)(b & (~1));
829 b_conv.is_owned = (b & 1) || (b == 0);
830 if (b_conv.inner != NULL)
831 b_conv = ChannelUpdate_clone(&b_conv);
833 LDKChannelUpdate c_conv;
834 c_conv.inner = (void*)(c & (~1));
835 c_conv.is_owned = (c & 1) || (c == 0);
836 if (c_conv.inner != NULL)
837 c_conv = ChannelUpdate_clone(&c_conv);
841 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
842 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
843 LDKChannelAnnouncement a_var = tuple->a;
844 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
845 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
846 long a_ref = (long)a_var.inner & ~1;
849 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
850 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
851 LDKChannelUpdate b_var = tuple->b;
852 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
853 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
854 long b_ref = (long)b_var.inner & ~1;
857 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *_env, jclass _b, jlong ptr) {
858 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
859 LDKChannelUpdate c_var = tuple->c;
860 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
861 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
862 long c_ref = (long)c_var.inner & ~1;
865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
866 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
868 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
869 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
870 CHECK(val->result_ok);
871 return *val->contents.result;
873 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
874 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
875 CHECK(!val->result_ok);
876 LDKPeerHandleError err_var = (*val->contents.err);
877 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
878 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
879 long err_ref = (long)err_var.inner & ~1;
882 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
883 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
884 LDKHTLCOutputInCommitment a_conv;
885 a_conv.inner = (void*)(a & (~1));
886 a_conv.is_owned = (a & 1) || (a == 0);
887 if (a_conv.inner != NULL)
888 a_conv = HTLCOutputInCommitment_clone(&a_conv);
891 CHECK((*_env)->GetArrayLength (_env, b) == 64);
892 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
896 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1HTLCOutputInCommitmentSignatureZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
897 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *tuple = (LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
898 LDKHTLCOutputInCommitment a_var = tuple->a;
899 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
900 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
901 long a_ref = (long)a_var.inner & ~1;
904 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1HTLCOutputInCommitmentSignatureZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
905 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *tuple = (LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
906 jbyteArray b_arr = (*_env)->NewByteArray(_env, 64);
907 (*_env)->SetByteArrayRegion(_env, b_arr, 0, 64, tuple->b.compact_form);
910 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
911 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
912 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
913 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
914 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
915 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
917 LDKSpendableOutputDescriptor_StaticOutput_class =
918 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
919 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
920 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
921 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
922 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
923 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
924 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
925 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
926 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
927 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
928 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
929 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
930 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
931 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
933 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
934 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
936 case LDKSpendableOutputDescriptor_StaticOutput: {
937 LDKOutPoint outpoint_var = obj->static_output.outpoint;
938 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
939 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
940 long outpoint_ref = (long)outpoint_var.inner & ~1;
941 long output_ref = (long)&obj->static_output.output;
942 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
944 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
945 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
946 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
947 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
948 long outpoint_ref = (long)outpoint_var.inner & ~1;
949 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
950 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
951 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
952 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
953 jbyteArray revocation_pubkey_arr = (*_env)->NewByteArray(_env, 33);
954 (*_env)->SetByteArrayRegion(_env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
955 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);
957 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
958 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
959 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
960 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
961 long outpoint_ref = (long)outpoint_var.inner & ~1;
962 long output_ref = (long)&obj->static_output_counterparty_payment.output;
963 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
964 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
969 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
970 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
971 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
973 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
974 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
975 ret->datalen = (*env)->GetArrayLength(env, elems);
976 if (ret->datalen == 0) {
979 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
980 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
981 for (size_t i = 0; i < ret->datalen; i++) {
982 jlong arr_elem = java_elems[i];
983 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
984 FREE((void*)arr_elem);
985 ret->data[i] = arr_elem_conv;
987 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
991 static jclass LDKEvent_FundingGenerationReady_class = NULL;
992 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
993 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
994 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
995 static jclass LDKEvent_PaymentReceived_class = NULL;
996 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
997 static jclass LDKEvent_PaymentSent_class = NULL;
998 static jmethodID LDKEvent_PaymentSent_meth = NULL;
999 static jclass LDKEvent_PaymentFailed_class = NULL;
1000 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
1001 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
1002 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
1003 static jclass LDKEvent_SpendableOutputs_class = NULL;
1004 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
1005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
1006 LDKEvent_FundingGenerationReady_class =
1007 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
1008 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
1009 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
1010 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
1011 LDKEvent_FundingBroadcastSafe_class =
1012 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
1013 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
1014 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
1015 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
1016 LDKEvent_PaymentReceived_class =
1017 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
1018 CHECK(LDKEvent_PaymentReceived_class != NULL);
1019 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
1020 CHECK(LDKEvent_PaymentReceived_meth != NULL);
1021 LDKEvent_PaymentSent_class =
1022 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
1023 CHECK(LDKEvent_PaymentSent_class != NULL);
1024 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
1025 CHECK(LDKEvent_PaymentSent_meth != NULL);
1026 LDKEvent_PaymentFailed_class =
1027 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
1028 CHECK(LDKEvent_PaymentFailed_class != NULL);
1029 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
1030 CHECK(LDKEvent_PaymentFailed_meth != NULL);
1031 LDKEvent_PendingHTLCsForwardable_class =
1032 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
1033 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
1034 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
1035 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
1036 LDKEvent_SpendableOutputs_class =
1037 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
1038 CHECK(LDKEvent_SpendableOutputs_class != NULL);
1039 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
1040 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
1042 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1043 LDKEvent *obj = (LDKEvent*)ptr;
1045 case LDKEvent_FundingGenerationReady: {
1046 jbyteArray temporary_channel_id_arr = (*_env)->NewByteArray(_env, 32);
1047 (*_env)->SetByteArrayRegion(_env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
1048 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1049 jbyteArray output_script_arr = (*_env)->NewByteArray(_env, output_script_var.datalen);
1050 (*_env)->SetByteArrayRegion(_env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
1051 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);
1053 case LDKEvent_FundingBroadcastSafe: {
1054 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1055 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1056 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1057 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1058 return (*_env)->NewObject(_env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
1060 case LDKEvent_PaymentReceived: {
1061 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
1062 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
1063 jbyteArray payment_secret_arr = (*_env)->NewByteArray(_env, 32);
1064 (*_env)->SetByteArrayRegion(_env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
1065 return (*_env)->NewObject(_env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
1067 case LDKEvent_PaymentSent: {
1068 jbyteArray payment_preimage_arr = (*_env)->NewByteArray(_env, 32);
1069 (*_env)->SetByteArrayRegion(_env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
1070 return (*_env)->NewObject(_env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
1072 case LDKEvent_PaymentFailed: {
1073 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
1074 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
1075 return (*_env)->NewObject(_env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
1077 case LDKEvent_PendingHTLCsForwardable: {
1078 return (*_env)->NewObject(_env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
1080 case LDKEvent_SpendableOutputs: {
1081 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1082 jlongArray outputs_arr = (*_env)->NewLongArray(_env, outputs_var.datalen);
1083 jlong *outputs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, outputs_arr, NULL);
1084 for (size_t b = 0; b < outputs_var.datalen; b++) {
1085 long arr_conv_27_ref = (long)&outputs_var.data[b];
1086 outputs_arr_ptr[b] = arr_conv_27_ref;
1088 (*_env)->ReleasePrimitiveArrayCritical(_env, outputs_arr, outputs_arr_ptr, 0);
1089 return (*_env)->NewObject(_env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
1094 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1095 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1096 static jclass LDKErrorAction_IgnoreError_class = NULL;
1097 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1098 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1099 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
1101 LDKErrorAction_DisconnectPeer_class =
1102 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1103 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1104 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1105 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1106 LDKErrorAction_IgnoreError_class =
1107 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1108 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1109 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1110 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1111 LDKErrorAction_SendErrorMessage_class =
1112 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1113 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1114 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1115 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1117 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1118 LDKErrorAction *obj = (LDKErrorAction*)ptr;
1120 case LDKErrorAction_DisconnectPeer: {
1121 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1122 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1123 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1124 long msg_ref = (long)msg_var.inner & ~1;
1125 return (*_env)->NewObject(_env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1127 case LDKErrorAction_IgnoreError: {
1128 return (*_env)->NewObject(_env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1130 case LDKErrorAction_SendErrorMessage: {
1131 LDKErrorMessage msg_var = obj->send_error_message.msg;
1132 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1133 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1134 long msg_ref = (long)msg_var.inner & ~1;
1135 return (*_env)->NewObject(_env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1140 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1141 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1142 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1143 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1144 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1145 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
1147 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1148 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1149 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1150 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1151 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1152 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1153 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1154 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1155 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1156 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1157 LDKHTLCFailChannelUpdate_NodeFailure_class =
1158 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1159 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1160 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1161 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1163 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1164 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
1166 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1167 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1168 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1169 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1170 long msg_ref = (long)msg_var.inner & ~1;
1171 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1173 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1174 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1176 case LDKHTLCFailChannelUpdate_NodeFailure: {
1177 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1178 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1179 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1184 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1185 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1186 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1187 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1188 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1189 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1190 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1191 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1192 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1193 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1194 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1195 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1196 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1197 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1198 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1199 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1200 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1201 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1202 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1203 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1204 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1205 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1206 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1207 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1208 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1209 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1210 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1211 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1212 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1213 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1214 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1215 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1217 LDKMessageSendEvent_SendAcceptChannel_class =
1218 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1219 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1220 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1221 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1222 LDKMessageSendEvent_SendOpenChannel_class =
1223 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1224 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1225 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1226 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1227 LDKMessageSendEvent_SendFundingCreated_class =
1228 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1229 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1230 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1231 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1232 LDKMessageSendEvent_SendFundingSigned_class =
1233 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1234 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1235 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1236 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1237 LDKMessageSendEvent_SendFundingLocked_class =
1238 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1239 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1240 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1241 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1242 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1243 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1244 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1245 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1246 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1247 LDKMessageSendEvent_UpdateHTLCs_class =
1248 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1249 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1250 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1251 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1252 LDKMessageSendEvent_SendRevokeAndACK_class =
1253 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1254 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1255 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1256 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1257 LDKMessageSendEvent_SendClosingSigned_class =
1258 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1259 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1260 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1261 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1262 LDKMessageSendEvent_SendShutdown_class =
1263 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1264 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1265 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1266 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1267 LDKMessageSendEvent_SendChannelReestablish_class =
1268 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1269 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1270 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1271 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1272 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1273 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1274 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1275 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1276 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1277 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1278 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1279 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1280 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1281 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1282 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1283 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1284 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1285 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1286 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1287 LDKMessageSendEvent_HandleError_class =
1288 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1289 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1290 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1291 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1292 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1293 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1294 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1295 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1296 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1298 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1299 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1301 case LDKMessageSendEvent_SendAcceptChannel: {
1302 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1303 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1304 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1305 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1306 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1307 long msg_ref = (long)msg_var.inner & ~1;
1308 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1310 case LDKMessageSendEvent_SendOpenChannel: {
1311 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1312 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1313 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1314 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1315 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1316 long msg_ref = (long)msg_var.inner & ~1;
1317 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1319 case LDKMessageSendEvent_SendFundingCreated: {
1320 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1321 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1322 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1323 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1324 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1325 long msg_ref = (long)msg_var.inner & ~1;
1326 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1328 case LDKMessageSendEvent_SendFundingSigned: {
1329 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1330 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1331 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1332 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1333 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1334 long msg_ref = (long)msg_var.inner & ~1;
1335 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1337 case LDKMessageSendEvent_SendFundingLocked: {
1338 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1339 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1340 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1341 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1342 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1343 long msg_ref = (long)msg_var.inner & ~1;
1344 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1346 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1347 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1348 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1349 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1350 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1351 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1352 long msg_ref = (long)msg_var.inner & ~1;
1353 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1355 case LDKMessageSendEvent_UpdateHTLCs: {
1356 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1357 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1358 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1359 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1360 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1361 long updates_ref = (long)updates_var.inner & ~1;
1362 return (*_env)->NewObject(_env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1364 case LDKMessageSendEvent_SendRevokeAndACK: {
1365 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1366 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1367 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1368 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1369 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1370 long msg_ref = (long)msg_var.inner & ~1;
1371 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1373 case LDKMessageSendEvent_SendClosingSigned: {
1374 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1375 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1376 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1377 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1378 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1379 long msg_ref = (long)msg_var.inner & ~1;
1380 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1382 case LDKMessageSendEvent_SendShutdown: {
1383 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1384 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1385 LDKShutdown msg_var = obj->send_shutdown.msg;
1386 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1387 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1388 long msg_ref = (long)msg_var.inner & ~1;
1389 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1391 case LDKMessageSendEvent_SendChannelReestablish: {
1392 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1393 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1394 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1395 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1396 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1397 long msg_ref = (long)msg_var.inner & ~1;
1398 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1400 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1401 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.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 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1406 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1407 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1408 long update_msg_ref = (long)update_msg_var.inner & ~1;
1409 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1411 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1412 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1413 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1414 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1415 long msg_ref = (long)msg_var.inner & ~1;
1416 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1418 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1419 LDKChannelUpdate msg_var = obj->broadcast_channel_update.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_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1425 case LDKMessageSendEvent_HandleError: {
1426 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1427 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1428 long action_ref = (long)&obj->handle_error.action;
1429 return (*_env)->NewObject(_env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1431 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1432 long update_ref = (long)&obj->payment_failure_network_update.update;
1433 return (*_env)->NewObject(_env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1438 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1439 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1440 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1442 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1443 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1444 ret->datalen = (*env)->GetArrayLength(env, elems);
1445 if (ret->datalen == 0) {
1448 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1449 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1450 for (size_t i = 0; i < ret->datalen; i++) {
1451 jlong arr_elem = java_elems[i];
1452 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1453 FREE((void*)arr_elem);
1454 ret->data[i] = arr_elem_conv;
1456 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1460 typedef struct LDKMessageSendEventsProvider_JCalls {
1461 atomic_size_t refcnt;
1464 jmethodID get_and_clear_pending_msg_events_meth;
1465 } LDKMessageSendEventsProvider_JCalls;
1466 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1467 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1469 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1470 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1472 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1473 LDKCVec_MessageSendEventZ arg_constr;
1474 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
1475 if (arg_constr.datalen > 0)
1476 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
1478 arg_constr.data = NULL;
1479 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
1480 for (size_t s = 0; s < arg_constr.datalen; s++) {
1481 long arr_conv_18 = arg_vals[s];
1482 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
1483 FREE((void*)arr_conv_18);
1484 arg_constr.data[s] = arr_conv_18_conv;
1486 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
1489 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1490 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1491 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1493 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1494 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1498 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1499 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1500 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1501 return (void*) this_arg;
1503 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1504 jclass c = (*env)->GetObjectClass(env, o);
1506 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1507 atomic_init(&calls->refcnt, 1);
1508 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1509 calls->o = (*env)->NewWeakGlobalRef(env, o);
1510 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
1511 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
1513 LDKMessageSendEventsProvider ret = {
1514 .this_arg = (void*) calls,
1515 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1516 .free = LDKMessageSendEventsProvider_JCalls_free,
1520 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1521 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1522 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1523 return (long)res_ptr;
1525 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1526 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1530 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1531 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1532 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1533 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1534 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1535 for (size_t s = 0; s < ret_var.datalen; s++) {
1536 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
1537 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
1538 long arr_conv_18_ref = (long)arr_conv_18_copy;
1539 ret_arr_ptr[s] = arr_conv_18_ref;
1541 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1542 CVec_MessageSendEventZ_free(ret_var);
1546 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1547 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1548 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1550 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1551 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1552 ret->datalen = (*env)->GetArrayLength(env, elems);
1553 if (ret->datalen == 0) {
1556 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1557 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1558 for (size_t i = 0; i < ret->datalen; i++) {
1559 jlong arr_elem = java_elems[i];
1560 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1561 FREE((void*)arr_elem);
1562 ret->data[i] = arr_elem_conv;
1564 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1568 typedef struct LDKEventsProvider_JCalls {
1569 atomic_size_t refcnt;
1572 jmethodID get_and_clear_pending_events_meth;
1573 } LDKEventsProvider_JCalls;
1574 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1575 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1577 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1578 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1580 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_events_meth);
1581 LDKCVec_EventZ arg_constr;
1582 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
1583 if (arg_constr.datalen > 0)
1584 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
1586 arg_constr.data = NULL;
1587 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
1588 for (size_t h = 0; h < arg_constr.datalen; h++) {
1589 long arr_conv_7 = arg_vals[h];
1590 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
1591 FREE((void*)arr_conv_7);
1592 arg_constr.data[h] = arr_conv_7_conv;
1594 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
1597 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1598 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1599 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1601 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1602 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1606 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1607 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1608 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1609 return (void*) this_arg;
1611 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1612 jclass c = (*env)->GetObjectClass(env, o);
1614 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1615 atomic_init(&calls->refcnt, 1);
1616 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1617 calls->o = (*env)->NewWeakGlobalRef(env, o);
1618 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
1619 CHECK(calls->get_and_clear_pending_events_meth != NULL);
1621 LDKEventsProvider ret = {
1622 .this_arg = (void*) calls,
1623 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1624 .free = LDKEventsProvider_JCalls_free,
1628 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1629 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1630 *res_ptr = LDKEventsProvider_init(env, _a, o);
1631 return (long)res_ptr;
1633 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1634 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1638 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1639 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1640 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1641 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1642 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1643 for (size_t h = 0; h < ret_var.datalen; h++) {
1644 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
1645 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
1646 long arr_conv_7_ref = (long)arr_conv_7_copy;
1647 ret_arr_ptr[h] = arr_conv_7_ref;
1649 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1650 CVec_EventZ_free(ret_var);
1654 typedef struct LDKLogger_JCalls {
1655 atomic_size_t refcnt;
1660 void log_jcall(const void* this_arg, const char *record) {
1661 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1663 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1664 jstring record_conv = (*_env)->NewStringUTF(_env, record);
1665 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1667 return (*_env)->CallVoidMethod(_env, obj, j_calls->log_meth, record_conv);
1669 static void LDKLogger_JCalls_free(void* this_arg) {
1670 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1671 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1673 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1674 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1678 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1679 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1680 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1681 return (void*) this_arg;
1683 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1684 jclass c = (*env)->GetObjectClass(env, o);
1686 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1687 atomic_init(&calls->refcnt, 1);
1688 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1689 calls->o = (*env)->NewWeakGlobalRef(env, o);
1690 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1691 CHECK(calls->log_meth != NULL);
1694 .this_arg = (void*) calls,
1696 .free = LDKLogger_JCalls_free,
1700 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1701 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1702 *res_ptr = LDKLogger_init(env, _a, o);
1703 return (long)res_ptr;
1705 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1706 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1710 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1711 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1713 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1714 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1715 CHECK(val->result_ok);
1716 long res_ref = (long)&(*val->contents.result);
1719 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1720 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1721 CHECK(!val->result_ok);
1722 jclass err_conv = LDKAccessError_to_java(_env, (*val->contents.err));
1725 typedef struct LDKAccess_JCalls {
1726 atomic_size_t refcnt;
1729 jmethodID get_utxo_meth;
1731 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1732 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1734 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1735 jbyteArray genesis_hash_arr = (*_env)->NewByteArray(_env, 32);
1736 (*_env)->SetByteArrayRegion(_env, genesis_hash_arr, 0, 32, *genesis_hash);
1737 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1739 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1740 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)ret;
1744 static void LDKAccess_JCalls_free(void* this_arg) {
1745 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1746 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1748 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1749 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1753 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1754 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1755 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1756 return (void*) this_arg;
1758 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1759 jclass c = (*env)->GetObjectClass(env, o);
1761 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1762 atomic_init(&calls->refcnt, 1);
1763 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1764 calls->o = (*env)->NewWeakGlobalRef(env, o);
1765 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1766 CHECK(calls->get_utxo_meth != NULL);
1769 .this_arg = (void*) calls,
1770 .get_utxo = get_utxo_jcall,
1771 .free = LDKAccess_JCalls_free,
1775 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1776 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1777 *res_ptr = LDKAccess_init(env, _a, o);
1778 return (long)res_ptr;
1780 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1781 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1785 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) {
1786 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1787 unsigned char genesis_hash_arr[32];
1788 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
1789 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1790 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1791 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1792 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1793 return (long)ret_conv;
1796 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1797 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1798 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1799 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1800 for (size_t i = 0; i < vec->datalen; i++) {
1801 CHECK((((long)vec->data[i].inner) & 1) == 0);
1802 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1804 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1807 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1808 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1809 ret->datalen = (*env)->GetArrayLength(env, elems);
1810 if (ret->datalen == 0) {
1813 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1814 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1815 for (size_t i = 0; i < ret->datalen; i++) {
1816 jlong arr_elem = java_elems[i];
1817 LDKHTLCOutputInCommitment arr_elem_conv;
1818 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1819 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1820 if (arr_elem_conv.inner != NULL)
1821 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1822 ret->data[i] = arr_elem_conv;
1824 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1828 typedef struct LDKChannelKeys_JCalls {
1829 atomic_size_t refcnt;
1832 jmethodID get_per_commitment_point_meth;
1833 jmethodID release_commitment_secret_meth;
1834 jmethodID key_derivation_params_meth;
1835 jmethodID sign_counterparty_commitment_meth;
1836 jmethodID sign_holder_commitment_meth;
1837 jmethodID sign_holder_commitment_htlc_transactions_meth;
1838 jmethodID sign_justice_transaction_meth;
1839 jmethodID sign_counterparty_htlc_transaction_meth;
1840 jmethodID sign_closing_transaction_meth;
1841 jmethodID sign_channel_announcement_meth;
1842 jmethodID on_accept_meth;
1843 } LDKChannelKeys_JCalls;
1844 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1845 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1847 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1848 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1850 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_per_commitment_point_meth, idx);
1851 LDKPublicKey arg_ref;
1852 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
1853 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
1856 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1857 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1859 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1860 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1862 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_commitment_secret_meth, idx);
1863 LDKThirtyTwoBytes arg_ref;
1864 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
1865 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
1868 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1869 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1871 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1872 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1874 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*_env)->CallLongMethod(_env, obj, j_calls->key_derivation_params_meth);
1875 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)ret;
1879 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) {
1880 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1882 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1883 LDKTransaction *commitment_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1884 *commitment_tx_copy = commitment_tx;
1885 long commitment_tx_ref = (long)commitment_tx_copy;
1886 long ret_keys = (long)keys;
1887 LDKCVec_HTLCOutputInCommitmentZ htlcs_var = htlcs;
1888 jlongArray htlcs_arr = (*_env)->NewLongArray(_env, htlcs_var.datalen);
1889 jlong *htlcs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, htlcs_arr, NULL);
1890 for (size_t y = 0; y < htlcs_var.datalen; y++) {
1891 LDKHTLCOutputInCommitment arr_conv_24_var = htlcs_var.data[y];
1892 CHECK((((long)arr_conv_24_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1893 CHECK((((long)&arr_conv_24_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1894 long arr_conv_24_ref = (long)arr_conv_24_var.inner;
1895 if (arr_conv_24_var.is_owned) {
1896 arr_conv_24_ref |= 1;
1898 htlcs_arr_ptr[y] = arr_conv_24_ref;
1900 (*_env)->ReleasePrimitiveArrayCritical(_env, htlcs_arr, htlcs_arr_ptr, 0);
1901 FREE(htlcs_var.data);
1902 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1904 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);
1905 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret;
1909 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1910 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1912 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1913 long ret_holder_commitment_tx = (long)holder_commitment_tx;
1914 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1916 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, ret_holder_commitment_tx);
1917 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1921 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1922 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1924 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1925 long ret_holder_commitment_tx = (long)holder_commitment_tx;
1926 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1928 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, ret_holder_commitment_tx);
1929 LDKCResult_CVec_SignatureZNoneZ ret_conv = *(LDKCResult_CVec_SignatureZNoneZ*)ret;
1933 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) {
1934 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1936 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1937 LDKTransaction *justice_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1938 *justice_tx_copy = justice_tx;
1939 long justice_tx_ref = (long)justice_tx_copy;
1940 jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32);
1941 (*_env)->SetByteArrayRegion(_env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1942 long ret_htlc = (long)htlc;
1943 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1945 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);
1946 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1950 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) {
1951 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1953 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1954 LDKTransaction *htlc_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1955 *htlc_tx_copy = htlc_tx;
1956 long htlc_tx_ref = (long)htlc_tx_copy;
1957 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
1958 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1959 long ret_htlc = (long)htlc;
1960 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1962 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);
1963 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1967 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1968 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1970 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1971 LDKTransaction *closing_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1972 *closing_tx_copy = closing_tx;
1973 long closing_tx_ref = (long)closing_tx_copy;
1974 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1976 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1977 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1981 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1982 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1984 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1985 long ret_msg = (long)msg;
1986 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1988 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, ret_msg);
1989 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1993 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1994 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1996 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1997 long ret_channel_points = (long)channel_points;
1998 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2000 return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, ret_channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
2002 static void LDKChannelKeys_JCalls_free(void* this_arg) {
2003 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2004 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2006 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2007 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2011 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
2012 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2013 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2014 return (void*) this_arg;
2016 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
2017 jclass c = (*env)->GetObjectClass(env, o);
2019 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
2020 atomic_init(&calls->refcnt, 1);
2021 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2022 calls->o = (*env)->NewWeakGlobalRef(env, o);
2023 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2024 CHECK(calls->get_per_commitment_point_meth != NULL);
2025 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2026 CHECK(calls->release_commitment_secret_meth != NULL);
2027 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
2028 CHECK(calls->key_derivation_params_meth != NULL);
2029 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJ[J)J");
2030 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2031 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
2032 CHECK(calls->sign_holder_commitment_meth != NULL);
2033 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
2034 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
2035 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
2036 CHECK(calls->sign_justice_transaction_meth != NULL);
2037 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
2038 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2039 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
2040 CHECK(calls->sign_closing_transaction_meth != NULL);
2041 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2042 CHECK(calls->sign_channel_announcement_meth != NULL);
2043 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
2044 CHECK(calls->on_accept_meth != NULL);
2046 LDKChannelPublicKeys pubkeys_conv;
2047 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2048 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2049 if (pubkeys_conv.inner != NULL)
2050 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2052 LDKChannelKeys ret = {
2053 .this_arg = (void*) calls,
2054 .get_per_commitment_point = get_per_commitment_point_jcall,
2055 .release_commitment_secret = release_commitment_secret_jcall,
2056 .key_derivation_params = key_derivation_params_jcall,
2057 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
2058 .sign_holder_commitment = sign_holder_commitment_jcall,
2059 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
2060 .sign_justice_transaction = sign_justice_transaction_jcall,
2061 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
2062 .sign_closing_transaction = sign_closing_transaction_jcall,
2063 .sign_channel_announcement = sign_channel_announcement_jcall,
2064 .on_accept = on_accept_jcall,
2065 .clone = LDKChannelKeys_JCalls_clone,
2066 .free = LDKChannelKeys_JCalls_free,
2067 .pubkeys = pubkeys_conv,
2068 .set_pubkeys = NULL,
2072 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
2073 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2074 *res_ptr = LDKChannelKeys_init(env, _a, o, pubkeys);
2075 return (long)res_ptr;
2077 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2078 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
2082 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2083 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2084 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2085 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2089 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2090 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2091 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2092 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2096 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
2097 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2098 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2099 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
2100 return (long)ret_ref;
2103 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) {
2104 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2105 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
2106 LDKPreCalculatedTxCreationKeys keys_conv;
2107 keys_conv.inner = (void*)(keys & (~1));
2108 keys_conv.is_owned = (keys & 1) || (keys == 0);
2109 LDKCVec_HTLCOutputInCommitmentZ htlcs_constr;
2110 htlcs_constr.datalen = (*_env)->GetArrayLength (_env, htlcs);
2111 if (htlcs_constr.datalen > 0)
2112 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
2114 htlcs_constr.data = NULL;
2115 long* htlcs_vals = (*_env)->GetLongArrayElements (_env, htlcs, NULL);
2116 for (size_t y = 0; y < htlcs_constr.datalen; y++) {
2117 long arr_conv_24 = htlcs_vals[y];
2118 LDKHTLCOutputInCommitment arr_conv_24_conv;
2119 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
2120 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
2121 if (arr_conv_24_conv.inner != NULL)
2122 arr_conv_24_conv = HTLCOutputInCommitment_clone(&arr_conv_24_conv);
2123 htlcs_constr.data[y] = arr_conv_24_conv;
2125 (*_env)->ReleaseLongArrayElements (_env, htlcs, htlcs_vals, 0);
2126 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2127 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_constr);
2128 return (long)ret_conv;
2131 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
2132 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2133 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2134 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2135 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
2136 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2137 *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2138 return (long)ret_conv;
2141 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) {
2142 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2143 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2144 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2145 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
2146 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
2147 *ret_conv = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2148 return (long)ret_conv;
2151 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) {
2152 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2153 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
2154 unsigned char per_commitment_key_arr[32];
2155 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
2156 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
2157 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2158 LDKHTLCOutputInCommitment htlc_conv;
2159 htlc_conv.inner = (void*)(htlc & (~1));
2160 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2161 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2162 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
2163 return (long)ret_conv;
2166 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) {
2167 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2168 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
2169 LDKPublicKey per_commitment_point_ref;
2170 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
2171 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2172 LDKHTLCOutputInCommitment htlc_conv;
2173 htlc_conv.inner = (void*)(htlc & (~1));
2174 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2175 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2176 *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);
2177 return (long)ret_conv;
2180 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) {
2181 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2182 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
2183 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2184 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv);
2185 return (long)ret_conv;
2188 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
2189 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2190 LDKUnsignedChannelAnnouncement msg_conv;
2191 msg_conv.inner = (void*)(msg & (~1));
2192 msg_conv.is_owned = (msg & 1) || (msg == 0);
2193 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2194 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2195 return (long)ret_conv;
2198 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) {
2199 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2200 LDKChannelPublicKeys channel_points_conv;
2201 channel_points_conv.inner = (void*)(channel_points & (~1));
2202 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2203 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2206 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
2207 if (this_arg->set_pubkeys != NULL)
2208 this_arg->set_pubkeys(this_arg);
2209 return this_arg->pubkeys;
2211 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
2212 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2213 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
2214 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2215 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2216 long ret_ref = (long)ret_var.inner;
2217 if (ret_var.is_owned) {
2223 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2224 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2225 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2226 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2227 for (size_t i = 0; i < vec->datalen; i++) {
2228 CHECK((((long)vec->data[i].inner) & 1) == 0);
2229 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2231 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2234 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2235 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2236 ret->datalen = (*env)->GetArrayLength(env, elems);
2237 if (ret->datalen == 0) {
2240 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2241 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2242 for (size_t i = 0; i < ret->datalen; i++) {
2243 jlong arr_elem = java_elems[i];
2244 LDKMonitorEvent arr_elem_conv;
2245 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2246 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2247 if (arr_elem_conv.inner != NULL)
2248 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
2249 ret->data[i] = arr_elem_conv;
2251 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2255 typedef struct LDKWatch_JCalls {
2256 atomic_size_t refcnt;
2259 jmethodID watch_channel_meth;
2260 jmethodID update_channel_meth;
2261 jmethodID release_pending_monitor_events_meth;
2263 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2264 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2266 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2267 LDKOutPoint funding_txo_var = funding_txo;
2268 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2269 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2270 long funding_txo_ref = (long)funding_txo_var.inner;
2271 if (funding_txo_var.is_owned) {
2272 funding_txo_ref |= 1;
2274 LDKChannelMonitor monitor_var = monitor;
2275 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2276 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2277 long monitor_ref = (long)monitor_var.inner;
2278 if (monitor_var.is_owned) {
2281 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2283 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2284 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2288 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2289 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2291 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2292 LDKOutPoint funding_txo_var = funding_txo;
2293 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2294 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2295 long funding_txo_ref = (long)funding_txo_var.inner;
2296 if (funding_txo_var.is_owned) {
2297 funding_txo_ref |= 1;
2299 LDKChannelMonitorUpdate update_var = update;
2300 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2301 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2302 long update_ref = (long)update_var.inner;
2303 if (update_var.is_owned) {
2306 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2308 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2309 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2313 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2314 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2316 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2317 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2319 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_pending_monitor_events_meth);
2320 LDKCVec_MonitorEventZ arg_constr;
2321 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
2322 if (arg_constr.datalen > 0)
2323 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2325 arg_constr.data = NULL;
2326 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
2327 for (size_t o = 0; o < arg_constr.datalen; o++) {
2328 long arr_conv_14 = arg_vals[o];
2329 LDKMonitorEvent arr_conv_14_conv;
2330 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2331 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2332 if (arr_conv_14_conv.inner != NULL)
2333 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2334 arg_constr.data[o] = arr_conv_14_conv;
2336 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
2339 static void LDKWatch_JCalls_free(void* this_arg) {
2340 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2341 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2343 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2344 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2348 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2349 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2350 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2351 return (void*) this_arg;
2353 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2354 jclass c = (*env)->GetObjectClass(env, o);
2356 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2357 atomic_init(&calls->refcnt, 1);
2358 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2359 calls->o = (*env)->NewWeakGlobalRef(env, o);
2360 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2361 CHECK(calls->watch_channel_meth != NULL);
2362 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2363 CHECK(calls->update_channel_meth != NULL);
2364 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2365 CHECK(calls->release_pending_monitor_events_meth != NULL);
2368 .this_arg = (void*) calls,
2369 .watch_channel = watch_channel_jcall,
2370 .update_channel = update_channel_jcall,
2371 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2372 .free = LDKWatch_JCalls_free,
2376 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2377 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2378 *res_ptr = LDKWatch_init(env, _a, o);
2379 return (long)res_ptr;
2381 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2382 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2386 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2387 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2388 LDKOutPoint funding_txo_conv;
2389 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2390 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2391 if (funding_txo_conv.inner != NULL)
2392 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2393 LDKChannelMonitor monitor_conv;
2394 monitor_conv.inner = (void*)(monitor & (~1));
2395 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2396 // Warning: we may need a move here but can't clone!
2397 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2398 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2399 return (long)ret_conv;
2402 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2403 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2404 LDKOutPoint funding_txo_conv;
2405 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2406 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2407 if (funding_txo_conv.inner != NULL)
2408 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2409 LDKChannelMonitorUpdate update_conv;
2410 update_conv.inner = (void*)(update & (~1));
2411 update_conv.is_owned = (update & 1) || (update == 0);
2412 if (update_conv.inner != NULL)
2413 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2414 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2415 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2416 return (long)ret_conv;
2419 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2420 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2421 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2422 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
2423 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
2424 for (size_t o = 0; o < ret_var.datalen; o++) {
2425 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2426 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2427 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2428 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2429 if (arr_conv_14_var.is_owned) {
2430 arr_conv_14_ref |= 1;
2432 ret_arr_ptr[o] = arr_conv_14_ref;
2434 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
2439 typedef struct LDKFilter_JCalls {
2440 atomic_size_t refcnt;
2443 jmethodID register_tx_meth;
2444 jmethodID register_output_meth;
2446 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2447 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2449 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2450 jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
2451 (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
2452 LDKu8slice script_pubkey_var = script_pubkey;
2453 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2454 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2455 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2457 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2459 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2460 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2462 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2463 long ret_outpoint = (long)outpoint;
2464 LDKu8slice script_pubkey_var = script_pubkey;
2465 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2466 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2467 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2469 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, ret_outpoint, script_pubkey_arr);
2471 static void LDKFilter_JCalls_free(void* this_arg) {
2472 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2473 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2475 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2476 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2480 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2481 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2482 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2483 return (void*) this_arg;
2485 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2486 jclass c = (*env)->GetObjectClass(env, o);
2488 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2489 atomic_init(&calls->refcnt, 1);
2490 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2491 calls->o = (*env)->NewWeakGlobalRef(env, o);
2492 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2493 CHECK(calls->register_tx_meth != NULL);
2494 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2495 CHECK(calls->register_output_meth != NULL);
2498 .this_arg = (void*) calls,
2499 .register_tx = register_tx_jcall,
2500 .register_output = register_output_jcall,
2501 .free = LDKFilter_JCalls_free,
2505 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2506 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2507 *res_ptr = LDKFilter_init(env, _a, o);
2508 return (long)res_ptr;
2510 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2511 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2516 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2517 unsigned char txid_arr[32];
2518 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2519 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2520 unsigned char (*txid_ref)[32] = &txid_arr;
2521 LDKu8slice script_pubkey_ref;
2522 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2523 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2524 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2525 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2529 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2530 LDKOutPoint outpoint_conv;
2531 outpoint_conv.inner = (void*)(outpoint & (~1));
2532 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2533 LDKu8slice script_pubkey_ref;
2534 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2535 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2536 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2537 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2540 typedef struct LDKBroadcasterInterface_JCalls {
2541 atomic_size_t refcnt;
2544 jmethodID broadcast_transaction_meth;
2545 } LDKBroadcasterInterface_JCalls;
2546 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2547 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2549 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2550 LDKTransaction *tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
2552 long tx_ref = (long)tx_copy;
2553 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2555 return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2557 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2558 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2559 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2561 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2562 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2566 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2567 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2568 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2569 return (void*) this_arg;
2571 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2572 jclass c = (*env)->GetObjectClass(env, o);
2574 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2575 atomic_init(&calls->refcnt, 1);
2576 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2577 calls->o = (*env)->NewWeakGlobalRef(env, o);
2578 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2579 CHECK(calls->broadcast_transaction_meth != NULL);
2581 LDKBroadcasterInterface ret = {
2582 .this_arg = (void*) calls,
2583 .broadcast_transaction = broadcast_transaction_jcall,
2584 .free = LDKBroadcasterInterface_JCalls_free,
2588 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2589 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2590 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2591 return (long)res_ptr;
2593 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2594 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2599 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2600 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2601 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv);
2604 typedef struct LDKFeeEstimator_JCalls {
2605 atomic_size_t refcnt;
2608 jmethodID get_est_sat_per_1000_weight_meth;
2609 } LDKFeeEstimator_JCalls;
2610 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2611 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2613 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2614 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target);
2615 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2617 return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2619 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2620 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2621 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2623 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2624 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2628 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2629 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2630 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2631 return (void*) this_arg;
2633 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2634 jclass c = (*env)->GetObjectClass(env, o);
2636 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2637 atomic_init(&calls->refcnt, 1);
2638 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2639 calls->o = (*env)->NewWeakGlobalRef(env, o);
2640 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2641 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2643 LDKFeeEstimator ret = {
2644 .this_arg = (void*) calls,
2645 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2646 .free = LDKFeeEstimator_JCalls_free,
2650 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2651 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2652 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2653 return (long)res_ptr;
2655 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2656 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2660 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) {
2661 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2662 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2663 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2667 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2668 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2669 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2671 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2672 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2673 ret->datalen = (*env)->GetArrayLength(env, elems);
2674 if (ret->datalen == 0) {
2677 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2678 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2679 for (size_t i = 0; i < ret->datalen; i++) {
2680 jlong arr_elem = java_elems[i];
2681 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2682 FREE((void*)arr_elem);
2683 ret->data[i] = arr_elem_conv;
2685 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2689 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2690 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2691 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2694 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2695 ret->datalen = (*env)->GetArrayLength(env, elems);
2696 if (ret->datalen == 0) {
2699 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2700 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2701 for (size_t i = 0; i < ret->datalen; i++) {
2702 jlong arr_elem = java_elems[i];
2703 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2704 ret->data[i] = arr_elem_conv;
2706 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2710 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2711 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2712 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2714 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2715 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2716 ret->datalen = (*env)->GetArrayLength(env, elems);
2717 if (ret->datalen == 0) {
2720 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2721 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2722 for (size_t i = 0; i < ret->datalen; i++) {
2723 jlong arr_elem = java_elems[i];
2724 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2725 FREE((void*)arr_elem);
2726 ret->data[i] = arr_elem_conv;
2728 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2732 typedef struct LDKKeysInterface_JCalls {
2733 atomic_size_t refcnt;
2736 jmethodID get_node_secret_meth;
2737 jmethodID get_destination_script_meth;
2738 jmethodID get_shutdown_pubkey_meth;
2739 jmethodID get_channel_keys_meth;
2740 jmethodID get_secure_random_bytes_meth;
2741 } LDKKeysInterface_JCalls;
2742 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2743 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2745 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2746 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2748 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth);
2749 LDKSecretKey arg_ref;
2750 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2751 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
2754 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2755 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2757 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2758 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2760 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_destination_script_meth);
2761 LDKCVec_u8Z arg_ref;
2762 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
2763 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
2766 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2767 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2769 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2770 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2772 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_shutdown_pubkey_meth);
2773 LDKPublicKey arg_ref;
2774 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
2775 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
2778 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2779 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2781 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2782 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2784 LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2785 LDKChannelKeys ret_conv = *(LDKChannelKeys*)ret;
2786 if (ret_conv.free == LDKChannelKeys_JCalls_free) {
2787 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2788 LDKChannelKeys_JCalls_clone(ret_conv.this_arg);
2792 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2793 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2795 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2796 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2798 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth);
2799 LDKThirtyTwoBytes arg_ref;
2800 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2801 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
2804 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2805 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2806 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2808 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2809 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2813 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2814 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2815 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2816 return (void*) this_arg;
2818 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2819 jclass c = (*env)->GetObjectClass(env, o);
2821 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2822 atomic_init(&calls->refcnt, 1);
2823 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2824 calls->o = (*env)->NewWeakGlobalRef(env, o);
2825 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2826 CHECK(calls->get_node_secret_meth != NULL);
2827 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2828 CHECK(calls->get_destination_script_meth != NULL);
2829 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2830 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2831 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2832 CHECK(calls->get_channel_keys_meth != NULL);
2833 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2834 CHECK(calls->get_secure_random_bytes_meth != NULL);
2836 LDKKeysInterface ret = {
2837 .this_arg = (void*) calls,
2838 .get_node_secret = get_node_secret_jcall,
2839 .get_destination_script = get_destination_script_jcall,
2840 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2841 .get_channel_keys = get_channel_keys_jcall,
2842 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2843 .free = LDKKeysInterface_JCalls_free,
2847 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2848 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2849 *res_ptr = LDKKeysInterface_init(env, _a, o);
2850 return (long)res_ptr;
2852 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2853 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2857 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2858 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2859 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2860 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2864 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2865 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2866 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2867 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2868 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2869 CVec_u8Z_free(arg_var);
2873 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2874 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2875 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2876 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2880 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) {
2881 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2882 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2883 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2887 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2888 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2889 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2890 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2894 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2895 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2896 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2897 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2898 for (size_t i = 0; i < vec->datalen; i++) {
2899 CHECK((((long)vec->data[i].inner) & 1) == 0);
2900 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2902 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2905 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2906 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2907 ret->datalen = (*env)->GetArrayLength(env, elems);
2908 if (ret->datalen == 0) {
2911 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2912 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2913 for (size_t i = 0; i < ret->datalen; i++) {
2914 jlong arr_elem = java_elems[i];
2915 LDKChannelDetails arr_elem_conv;
2916 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2917 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2918 if (arr_elem_conv.inner != NULL)
2919 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2920 ret->data[i] = arr_elem_conv;
2922 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2926 static jclass LDKNetAddress_IPv4_class = NULL;
2927 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2928 static jclass LDKNetAddress_IPv6_class = NULL;
2929 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2930 static jclass LDKNetAddress_OnionV2_class = NULL;
2931 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2932 static jclass LDKNetAddress_OnionV3_class = NULL;
2933 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2935 LDKNetAddress_IPv4_class =
2936 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2937 CHECK(LDKNetAddress_IPv4_class != NULL);
2938 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2939 CHECK(LDKNetAddress_IPv4_meth != NULL);
2940 LDKNetAddress_IPv6_class =
2941 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2942 CHECK(LDKNetAddress_IPv6_class != NULL);
2943 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2944 CHECK(LDKNetAddress_IPv6_meth != NULL);
2945 LDKNetAddress_OnionV2_class =
2946 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2947 CHECK(LDKNetAddress_OnionV2_class != NULL);
2948 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2949 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2950 LDKNetAddress_OnionV3_class =
2951 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2952 CHECK(LDKNetAddress_OnionV3_class != NULL);
2953 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2954 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2956 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
2957 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2959 case LDKNetAddress_IPv4: {
2960 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 4);
2961 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 4, obj->i_pv4.addr.data);
2962 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
2964 case LDKNetAddress_IPv6: {
2965 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 16);
2966 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 16, obj->i_pv6.addr.data);
2967 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
2969 case LDKNetAddress_OnionV2: {
2970 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 10);
2971 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 10, obj->onion_v2.addr.data);
2972 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
2974 case LDKNetAddress_OnionV3: {
2975 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
2976 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2977 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);
2982 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2983 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2984 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2986 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2987 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2988 ret->datalen = (*env)->GetArrayLength(env, elems);
2989 if (ret->datalen == 0) {
2992 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2993 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2994 for (size_t i = 0; i < ret->datalen; i++) {
2995 jlong arr_elem = java_elems[i];
2996 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2997 FREE((void*)arr_elem);
2998 ret->data[i] = arr_elem_conv;
3000 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3004 typedef struct LDKChannelMessageHandler_JCalls {
3005 atomic_size_t refcnt;
3008 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
3009 jmethodID handle_open_channel_meth;
3010 jmethodID handle_accept_channel_meth;
3011 jmethodID handle_funding_created_meth;
3012 jmethodID handle_funding_signed_meth;
3013 jmethodID handle_funding_locked_meth;
3014 jmethodID handle_shutdown_meth;
3015 jmethodID handle_closing_signed_meth;
3016 jmethodID handle_update_add_htlc_meth;
3017 jmethodID handle_update_fulfill_htlc_meth;
3018 jmethodID handle_update_fail_htlc_meth;
3019 jmethodID handle_update_fail_malformed_htlc_meth;
3020 jmethodID handle_commitment_signed_meth;
3021 jmethodID handle_revoke_and_ack_meth;
3022 jmethodID handle_update_fee_meth;
3023 jmethodID handle_announcement_signatures_meth;
3024 jmethodID peer_disconnected_meth;
3025 jmethodID peer_connected_meth;
3026 jmethodID handle_channel_reestablish_meth;
3027 jmethodID handle_error_meth;
3028 } LDKChannelMessageHandler_JCalls;
3029 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
3030 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3032 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3033 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3034 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3035 LDKInitFeatures their_features_var = their_features;
3036 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3037 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3038 long their_features_ref = (long)their_features_var.inner;
3039 if (their_features_var.is_owned) {
3040 their_features_ref |= 1;
3042 long ret_msg = (long)msg;
3043 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3045 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, ret_msg);
3047 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
3048 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3050 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3051 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3052 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3053 LDKInitFeatures their_features_var = their_features;
3054 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3055 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3056 long their_features_ref = (long)their_features_var.inner;
3057 if (their_features_var.is_owned) {
3058 their_features_ref |= 1;
3060 long ret_msg = (long)msg;
3061 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3063 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, ret_msg);
3065 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
3066 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3068 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3069 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3070 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3071 long ret_msg = (long)msg;
3072 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3074 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, ret_msg);
3076 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
3077 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3079 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3080 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3081 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3082 long ret_msg = (long)msg;
3083 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3085 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, ret_msg);
3087 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
3088 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3090 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3091 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3092 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3093 long ret_msg = (long)msg;
3094 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3096 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, ret_msg);
3098 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
3099 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3101 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3102 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3103 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3104 long ret_msg = (long)msg;
3105 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3107 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, ret_msg);
3109 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
3110 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3112 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3113 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3114 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3115 long ret_msg = (long)msg;
3116 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3118 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, ret_msg);
3120 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
3121 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3123 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3124 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3125 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3126 long ret_msg = (long)msg;
3127 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3129 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, ret_msg);
3131 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
3132 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3134 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3135 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3136 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3137 long ret_msg = (long)msg;
3138 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3140 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, ret_msg);
3142 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
3143 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3145 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3146 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3147 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3148 long ret_msg = (long)msg;
3149 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3151 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, ret_msg);
3153 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
3154 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3156 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3157 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3158 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3159 long ret_msg = (long)msg;
3160 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3162 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, ret_msg);
3164 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
3165 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3167 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3168 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3169 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3170 long ret_msg = (long)msg;
3171 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3173 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, ret_msg);
3175 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
3176 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3178 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3179 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3180 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3181 long ret_msg = (long)msg;
3182 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3184 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, ret_msg);
3186 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
3187 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3189 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3190 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3191 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3192 long ret_msg = (long)msg;
3193 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3195 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, ret_msg);
3197 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
3198 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3200 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3201 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3202 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3203 long ret_msg = (long)msg;
3204 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3206 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, ret_msg);
3208 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3209 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3211 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3212 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3213 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3214 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3216 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
3218 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
3219 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3221 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3222 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3223 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3224 long ret_msg = (long)msg;
3225 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3227 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, ret_msg);
3229 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3230 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3232 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3233 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3234 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3235 long ret_msg = (long)msg;
3236 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3238 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, ret_msg);
3240 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
3241 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3243 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3244 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3245 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3246 long ret_msg = (long)msg;
3247 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3249 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, ret_msg);
3251 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3252 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3253 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3255 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3256 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3260 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3261 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3262 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3263 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3264 return (void*) this_arg;
3266 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3267 jclass c = (*env)->GetObjectClass(env, o);
3269 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3270 atomic_init(&calls->refcnt, 1);
3271 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3272 calls->o = (*env)->NewWeakGlobalRef(env, o);
3273 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3274 CHECK(calls->handle_open_channel_meth != NULL);
3275 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3276 CHECK(calls->handle_accept_channel_meth != NULL);
3277 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3278 CHECK(calls->handle_funding_created_meth != NULL);
3279 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3280 CHECK(calls->handle_funding_signed_meth != NULL);
3281 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3282 CHECK(calls->handle_funding_locked_meth != NULL);
3283 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3284 CHECK(calls->handle_shutdown_meth != NULL);
3285 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3286 CHECK(calls->handle_closing_signed_meth != NULL);
3287 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3288 CHECK(calls->handle_update_add_htlc_meth != NULL);
3289 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3290 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3291 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3292 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3293 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3294 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3295 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3296 CHECK(calls->handle_commitment_signed_meth != NULL);
3297 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3298 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3299 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3300 CHECK(calls->handle_update_fee_meth != NULL);
3301 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3302 CHECK(calls->handle_announcement_signatures_meth != NULL);
3303 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3304 CHECK(calls->peer_disconnected_meth != NULL);
3305 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3306 CHECK(calls->peer_connected_meth != NULL);
3307 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3308 CHECK(calls->handle_channel_reestablish_meth != NULL);
3309 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3310 CHECK(calls->handle_error_meth != NULL);
3312 LDKChannelMessageHandler ret = {
3313 .this_arg = (void*) calls,
3314 .handle_open_channel = handle_open_channel_jcall,
3315 .handle_accept_channel = handle_accept_channel_jcall,
3316 .handle_funding_created = handle_funding_created_jcall,
3317 .handle_funding_signed = handle_funding_signed_jcall,
3318 .handle_funding_locked = handle_funding_locked_jcall,
3319 .handle_shutdown = handle_shutdown_jcall,
3320 .handle_closing_signed = handle_closing_signed_jcall,
3321 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3322 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3323 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3324 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3325 .handle_commitment_signed = handle_commitment_signed_jcall,
3326 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3327 .handle_update_fee = handle_update_fee_jcall,
3328 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3329 .peer_disconnected = peer_disconnected_jcall,
3330 .peer_connected = peer_connected_jcall,
3331 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3332 .handle_error = handle_error_jcall,
3333 .free = LDKChannelMessageHandler_JCalls_free,
3334 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3336 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3339 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3340 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3341 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3342 return (long)res_ptr;
3344 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3345 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3349 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) {
3350 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3351 LDKPublicKey their_node_id_ref;
3352 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3353 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3354 LDKInitFeatures their_features_conv;
3355 their_features_conv.inner = (void*)(their_features & (~1));
3356 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3357 // Warning: we may need a move here but can't clone!
3358 LDKOpenChannel msg_conv;
3359 msg_conv.inner = (void*)(msg & (~1));
3360 msg_conv.is_owned = (msg & 1) || (msg == 0);
3361 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3364 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) {
3365 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3366 LDKPublicKey their_node_id_ref;
3367 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3368 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3369 LDKInitFeatures their_features_conv;
3370 their_features_conv.inner = (void*)(their_features & (~1));
3371 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3372 // Warning: we may need a move here but can't clone!
3373 LDKAcceptChannel msg_conv;
3374 msg_conv.inner = (void*)(msg & (~1));
3375 msg_conv.is_owned = (msg & 1) || (msg == 0);
3376 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3379 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) {
3380 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3381 LDKPublicKey their_node_id_ref;
3382 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3383 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3384 LDKFundingCreated msg_conv;
3385 msg_conv.inner = (void*)(msg & (~1));
3386 msg_conv.is_owned = (msg & 1) || (msg == 0);
3387 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3390 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) {
3391 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3392 LDKPublicKey their_node_id_ref;
3393 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3394 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3395 LDKFundingSigned msg_conv;
3396 msg_conv.inner = (void*)(msg & (~1));
3397 msg_conv.is_owned = (msg & 1) || (msg == 0);
3398 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3401 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) {
3402 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3403 LDKPublicKey their_node_id_ref;
3404 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3405 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3406 LDKFundingLocked msg_conv;
3407 msg_conv.inner = (void*)(msg & (~1));
3408 msg_conv.is_owned = (msg & 1) || (msg == 0);
3409 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3413 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3414 LDKPublicKey their_node_id_ref;
3415 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3416 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3417 LDKShutdown msg_conv;
3418 msg_conv.inner = (void*)(msg & (~1));
3419 msg_conv.is_owned = (msg & 1) || (msg == 0);
3420 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3423 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) {
3424 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3425 LDKPublicKey their_node_id_ref;
3426 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3427 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3428 LDKClosingSigned msg_conv;
3429 msg_conv.inner = (void*)(msg & (~1));
3430 msg_conv.is_owned = (msg & 1) || (msg == 0);
3431 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3434 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) {
3435 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3436 LDKPublicKey their_node_id_ref;
3437 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3438 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3439 LDKUpdateAddHTLC msg_conv;
3440 msg_conv.inner = (void*)(msg & (~1));
3441 msg_conv.is_owned = (msg & 1) || (msg == 0);
3442 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3445 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) {
3446 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3447 LDKPublicKey their_node_id_ref;
3448 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3449 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3450 LDKUpdateFulfillHTLC msg_conv;
3451 msg_conv.inner = (void*)(msg & (~1));
3452 msg_conv.is_owned = (msg & 1) || (msg == 0);
3453 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3456 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) {
3457 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3458 LDKPublicKey their_node_id_ref;
3459 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3460 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3461 LDKUpdateFailHTLC msg_conv;
3462 msg_conv.inner = (void*)(msg & (~1));
3463 msg_conv.is_owned = (msg & 1) || (msg == 0);
3464 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3467 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) {
3468 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3469 LDKPublicKey their_node_id_ref;
3470 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3471 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3472 LDKUpdateFailMalformedHTLC msg_conv;
3473 msg_conv.inner = (void*)(msg & (~1));
3474 msg_conv.is_owned = (msg & 1) || (msg == 0);
3475 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3478 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) {
3479 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3480 LDKPublicKey their_node_id_ref;
3481 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3482 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3483 LDKCommitmentSigned msg_conv;
3484 msg_conv.inner = (void*)(msg & (~1));
3485 msg_conv.is_owned = (msg & 1) || (msg == 0);
3486 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3489 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) {
3490 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3491 LDKPublicKey their_node_id_ref;
3492 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3493 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3494 LDKRevokeAndACK msg_conv;
3495 msg_conv.inner = (void*)(msg & (~1));
3496 msg_conv.is_owned = (msg & 1) || (msg == 0);
3497 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3500 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) {
3501 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3502 LDKPublicKey their_node_id_ref;
3503 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3504 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3505 LDKUpdateFee msg_conv;
3506 msg_conv.inner = (void*)(msg & (~1));
3507 msg_conv.is_owned = (msg & 1) || (msg == 0);
3508 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3511 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) {
3512 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3513 LDKPublicKey their_node_id_ref;
3514 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3515 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3516 LDKAnnouncementSignatures msg_conv;
3517 msg_conv.inner = (void*)(msg & (~1));
3518 msg_conv.is_owned = (msg & 1) || (msg == 0);
3519 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3522 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) {
3523 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3524 LDKPublicKey their_node_id_ref;
3525 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3526 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3527 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3531 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3532 LDKPublicKey their_node_id_ref;
3533 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3534 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3536 msg_conv.inner = (void*)(msg & (~1));
3537 msg_conv.is_owned = (msg & 1) || (msg == 0);
3538 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3541 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) {
3542 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3543 LDKPublicKey their_node_id_ref;
3544 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3545 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3546 LDKChannelReestablish msg_conv;
3547 msg_conv.inner = (void*)(msg & (~1));
3548 msg_conv.is_owned = (msg & 1) || (msg == 0);
3549 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3553 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3554 LDKPublicKey their_node_id_ref;
3555 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3556 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3557 LDKErrorMessage msg_conv;
3558 msg_conv.inner = (void*)(msg & (~1));
3559 msg_conv.is_owned = (msg & 1) || (msg == 0);
3560 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3563 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3564 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3565 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3566 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3567 for (size_t i = 0; i < vec->datalen; i++) {
3568 CHECK((((long)vec->data[i].inner) & 1) == 0);
3569 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3571 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3574 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3575 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3576 ret->datalen = (*env)->GetArrayLength(env, elems);
3577 if (ret->datalen == 0) {
3580 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3581 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3582 for (size_t i = 0; i < ret->datalen; i++) {
3583 jlong arr_elem = java_elems[i];
3584 LDKChannelMonitor arr_elem_conv;
3585 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3586 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3587 // Warning: we may need a move here but can't clone!
3588 ret->data[i] = arr_elem_conv;
3590 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3594 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3595 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3596 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3598 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3599 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3600 ret->datalen = (*env)->GetArrayLength(env, elems);
3601 if (ret->datalen == 0) {
3604 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3605 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3606 for (size_t i = 0; i < ret->datalen; i++) {
3607 ret->data[i] = java_elems[i];
3609 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3613 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3614 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3615 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3616 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3617 for (size_t i = 0; i < vec->datalen; i++) {
3618 CHECK((((long)vec->data[i].inner) & 1) == 0);
3619 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3621 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3624 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3625 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3626 ret->datalen = (*env)->GetArrayLength(env, elems);
3627 if (ret->datalen == 0) {
3630 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3631 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3632 for (size_t i = 0; i < ret->datalen; i++) {
3633 jlong arr_elem = java_elems[i];
3634 LDKUpdateAddHTLC arr_elem_conv;
3635 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3636 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3637 if (arr_elem_conv.inner != NULL)
3638 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3639 ret->data[i] = arr_elem_conv;
3641 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3645 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3646 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3647 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3648 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3649 for (size_t i = 0; i < vec->datalen; i++) {
3650 CHECK((((long)vec->data[i].inner) & 1) == 0);
3651 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3653 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3656 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3657 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3658 ret->datalen = (*env)->GetArrayLength(env, elems);
3659 if (ret->datalen == 0) {
3662 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3663 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3664 for (size_t i = 0; i < ret->datalen; i++) {
3665 jlong arr_elem = java_elems[i];
3666 LDKUpdateFulfillHTLC arr_elem_conv;
3667 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3668 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3669 if (arr_elem_conv.inner != NULL)
3670 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3671 ret->data[i] = arr_elem_conv;
3673 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3677 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3678 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3679 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3680 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3681 for (size_t i = 0; i < vec->datalen; i++) {
3682 CHECK((((long)vec->data[i].inner) & 1) == 0);
3683 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3685 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3688 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3689 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3690 ret->datalen = (*env)->GetArrayLength(env, elems);
3691 if (ret->datalen == 0) {
3694 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3695 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3696 for (size_t i = 0; i < ret->datalen; i++) {
3697 jlong arr_elem = java_elems[i];
3698 LDKUpdateFailHTLC arr_elem_conv;
3699 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3700 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3701 if (arr_elem_conv.inner != NULL)
3702 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3703 ret->data[i] = arr_elem_conv;
3705 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3709 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3710 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3711 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3712 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3713 for (size_t i = 0; i < vec->datalen; i++) {
3714 CHECK((((long)vec->data[i].inner) & 1) == 0);
3715 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3717 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3720 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3721 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3722 ret->datalen = (*env)->GetArrayLength(env, elems);
3723 if (ret->datalen == 0) {
3726 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3727 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3728 for (size_t i = 0; i < ret->datalen; i++) {
3729 jlong arr_elem = java_elems[i];
3730 LDKUpdateFailMalformedHTLC arr_elem_conv;
3731 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3732 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3733 if (arr_elem_conv.inner != NULL)
3734 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3735 ret->data[i] = arr_elem_conv;
3737 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3741 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3742 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3744 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3745 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3746 CHECK(val->result_ok);
3747 return *val->contents.result;
3749 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3750 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3751 CHECK(!val->result_ok);
3752 LDKLightningError err_var = (*val->contents.err);
3753 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3754 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3755 long err_ref = (long)err_var.inner & ~1;
3758 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3759 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3760 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3762 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3763 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3764 ret->datalen = (*env)->GetArrayLength(env, elems);
3765 if (ret->datalen == 0) {
3768 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3769 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3770 for (size_t i = 0; i < ret->datalen; i++) {
3771 jlong arr_elem = java_elems[i];
3772 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3773 FREE((void*)arr_elem);
3774 ret->data[i] = arr_elem_conv;
3776 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3780 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3781 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3782 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3783 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3784 for (size_t i = 0; i < vec->datalen; i++) {
3785 CHECK((((long)vec->data[i].inner) & 1) == 0);
3786 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3788 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3792 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3793 ret->datalen = (*env)->GetArrayLength(env, elems);
3794 if (ret->datalen == 0) {
3797 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3798 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3799 for (size_t i = 0; i < ret->datalen; i++) {
3800 jlong arr_elem = java_elems[i];
3801 LDKNodeAnnouncement arr_elem_conv;
3802 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3803 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3804 if (arr_elem_conv.inner != NULL)
3805 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3806 ret->data[i] = arr_elem_conv;
3808 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3812 typedef struct LDKRoutingMessageHandler_JCalls {
3813 atomic_size_t refcnt;
3816 jmethodID handle_node_announcement_meth;
3817 jmethodID handle_channel_announcement_meth;
3818 jmethodID handle_channel_update_meth;
3819 jmethodID handle_htlc_fail_channel_update_meth;
3820 jmethodID get_next_channel_announcements_meth;
3821 jmethodID get_next_node_announcements_meth;
3822 jmethodID should_request_full_sync_meth;
3823 } LDKRoutingMessageHandler_JCalls;
3824 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3825 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3827 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3828 long ret_msg = (long)msg;
3829 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3831 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, ret_msg);
3832 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
3836 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3837 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3839 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3840 long ret_msg = (long)msg;
3841 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3843 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, ret_msg);
3844 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
3848 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3849 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3851 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3852 long ret_msg = (long)msg;
3853 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3855 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, ret_msg);
3856 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
3860 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3861 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3863 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3864 long ret_update = (long)update;
3865 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3867 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
3869 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3870 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3872 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3873 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3875 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3876 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
3877 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
3878 if (arg_constr.datalen > 0)
3879 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
3881 arg_constr.data = NULL;
3882 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
3883 for (size_t l = 0; l < arg_constr.datalen; l++) {
3884 long arr_conv_63 = arg_vals[l];
3885 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
3886 FREE((void*)arr_conv_63);
3887 arg_constr.data[l] = arr_conv_63_conv;
3889 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
3892 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3893 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3895 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3896 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
3897 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
3898 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3900 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3901 LDKCVec_NodeAnnouncementZ arg_constr;
3902 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
3903 if (arg_constr.datalen > 0)
3904 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
3906 arg_constr.data = NULL;
3907 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
3908 for (size_t s = 0; s < arg_constr.datalen; s++) {
3909 long arr_conv_18 = arg_vals[s];
3910 LDKNodeAnnouncement arr_conv_18_conv;
3911 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
3912 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
3913 if (arr_conv_18_conv.inner != NULL)
3914 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
3915 arg_constr.data[s] = arr_conv_18_conv;
3917 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
3920 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3921 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3923 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3924 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
3925 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form);
3926 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3928 return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3930 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3931 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3932 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3934 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3935 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3939 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3940 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3941 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3942 return (void*) this_arg;
3944 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3945 jclass c = (*env)->GetObjectClass(env, o);
3947 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3948 atomic_init(&calls->refcnt, 1);
3949 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3950 calls->o = (*env)->NewWeakGlobalRef(env, o);
3951 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3952 CHECK(calls->handle_node_announcement_meth != NULL);
3953 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3954 CHECK(calls->handle_channel_announcement_meth != NULL);
3955 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3956 CHECK(calls->handle_channel_update_meth != NULL);
3957 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3958 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
3959 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
3960 CHECK(calls->get_next_channel_announcements_meth != NULL);
3961 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
3962 CHECK(calls->get_next_node_announcements_meth != NULL);
3963 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3964 CHECK(calls->should_request_full_sync_meth != NULL);
3966 LDKRoutingMessageHandler ret = {
3967 .this_arg = (void*) calls,
3968 .handle_node_announcement = handle_node_announcement_jcall,
3969 .handle_channel_announcement = handle_channel_announcement_jcall,
3970 .handle_channel_update = handle_channel_update_jcall,
3971 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3972 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3973 .get_next_node_announcements = get_next_node_announcements_jcall,
3974 .should_request_full_sync = should_request_full_sync_jcall,
3975 .free = LDKRoutingMessageHandler_JCalls_free,
3979 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3980 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3981 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3982 return (long)res_ptr;
3984 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3985 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3989 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3990 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3991 LDKNodeAnnouncement msg_conv;
3992 msg_conv.inner = (void*)(msg & (~1));
3993 msg_conv.is_owned = (msg & 1) || (msg == 0);
3994 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3995 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
3996 return (long)ret_conv;
3999 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4000 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4001 LDKChannelAnnouncement msg_conv;
4002 msg_conv.inner = (void*)(msg & (~1));
4003 msg_conv.is_owned = (msg & 1) || (msg == 0);
4004 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4005 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4006 return (long)ret_conv;
4009 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4010 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4011 LDKChannelUpdate msg_conv;
4012 msg_conv.inner = (void*)(msg & (~1));
4013 msg_conv.is_owned = (msg & 1) || (msg == 0);
4014 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4015 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
4016 return (long)ret_conv;
4019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
4020 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4021 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
4022 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
4025 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) {
4026 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4027 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
4028 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
4029 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
4030 for (size_t l = 0; l < ret_var.datalen; l++) {
4031 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4032 *arr_conv_63_ref = ret_var.data[l];
4033 ret_arr_ptr[l] = (long)arr_conv_63_ref;
4035 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4036 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(ret_var);
4040 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) {
4041 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4042 LDKPublicKey starting_point_ref;
4043 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
4044 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
4045 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
4046 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
4047 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
4048 for (size_t s = 0; s < ret_var.datalen; s++) {
4049 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
4050 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4051 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4052 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
4053 if (arr_conv_18_var.is_owned) {
4054 arr_conv_18_ref |= 1;
4056 ret_arr_ptr[s] = arr_conv_18_ref;
4058 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4063 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
4064 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4065 LDKPublicKey node_id_ref;
4066 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
4067 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
4068 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
4072 typedef struct LDKSocketDescriptor_JCalls {
4073 atomic_size_t refcnt;
4076 jmethodID send_data_meth;
4077 jmethodID disconnect_socket_meth;
4079 jmethodID hash_meth;
4080 } LDKSocketDescriptor_JCalls;
4081 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
4082 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4084 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4085 LDKu8slice data_var = data;
4086 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
4087 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
4088 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4090 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
4092 void disconnect_socket_jcall(void* this_arg) {
4093 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4095 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4096 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4098 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
4100 bool eq_jcall(const void* this_arg, const void *other_arg) {
4101 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4103 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4104 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4106 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, other_arg);
4108 uint64_t hash_jcall(const void* this_arg) {
4109 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4111 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4112 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4114 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
4116 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
4117 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4118 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4120 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4121 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4125 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
4126 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4127 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4128 return (void*) this_arg;
4130 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
4131 jclass c = (*env)->GetObjectClass(env, o);
4133 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
4134 atomic_init(&calls->refcnt, 1);
4135 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4136 calls->o = (*env)->NewWeakGlobalRef(env, o);
4137 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
4138 CHECK(calls->send_data_meth != NULL);
4139 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
4140 CHECK(calls->disconnect_socket_meth != NULL);
4141 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
4142 CHECK(calls->eq_meth != NULL);
4143 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
4144 CHECK(calls->hash_meth != NULL);
4146 LDKSocketDescriptor ret = {
4147 .this_arg = (void*) calls,
4148 .send_data = send_data_jcall,
4149 .disconnect_socket = disconnect_socket_jcall,
4152 .clone = LDKSocketDescriptor_JCalls_clone,
4153 .free = LDKSocketDescriptor_JCalls_free,
4157 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
4158 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4159 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
4160 return (long)res_ptr;
4162 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4163 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
4167 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
4168 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4169 LDKu8slice data_ref;
4170 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
4171 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
4172 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4173 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
4177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
4178 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4179 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4182 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
4183 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4184 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4188 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4189 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
4190 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
4192 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4193 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4195 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4196 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4197 CHECK(val->result_ok);
4198 LDKCVecTempl_u8 res_var = (*val->contents.result);
4199 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
4200 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
4203 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4204 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4205 CHECK(!val->result_ok);
4206 LDKPeerHandleError err_var = (*val->contents.err);
4207 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4208 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4209 long err_ref = (long)err_var.inner & ~1;
4212 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4213 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4216 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4217 CHECK(val->result_ok);
4218 return *val->contents.result;
4220 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4221 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4222 CHECK(!val->result_ok);
4223 LDKPeerHandleError err_var = (*val->contents.err);
4224 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4225 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4226 long err_ref = (long)err_var.inner & ~1;
4229 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4230 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
4232 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4233 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4234 CHECK(val->result_ok);
4235 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
4236 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
4239 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4240 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4241 CHECK(!val->result_ok);
4242 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4246 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
4248 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4249 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4250 CHECK(val->result_ok);
4251 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
4252 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
4255 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4256 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4257 CHECK(!val->result_ok);
4258 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4261 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4262 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
4264 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4265 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4266 CHECK(val->result_ok);
4267 LDKTxCreationKeys res_var = (*val->contents.result);
4268 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4269 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4270 long res_ref = (long)res_var.inner & ~1;
4273 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4274 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4275 CHECK(!val->result_ok);
4276 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4279 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4280 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4281 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4283 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4284 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4285 ret->datalen = (*env)->GetArrayLength(env, elems);
4286 if (ret->datalen == 0) {
4289 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4290 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4291 for (size_t i = 0; i < ret->datalen; i++) {
4292 jlong arr_elem = java_elems[i];
4293 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4294 FREE((void*)arr_elem);
4295 ret->data[i] = arr_elem_conv;
4297 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4301 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4302 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4303 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4304 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4305 for (size_t i = 0; i < vec->datalen; i++) {
4306 CHECK((((long)vec->data[i].inner) & 1) == 0);
4307 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4309 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4312 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4313 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4314 ret->datalen = (*env)->GetArrayLength(env, elems);
4315 if (ret->datalen == 0) {
4318 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4319 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4320 for (size_t i = 0; i < ret->datalen; i++) {
4321 jlong arr_elem = java_elems[i];
4322 LDKRouteHop arr_elem_conv;
4323 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4324 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4325 if (arr_elem_conv.inner != NULL)
4326 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4327 ret->data[i] = arr_elem_conv;
4329 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4333 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4334 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4335 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4337 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4338 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4340 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4341 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4342 CHECK(val->result_ok);
4343 LDKRoute res_var = (*val->contents.result);
4344 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4345 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4346 long res_ref = (long)res_var.inner & ~1;
4349 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4350 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4351 CHECK(!val->result_ok);
4352 LDKLightningError err_var = (*val->contents.err);
4353 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4354 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4355 long err_ref = (long)err_var.inner & ~1;
4358 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4359 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4360 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4361 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4362 for (size_t i = 0; i < vec->datalen; i++) {
4363 CHECK((((long)vec->data[i].inner) & 1) == 0);
4364 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4366 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4369 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4370 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4371 ret->datalen = (*env)->GetArrayLength(env, elems);
4372 if (ret->datalen == 0) {
4375 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4376 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4377 for (size_t i = 0; i < ret->datalen; i++) {
4378 jlong arr_elem = java_elems[i];
4379 LDKRouteHint arr_elem_conv;
4380 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4381 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4382 if (arr_elem_conv.inner != NULL)
4383 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4384 ret->data[i] = arr_elem_conv;
4386 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4391 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4393 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4397 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4399 C2Tuple_OutPointScriptZ_free(arg_conv);
4402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4403 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4405 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4409 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4411 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4415 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4417 C2Tuple_u64u64Z_free(arg_conv);
4420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4421 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4423 C2Tuple_usizeTransactionZ_free(arg_conv);
4426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4427 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4429 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4433 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4435 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4438 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4439 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4441 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4442 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4443 return (long)ret_conv;
4446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4447 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4449 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray arg) {
4453 LDKCVec_SignatureZ arg_constr;
4454 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4455 if (arg_constr.datalen > 0)
4456 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4458 arg_constr.data = NULL;
4459 for (size_t i = 0; i < arg_constr.datalen; i++) {
4460 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4461 LDKSignature arr_conv_8_ref;
4462 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4463 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4464 arg_constr.data[i] = arr_conv_8_ref;
4466 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4467 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(arg_constr);
4468 return (long)ret_conv;
4471 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4472 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4474 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4475 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4476 return (long)ret_conv;
4479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4480 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4482 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4486 LDKCVec_u8Z arg_ref;
4487 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
4488 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4489 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4490 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4491 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
4492 return (long)ret_conv;
4495 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4496 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4498 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4499 *ret_conv = CResult_NoneAPIErrorZ_err(arg_conv);
4500 return (long)ret_conv;
4503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4504 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4506 CResult_NoneAPIErrorZ_free(arg_conv);
4509 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4510 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4512 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4513 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4514 return (long)ret_conv;
4517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4518 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4520 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4523 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4524 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4526 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4527 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4528 return (long)ret_conv;
4531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4532 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4534 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4537 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4538 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4540 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4541 *ret_conv = CResult_NonePaymentSendFailureZ_err(arg_conv);
4542 return (long)ret_conv;
4545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4546 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4548 CResult_NonePaymentSendFailureZ_free(arg_conv);
4551 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4552 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4554 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4555 *ret_conv = CResult_NonePeerHandleErrorZ_err(arg_conv);
4556 return (long)ret_conv;
4559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4560 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4562 CResult_NonePeerHandleErrorZ_free(arg_conv);
4565 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4566 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4568 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4569 *ret_conv = CResult_PublicKeySecpErrorZ_err(arg_conv);
4570 return (long)ret_conv;
4573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4574 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4576 CResult_PublicKeySecpErrorZ_free(arg_conv);
4579 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4580 LDKPublicKey arg_ref;
4581 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4582 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4583 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4584 *ret_conv = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4585 return (long)ret_conv;
4588 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4589 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4591 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4592 *ret_conv = CResult_RouteLightningErrorZ_err(arg_conv);
4593 return (long)ret_conv;
4596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4597 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4599 CResult_RouteLightningErrorZ_free(arg_conv);
4602 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4603 LDKRoute arg_conv = *(LDKRoute*)arg;
4605 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4606 *ret_conv = CResult_RouteLightningErrorZ_ok(arg_conv);
4607 return (long)ret_conv;
4610 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4611 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4613 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4614 *ret_conv = CResult_SecretKeySecpErrorZ_err(arg_conv);
4615 return (long)ret_conv;
4618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4619 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4621 CResult_SecretKeySecpErrorZ_free(arg_conv);
4624 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4625 LDKSecretKey arg_ref;
4626 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4627 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4628 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4629 *ret_conv = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4630 return (long)ret_conv;
4633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4634 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4636 CResult_SignatureNoneZ_free(arg_conv);
4639 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4640 LDKSignature arg_ref;
4641 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4642 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4643 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4644 *ret_conv = CResult_SignatureNoneZ_ok(arg_ref);
4645 return (long)ret_conv;
4648 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4649 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4651 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4652 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4653 return (long)ret_conv;
4656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4657 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4659 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4662 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4663 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4665 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4666 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4667 return (long)ret_conv;
4670 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4671 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4673 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4674 *ret_conv = CResult_TxOutAccessErrorZ_err(arg_conv);
4675 return (long)ret_conv;
4678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4679 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4681 CResult_TxOutAccessErrorZ_free(arg_conv);
4684 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4685 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4687 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4688 *ret_conv = CResult_TxOutAccessErrorZ_ok(arg_conv);
4689 return (long)ret_conv;
4692 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4693 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4695 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4696 *ret_conv = CResult_boolLightningErrorZ_err(arg_conv);
4697 return (long)ret_conv;
4700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4701 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4703 CResult_boolLightningErrorZ_free(arg_conv);
4706 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4707 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4708 *ret_conv = CResult_boolLightningErrorZ_ok(arg);
4709 return (long)ret_conv;
4712 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4713 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4715 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4716 *ret_conv = CResult_boolPeerHandleErrorZ_err(arg_conv);
4717 return (long)ret_conv;
4720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4721 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4723 CResult_boolPeerHandleErrorZ_free(arg_conv);
4726 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4727 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4728 *ret_conv = CResult_boolPeerHandleErrorZ_ok(arg);
4729 return (long)ret_conv;
4732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4733 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_constr;
4734 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4735 if (arg_constr.datalen > 0)
4736 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
4738 arg_constr.data = NULL;
4739 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4740 for (size_t q = 0; q < arg_constr.datalen; q++) {
4741 long arr_conv_42 = arg_vals[q];
4742 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
4743 FREE((void*)arr_conv_42);
4744 arg_constr.data[q] = arr_conv_42_conv;
4746 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4747 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_constr);
4750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4751 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_constr;
4752 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4753 if (arg_constr.datalen > 0)
4754 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ Elements");
4756 arg_constr.data = NULL;
4757 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4758 for (size_t b = 0; b < arg_constr.datalen; b++) {
4759 long arr_conv_27 = arg_vals[b];
4760 LDKC2Tuple_TxidCVec_TxOutZZ arr_conv_27_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arr_conv_27;
4761 FREE((void*)arr_conv_27);
4762 arg_constr.data[b] = arr_conv_27_conv;
4764 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4765 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_constr);
4768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4769 LDKCVec_C2Tuple_usizeTransactionZZ arg_constr;
4770 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4771 if (arg_constr.datalen > 0)
4772 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
4774 arg_constr.data = NULL;
4775 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4776 for (size_t d = 0; d < arg_constr.datalen; d++) {
4777 long arr_conv_29 = arg_vals[d];
4778 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
4779 FREE((void*)arr_conv_29);
4780 arg_constr.data[d] = arr_conv_29_conv;
4782 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4783 CVec_C2Tuple_usizeTransactionZZ_free(arg_constr);
4786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4787 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4788 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4789 if (arg_constr.datalen > 0)
4790 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4792 arg_constr.data = NULL;
4793 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4794 for (size_t l = 0; l < arg_constr.datalen; l++) {
4795 long arr_conv_63 = arg_vals[l];
4796 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4797 FREE((void*)arr_conv_63);
4798 arg_constr.data[l] = arr_conv_63_conv;
4800 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4801 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_constr);
4804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4805 LDKCVec_CVec_RouteHopZZ arg_constr;
4806 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4807 if (arg_constr.datalen > 0)
4808 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
4810 arg_constr.data = NULL;
4811 for (size_t m = 0; m < arg_constr.datalen; m++) {
4812 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, arg, m);
4813 LDKCVec_RouteHopZ arr_conv_12_constr;
4814 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
4815 if (arr_conv_12_constr.datalen > 0)
4816 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4818 arr_conv_12_constr.data = NULL;
4819 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
4820 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
4821 long arr_conv_10 = arr_conv_12_vals[k];
4822 LDKRouteHop arr_conv_10_conv;
4823 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4824 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4825 arr_conv_12_constr.data[k] = arr_conv_10_conv;
4827 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
4828 arg_constr.data[m] = arr_conv_12_constr;
4830 CVec_CVec_RouteHopZZ_free(arg_constr);
4833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4834 LDKCVec_ChannelDetailsZ arg_constr;
4835 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4836 if (arg_constr.datalen > 0)
4837 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
4839 arg_constr.data = NULL;
4840 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4841 for (size_t q = 0; q < arg_constr.datalen; q++) {
4842 long arr_conv_16 = arg_vals[q];
4843 LDKChannelDetails arr_conv_16_conv;
4844 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4845 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4846 arg_constr.data[q] = arr_conv_16_conv;
4848 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4849 CVec_ChannelDetailsZ_free(arg_constr);
4852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4853 LDKCVec_ChannelMonitorZ arg_constr;
4854 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4855 if (arg_constr.datalen > 0)
4856 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
4858 arg_constr.data = NULL;
4859 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4860 for (size_t q = 0; q < arg_constr.datalen; q++) {
4861 long arr_conv_16 = arg_vals[q];
4862 LDKChannelMonitor arr_conv_16_conv;
4863 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4864 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4865 arg_constr.data[q] = arr_conv_16_conv;
4867 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4868 CVec_ChannelMonitorZ_free(arg_constr);
4871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4872 LDKCVec_EventZ arg_constr;
4873 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4874 if (arg_constr.datalen > 0)
4875 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4877 arg_constr.data = NULL;
4878 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4879 for (size_t h = 0; h < arg_constr.datalen; h++) {
4880 long arr_conv_7 = arg_vals[h];
4881 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
4882 FREE((void*)arr_conv_7);
4883 arg_constr.data[h] = arr_conv_7_conv;
4885 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4886 CVec_EventZ_free(arg_constr);
4889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4890 LDKCVec_HTLCOutputInCommitmentZ arg_constr;
4891 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4892 if (arg_constr.datalen > 0)
4893 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
4895 arg_constr.data = NULL;
4896 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4897 for (size_t y = 0; y < arg_constr.datalen; y++) {
4898 long arr_conv_24 = arg_vals[y];
4899 LDKHTLCOutputInCommitment arr_conv_24_conv;
4900 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
4901 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
4902 arg_constr.data[y] = arr_conv_24_conv;
4904 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4905 CVec_HTLCOutputInCommitmentZ_free(arg_constr);
4908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4909 LDKCVec_MessageSendEventZ arg_constr;
4910 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4911 if (arg_constr.datalen > 0)
4912 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4914 arg_constr.data = NULL;
4915 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4916 for (size_t s = 0; s < arg_constr.datalen; s++) {
4917 long arr_conv_18 = arg_vals[s];
4918 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
4919 FREE((void*)arr_conv_18);
4920 arg_constr.data[s] = arr_conv_18_conv;
4922 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4923 CVec_MessageSendEventZ_free(arg_constr);
4926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4927 LDKCVec_MonitorEventZ arg_constr;
4928 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4929 if (arg_constr.datalen > 0)
4930 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
4932 arg_constr.data = NULL;
4933 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4934 for (size_t o = 0; o < arg_constr.datalen; o++) {
4935 long arr_conv_14 = arg_vals[o];
4936 LDKMonitorEvent arr_conv_14_conv;
4937 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
4938 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
4939 arg_constr.data[o] = arr_conv_14_conv;
4941 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4942 CVec_MonitorEventZ_free(arg_constr);
4945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4946 LDKCVec_NetAddressZ arg_constr;
4947 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4948 if (arg_constr.datalen > 0)
4949 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
4951 arg_constr.data = NULL;
4952 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4953 for (size_t m = 0; m < arg_constr.datalen; m++) {
4954 long arr_conv_12 = arg_vals[m];
4955 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
4956 FREE((void*)arr_conv_12);
4957 arg_constr.data[m] = arr_conv_12_conv;
4959 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4960 CVec_NetAddressZ_free(arg_constr);
4963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4964 LDKCVec_NodeAnnouncementZ arg_constr;
4965 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4966 if (arg_constr.datalen > 0)
4967 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4969 arg_constr.data = NULL;
4970 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4971 for (size_t s = 0; s < arg_constr.datalen; s++) {
4972 long arr_conv_18 = arg_vals[s];
4973 LDKNodeAnnouncement arr_conv_18_conv;
4974 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4975 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4976 arg_constr.data[s] = arr_conv_18_conv;
4978 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4979 CVec_NodeAnnouncementZ_free(arg_constr);
4982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4983 LDKCVec_PublicKeyZ arg_constr;
4984 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4985 if (arg_constr.datalen > 0)
4986 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
4988 arg_constr.data = NULL;
4989 for (size_t i = 0; i < arg_constr.datalen; i++) {
4990 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4991 LDKPublicKey arr_conv_8_ref;
4992 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
4993 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
4994 arg_constr.data[i] = arr_conv_8_ref;
4996 CVec_PublicKeyZ_free(arg_constr);
4999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5000 LDKCVec_RouteHintZ arg_constr;
5001 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5002 if (arg_constr.datalen > 0)
5003 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
5005 arg_constr.data = NULL;
5006 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5007 for (size_t l = 0; l < arg_constr.datalen; l++) {
5008 long arr_conv_11 = arg_vals[l];
5009 LDKRouteHint arr_conv_11_conv;
5010 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
5011 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
5012 arg_constr.data[l] = arr_conv_11_conv;
5014 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5015 CVec_RouteHintZ_free(arg_constr);
5018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5019 LDKCVec_RouteHopZ arg_constr;
5020 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5021 if (arg_constr.datalen > 0)
5022 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
5024 arg_constr.data = NULL;
5025 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5026 for (size_t k = 0; k < arg_constr.datalen; k++) {
5027 long arr_conv_10 = arg_vals[k];
5028 LDKRouteHop arr_conv_10_conv;
5029 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
5030 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
5031 arg_constr.data[k] = arr_conv_10_conv;
5033 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5034 CVec_RouteHopZ_free(arg_constr);
5037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5038 LDKCVec_SignatureZ arg_constr;
5039 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5040 if (arg_constr.datalen > 0)
5041 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5043 arg_constr.data = NULL;
5044 for (size_t i = 0; i < arg_constr.datalen; i++) {
5045 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5046 LDKSignature arr_conv_8_ref;
5047 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5048 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5049 arg_constr.data[i] = arr_conv_8_ref;
5051 CVec_SignatureZ_free(arg_constr);
5054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5055 LDKCVec_SpendableOutputDescriptorZ arg_constr;
5056 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5057 if (arg_constr.datalen > 0)
5058 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
5060 arg_constr.data = NULL;
5061 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5062 for (size_t b = 0; b < arg_constr.datalen; b++) {
5063 long arr_conv_27 = arg_vals[b];
5064 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
5065 FREE((void*)arr_conv_27);
5066 arg_constr.data[b] = arr_conv_27_conv;
5068 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5069 CVec_SpendableOutputDescriptorZ_free(arg_constr);
5072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5073 LDKCVec_TransactionZ arg_constr;
5074 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5075 if (arg_constr.datalen > 0)
5076 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5078 arg_constr.data = NULL;
5079 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5080 for (size_t n = 0; n < arg_constr.datalen; n++) {
5081 long arr_conv_13 = arg_vals[n];
5082 LDKTransaction arr_conv_13_conv = *(LDKTransaction*)arr_conv_13;
5083 arg_constr.data[n] = arr_conv_13_conv;
5085 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5086 CVec_TransactionZ_free(arg_constr);
5089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5090 LDKCVec_TxOutZ arg_constr;
5091 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5092 if (arg_constr.datalen > 0)
5093 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5095 arg_constr.data = NULL;
5096 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5097 for (size_t h = 0; h < arg_constr.datalen; h++) {
5098 long arr_conv_7 = arg_vals[h];
5099 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5100 FREE((void*)arr_conv_7);
5101 arg_constr.data[h] = arr_conv_7_conv;
5103 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5104 CVec_TxOutZ_free(arg_constr);
5107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5108 LDKCVec_UpdateAddHTLCZ arg_constr;
5109 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5110 if (arg_constr.datalen > 0)
5111 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
5113 arg_constr.data = NULL;
5114 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5115 for (size_t p = 0; p < arg_constr.datalen; p++) {
5116 long arr_conv_15 = arg_vals[p];
5117 LDKUpdateAddHTLC arr_conv_15_conv;
5118 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
5119 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
5120 arg_constr.data[p] = arr_conv_15_conv;
5122 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5123 CVec_UpdateAddHTLCZ_free(arg_constr);
5126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5127 LDKCVec_UpdateFailHTLCZ arg_constr;
5128 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5129 if (arg_constr.datalen > 0)
5130 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
5132 arg_constr.data = NULL;
5133 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5134 for (size_t q = 0; q < arg_constr.datalen; q++) {
5135 long arr_conv_16 = arg_vals[q];
5136 LDKUpdateFailHTLC arr_conv_16_conv;
5137 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5138 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5139 arg_constr.data[q] = arr_conv_16_conv;
5141 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5142 CVec_UpdateFailHTLCZ_free(arg_constr);
5145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5146 LDKCVec_UpdateFailMalformedHTLCZ arg_constr;
5147 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5148 if (arg_constr.datalen > 0)
5149 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
5151 arg_constr.data = NULL;
5152 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5153 for (size_t z = 0; z < arg_constr.datalen; z++) {
5154 long arr_conv_25 = arg_vals[z];
5155 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
5156 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
5157 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
5158 arg_constr.data[z] = arr_conv_25_conv;
5160 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5161 CVec_UpdateFailMalformedHTLCZ_free(arg_constr);
5164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5165 LDKCVec_UpdateFulfillHTLCZ arg_constr;
5166 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5167 if (arg_constr.datalen > 0)
5168 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
5170 arg_constr.data = NULL;
5171 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5172 for (size_t t = 0; t < arg_constr.datalen; t++) {
5173 long arr_conv_19 = arg_vals[t];
5174 LDKUpdateFulfillHTLC arr_conv_19_conv;
5175 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5176 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5177 arg_constr.data[t] = arr_conv_19_conv;
5179 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5180 CVec_UpdateFulfillHTLCZ_free(arg_constr);
5183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5184 LDKCVec_u64Z arg_constr;
5185 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5186 if (arg_constr.datalen > 0)
5187 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
5189 arg_constr.data = NULL;
5190 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5191 for (size_t g = 0; g < arg_constr.datalen; g++) {
5192 long arr_conv_6 = arg_vals[g];
5193 arg_constr.data[g] = arr_conv_6;
5195 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5196 CVec_u64Z_free(arg_constr);
5199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
5200 LDKCVec_u8Z arg_ref;
5201 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
5202 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
5203 CVec_u8Z_free(arg_ref);
5204 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
5207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
5208 LDKTransaction _res_conv = *(LDKTransaction*)_res;
5209 Transaction_free(_res_conv);
5212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5213 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5215 TxOut_free(_res_conv);
5218 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5219 LDKTransaction b_conv = *(LDKTransaction*)b;
5220 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5221 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_conv);
5222 return (long)ret_ref;
5225 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5226 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5227 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
5228 return (long)ret_conv;
5231 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5232 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5233 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
5234 return (long)ret_conv;
5237 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5239 a_conv.inner = (void*)(a & (~1));
5240 a_conv.is_owned = (a & 1) || (a == 0);
5241 if (a_conv.inner != NULL)
5242 a_conv = OutPoint_clone(&a_conv);
5244 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
5245 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5246 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5247 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5248 (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0);
5249 return (long)ret_ref;
5252 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5253 LDKThirtyTwoBytes a_ref;
5254 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5255 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5256 LDKCVec_TxOutZ b_constr;
5257 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5258 if (b_constr.datalen > 0)
5259 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5261 b_constr.data = NULL;
5262 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5263 for (size_t h = 0; h < b_constr.datalen; h++) {
5264 long arr_conv_7 = b_vals[h];
5265 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5266 FREE((void*)arr_conv_7);
5267 b_constr.data[h] = arr_conv_7_conv;
5269 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5270 LDKC2Tuple_TxidCVec_TxOutZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
5271 *ret_ref = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_constr);
5272 return (long)ret_ref;
5275 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5276 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5277 *ret_ref = C2Tuple_u64u64Z_new(a, b);
5278 return (long)ret_ref;
5281 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5283 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5284 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5285 LDKCVec_SignatureZ b_constr;
5286 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5287 if (b_constr.datalen > 0)
5288 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5290 b_constr.data = NULL;
5291 for (size_t i = 0; i < b_constr.datalen; i++) {
5292 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5293 LDKSignature arr_conv_8_ref;
5294 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5295 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5296 b_constr.data[i] = arr_conv_8_ref;
5298 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5299 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5300 return (long)ret_ref;
5303 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
5304 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5305 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5306 return (long)ret_conv;
5309 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
5310 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5311 *ret_conv = CResult_SignatureNoneZ_err();
5312 return (long)ret_conv;
5315 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
5316 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5317 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5318 return (long)ret_conv;
5321 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
5322 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5323 *ret_conv = CResult_NoneAPIErrorZ_ok();
5324 return (long)ret_conv;
5327 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
5328 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5329 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
5330 return (long)ret_conv;
5333 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
5334 LDKChannelAnnouncement a_conv;
5335 a_conv.inner = (void*)(a & (~1));
5336 a_conv.is_owned = (a & 1) || (a == 0);
5337 if (a_conv.inner != NULL)
5338 a_conv = ChannelAnnouncement_clone(&a_conv);
5339 LDKChannelUpdate b_conv;
5340 b_conv.inner = (void*)(b & (~1));
5341 b_conv.is_owned = (b & 1) || (b == 0);
5342 if (b_conv.inner != NULL)
5343 b_conv = ChannelUpdate_clone(&b_conv);
5344 LDKChannelUpdate c_conv;
5345 c_conv.inner = (void*)(c & (~1));
5346 c_conv.is_owned = (c & 1) || (c == 0);
5347 if (c_conv.inner != NULL)
5348 c_conv = ChannelUpdate_clone(&c_conv);
5349 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5350 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5351 return (long)ret_ref;
5354 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
5355 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5356 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5357 return (long)ret_conv;
5360 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5361 LDKHTLCOutputInCommitment a_conv;
5362 a_conv.inner = (void*)(a & (~1));
5363 a_conv.is_owned = (a & 1) || (a == 0);
5364 if (a_conv.inner != NULL)
5365 a_conv = HTLCOutputInCommitment_clone(&a_conv);
5367 CHECK((*_env)->GetArrayLength (_env, b) == 64);
5368 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
5369 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
5370 *ret_ref = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
5371 return (long)ret_ref;
5374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5375 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
5376 FREE((void*)this_ptr);
5377 Event_free(this_ptr_conv);
5380 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5381 LDKEvent* orig_conv = (LDKEvent*)orig;
5382 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
5383 *ret_copy = Event_clone(orig_conv);
5384 long ret_ref = (long)ret_copy;
5388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5389 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
5390 FREE((void*)this_ptr);
5391 MessageSendEvent_free(this_ptr_conv);
5394 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5395 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
5396 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5397 *ret_copy = MessageSendEvent_clone(orig_conv);
5398 long ret_ref = (long)ret_copy;
5402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5403 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
5404 FREE((void*)this_ptr);
5405 MessageSendEventsProvider_free(this_ptr_conv);
5408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5409 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
5410 FREE((void*)this_ptr);
5411 EventsProvider_free(this_ptr_conv);
5414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5415 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
5416 FREE((void*)this_ptr);
5417 APIError_free(this_ptr_conv);
5420 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5421 LDKAPIError* orig_conv = (LDKAPIError*)orig;
5422 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5423 *ret_copy = APIError_clone(orig_conv);
5424 long ret_ref = (long)ret_copy;
5428 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5429 LDKLevel* orig_conv = (LDKLevel*)orig;
5430 jclass ret_conv = LDKLevel_to_java(_env, Level_clone(orig_conv));
5434 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
5435 jclass ret_conv = LDKLevel_to_java(_env, Level_max());
5439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5440 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
5441 FREE((void*)this_ptr);
5442 Logger_free(this_ptr_conv);
5445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5446 LDKChannelHandshakeConfig this_ptr_conv;
5447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5448 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5449 ChannelHandshakeConfig_free(this_ptr_conv);
5452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5453 LDKChannelHandshakeConfig orig_conv;
5454 orig_conv.inner = (void*)(orig & (~1));
5455 orig_conv.is_owned = (orig & 1) || (orig == 0);
5456 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
5457 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5458 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5459 long ret_ref = (long)ret_var.inner;
5460 if (ret_var.is_owned) {
5466 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5467 LDKChannelHandshakeConfig this_ptr_conv;
5468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5469 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5470 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
5474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5475 LDKChannelHandshakeConfig this_ptr_conv;
5476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5477 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5478 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
5481 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
5489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5490 LDKChannelHandshakeConfig this_ptr_conv;
5491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5492 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5493 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
5496 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
5504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5505 LDKChannelHandshakeConfig this_ptr_conv;
5506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5507 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5508 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
5511 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) {
5512 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
5513 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5514 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5515 long ret_ref = (long)ret_var.inner;
5516 if (ret_var.is_owned) {
5522 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
5523 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
5524 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5525 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5526 long ret_ref = (long)ret_var.inner;
5527 if (ret_var.is_owned) {
5533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5534 LDKChannelHandshakeLimits this_ptr_conv;
5535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5536 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5537 ChannelHandshakeLimits_free(this_ptr_conv);
5540 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5541 LDKChannelHandshakeLimits orig_conv;
5542 orig_conv.inner = (void*)(orig & (~1));
5543 orig_conv.is_owned = (orig & 1) || (orig == 0);
5544 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
5545 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5546 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5547 long ret_ref = (long)ret_var.inner;
5548 if (ret_var.is_owned) {
5554 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5555 LDKChannelHandshakeLimits this_ptr_conv;
5556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5557 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5558 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
5562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5563 LDKChannelHandshakeLimits this_ptr_conv;
5564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5565 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5566 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
5569 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
5577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5578 LDKChannelHandshakeLimits this_ptr_conv;
5579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5580 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5581 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
5584 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
5592 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) {
5593 LDKChannelHandshakeLimits this_ptr_conv;
5594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5595 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5596 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
5599 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
5607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5608 LDKChannelHandshakeLimits this_ptr_conv;
5609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5610 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5611 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
5614 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
5622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5623 LDKChannelHandshakeLimits this_ptr_conv;
5624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5625 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5626 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
5629 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
5637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5638 LDKChannelHandshakeLimits this_ptr_conv;
5639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5640 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5641 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
5644 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
5652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5653 LDKChannelHandshakeLimits this_ptr_conv;
5654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5655 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5656 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
5659 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
5667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5668 LDKChannelHandshakeLimits this_ptr_conv;
5669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5670 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5671 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5674 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5683 LDKChannelHandshakeLimits this_ptr_conv;
5684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5685 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5686 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5689 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5698 LDKChannelHandshakeLimits this_ptr_conv;
5699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5700 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5701 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5704 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) {
5705 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);
5706 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5707 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5708 long ret_ref = (long)ret_var.inner;
5709 if (ret_var.is_owned) {
5715 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5716 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
5717 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5718 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5719 long ret_ref = (long)ret_var.inner;
5720 if (ret_var.is_owned) {
5726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5727 LDKChannelConfig this_ptr_conv;
5728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5729 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5730 ChannelConfig_free(this_ptr_conv);
5733 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5734 LDKChannelConfig orig_conv;
5735 orig_conv.inner = (void*)(orig & (~1));
5736 orig_conv.is_owned = (orig & 1) || (orig == 0);
5737 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
5738 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5739 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5740 long ret_ref = (long)ret_var.inner;
5741 if (ret_var.is_owned) {
5747 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
5748 LDKChannelConfig this_ptr_conv;
5749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5750 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5751 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
5755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5756 LDKChannelConfig this_ptr_conv;
5757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5758 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5759 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
5762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
5770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5771 LDKChannelConfig this_ptr_conv;
5772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5773 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5774 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5786 LDKChannelConfig this_ptr_conv;
5787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5788 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5789 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5792 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) {
5793 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5794 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5795 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5796 long ret_ref = (long)ret_var.inner;
5797 if (ret_var.is_owned) {
5803 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
5804 LDKChannelConfig ret_var = ChannelConfig_default();
5805 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5806 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5807 long ret_ref = (long)ret_var.inner;
5808 if (ret_var.is_owned) {
5814 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
5815 LDKChannelConfig obj_conv;
5816 obj_conv.inner = (void*)(obj & (~1));
5817 obj_conv.is_owned = (obj & 1) || (obj == 0);
5818 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
5819 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5820 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5821 CVec_u8Z_free(arg_var);
5825 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5827 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5828 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5829 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
5830 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5831 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5832 long ret_ref = (long)ret_var.inner;
5833 if (ret_var.is_owned) {
5836 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5841 LDKUserConfig this_ptr_conv;
5842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5843 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5844 UserConfig_free(this_ptr_conv);
5847 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5848 LDKUserConfig orig_conv;
5849 orig_conv.inner = (void*)(orig & (~1));
5850 orig_conv.is_owned = (orig & 1) || (orig == 0);
5851 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
5852 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5853 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5854 long ret_ref = (long)ret_var.inner;
5855 if (ret_var.is_owned) {
5861 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
5862 LDKUserConfig this_ptr_conv;
5863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5864 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5865 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
5866 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5867 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5868 long ret_ref = (long)ret_var.inner;
5869 if (ret_var.is_owned) {
5875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5876 LDKUserConfig this_ptr_conv;
5877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5879 LDKChannelHandshakeConfig val_conv;
5880 val_conv.inner = (void*)(val & (~1));
5881 val_conv.is_owned = (val & 1) || (val == 0);
5882 if (val_conv.inner != NULL)
5883 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5884 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5887 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
5888 LDKUserConfig this_ptr_conv;
5889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5891 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5892 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5893 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5894 long ret_ref = (long)ret_var.inner;
5895 if (ret_var.is_owned) {
5901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5902 LDKUserConfig this_ptr_conv;
5903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5905 LDKChannelHandshakeLimits val_conv;
5906 val_conv.inner = (void*)(val & (~1));
5907 val_conv.is_owned = (val & 1) || (val == 0);
5908 if (val_conv.inner != NULL)
5909 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5910 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5913 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
5914 LDKUserConfig this_ptr_conv;
5915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5916 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5917 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
5918 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5919 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5920 long ret_ref = (long)ret_var.inner;
5921 if (ret_var.is_owned) {
5927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5928 LDKUserConfig this_ptr_conv;
5929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5930 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5931 LDKChannelConfig val_conv;
5932 val_conv.inner = (void*)(val & (~1));
5933 val_conv.is_owned = (val & 1) || (val == 0);
5934 if (val_conv.inner != NULL)
5935 val_conv = ChannelConfig_clone(&val_conv);
5936 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5939 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) {
5940 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5941 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5942 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5943 if (own_channel_config_arg_conv.inner != NULL)
5944 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5945 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5946 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5947 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5948 if (peer_channel_config_limits_arg_conv.inner != NULL)
5949 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5950 LDKChannelConfig channel_options_arg_conv;
5951 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5952 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5953 if (channel_options_arg_conv.inner != NULL)
5954 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5955 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5956 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5957 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5958 long ret_ref = (long)ret_var.inner;
5959 if (ret_var.is_owned) {
5965 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5966 LDKUserConfig ret_var = UserConfig_default();
5967 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5968 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5969 long ret_ref = (long)ret_var.inner;
5970 if (ret_var.is_owned) {
5976 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5977 LDKAccessError* orig_conv = (LDKAccessError*)orig;
5978 jclass ret_conv = LDKAccessError_to_java(_env, AccessError_clone(orig_conv));
5982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5983 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5984 FREE((void*)this_ptr);
5985 Access_free(this_ptr_conv);
5988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5989 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5990 FREE((void*)this_ptr);
5991 Watch_free(this_ptr_conv);
5994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5995 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5996 FREE((void*)this_ptr);
5997 Filter_free(this_ptr_conv);
6000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6001 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
6002 FREE((void*)this_ptr);
6003 BroadcasterInterface_free(this_ptr_conv);
6006 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6007 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
6008 jclass ret_conv = LDKConfirmationTarget_to_java(_env, ConfirmationTarget_clone(orig_conv));
6012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6013 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
6014 FREE((void*)this_ptr);
6015 FeeEstimator_free(this_ptr_conv);
6018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6019 LDKChainMonitor this_ptr_conv;
6020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6021 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6022 ChainMonitor_free(this_ptr_conv);
6025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
6026 LDKChainMonitor this_arg_conv;
6027 this_arg_conv.inner = (void*)(this_arg & (~1));
6028 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6029 unsigned char header_arr[80];
6030 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6031 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6032 unsigned char (*header_ref)[80] = &header_arr;
6033 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6034 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6035 if (txdata_constr.datalen > 0)
6036 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6038 txdata_constr.data = NULL;
6039 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6040 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6041 long arr_conv_29 = txdata_vals[d];
6042 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6043 FREE((void*)arr_conv_29);
6044 txdata_constr.data[d] = arr_conv_29_conv;
6046 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6047 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
6051 LDKChainMonitor this_arg_conv;
6052 this_arg_conv.inner = (void*)(this_arg & (~1));
6053 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6054 unsigned char header_arr[80];
6055 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6056 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6057 unsigned char (*header_ref)[80] = &header_arr;
6058 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
6061 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
6062 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
6063 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6064 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6065 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6066 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6068 LDKLogger logger_conv = *(LDKLogger*)logger;
6069 if (logger_conv.free == LDKLogger_JCalls_free) {
6070 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6071 LDKLogger_JCalls_clone(logger_conv.this_arg);
6073 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
6074 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
6075 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6076 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
6078 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
6079 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6080 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6081 long ret_ref = (long)ret_var.inner;
6082 if (ret_var.is_owned) {
6088 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
6089 LDKChainMonitor this_arg_conv;
6090 this_arg_conv.inner = (void*)(this_arg & (~1));
6091 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6092 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
6093 *ret = ChainMonitor_as_Watch(&this_arg_conv);
6097 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6098 LDKChainMonitor this_arg_conv;
6099 this_arg_conv.inner = (void*)(this_arg & (~1));
6100 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6101 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6102 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
6106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6107 LDKChannelMonitorUpdate this_ptr_conv;
6108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6109 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6110 ChannelMonitorUpdate_free(this_ptr_conv);
6113 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6114 LDKChannelMonitorUpdate orig_conv;
6115 orig_conv.inner = (void*)(orig & (~1));
6116 orig_conv.is_owned = (orig & 1) || (orig == 0);
6117 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
6118 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6119 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6120 long ret_ref = (long)ret_var.inner;
6121 if (ret_var.is_owned) {
6127 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6128 LDKChannelMonitorUpdate this_ptr_conv;
6129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6130 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6131 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
6135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6136 LDKChannelMonitorUpdate this_ptr_conv;
6137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6138 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6139 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
6142 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6143 LDKChannelMonitorUpdate obj_conv;
6144 obj_conv.inner = (void*)(obj & (~1));
6145 obj_conv.is_owned = (obj & 1) || (obj == 0);
6146 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
6147 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6148 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6149 CVec_u8Z_free(arg_var);
6153 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6155 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6156 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6157 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_read(ser_ref);
6158 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6159 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6160 long ret_ref = (long)ret_var.inner;
6161 if (ret_var.is_owned) {
6164 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6168 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6169 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
6170 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(_env, ChannelMonitorUpdateErr_clone(orig_conv));
6174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6175 LDKMonitorUpdateError this_ptr_conv;
6176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6177 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6178 MonitorUpdateError_free(this_ptr_conv);
6181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6182 LDKMonitorEvent 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 MonitorEvent_free(this_ptr_conv);
6188 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6189 LDKMonitorEvent orig_conv;
6190 orig_conv.inner = (void*)(orig & (~1));
6191 orig_conv.is_owned = (orig & 1) || (orig == 0);
6192 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
6193 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6194 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6195 long ret_ref = (long)ret_var.inner;
6196 if (ret_var.is_owned) {
6202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6203 LDKHTLCUpdate this_ptr_conv;
6204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6205 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6206 HTLCUpdate_free(this_ptr_conv);
6209 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6210 LDKHTLCUpdate orig_conv;
6211 orig_conv.inner = (void*)(orig & (~1));
6212 orig_conv.is_owned = (orig & 1) || (orig == 0);
6213 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
6214 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6215 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6216 long ret_ref = (long)ret_var.inner;
6217 if (ret_var.is_owned) {
6223 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6224 LDKHTLCUpdate obj_conv;
6225 obj_conv.inner = (void*)(obj & (~1));
6226 obj_conv.is_owned = (obj & 1) || (obj == 0);
6227 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
6228 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6229 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6230 CVec_u8Z_free(arg_var);
6234 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6236 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6237 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6238 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
6239 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6240 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6241 long ret_ref = (long)ret_var.inner;
6242 if (ret_var.is_owned) {
6245 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6250 LDKChannelMonitor this_ptr_conv;
6251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6252 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6253 ChannelMonitor_free(this_ptr_conv);
6256 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
6257 LDKChannelMonitor this_arg_conv;
6258 this_arg_conv.inner = (void*)(this_arg & (~1));
6259 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6260 LDKChannelMonitorUpdate updates_conv;
6261 updates_conv.inner = (void*)(updates & (~1));
6262 updates_conv.is_owned = (updates & 1) || (updates == 0);
6263 if (updates_conv.inner != NULL)
6264 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
6265 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
6266 LDKLogger* logger_conv = (LDKLogger*)logger;
6267 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6268 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
6269 return (long)ret_conv;
6272 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6273 LDKChannelMonitor this_arg_conv;
6274 this_arg_conv.inner = (void*)(this_arg & (~1));
6275 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6276 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
6280 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
6281 LDKChannelMonitor this_arg_conv;
6282 this_arg_conv.inner = (void*)(this_arg & (~1));
6283 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6284 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6285 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
6286 return (long)ret_ref;
6289 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6290 LDKChannelMonitor this_arg_conv;
6291 this_arg_conv.inner = (void*)(this_arg & (~1));
6292 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6293 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
6294 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6295 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6296 for (size_t o = 0; o < ret_var.datalen; o++) {
6297 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
6298 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6299 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6300 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
6301 if (arr_conv_14_var.is_owned) {
6302 arr_conv_14_ref |= 1;
6304 ret_arr_ptr[o] = arr_conv_14_ref;
6306 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6311 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6312 LDKChannelMonitor this_arg_conv;
6313 this_arg_conv.inner = (void*)(this_arg & (~1));
6314 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6315 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
6316 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6317 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6318 for (size_t h = 0; h < ret_var.datalen; h++) {
6319 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6320 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
6321 long arr_conv_7_ref = (long)arr_conv_7_copy;
6322 ret_arr_ptr[h] = arr_conv_7_ref;
6324 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6325 CVec_EventZ_free(ret_var);
6329 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
6330 LDKChannelMonitor this_arg_conv;
6331 this_arg_conv.inner = (void*)(this_arg & (~1));
6332 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6333 LDKLogger* logger_conv = (LDKLogger*)logger;
6334 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
6335 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6336 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6337 for (size_t n = 0; n < ret_var.datalen; n++) {
6338 LDKTransaction *arr_conv_13_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
6339 *arr_conv_13_copy = ret_var.data[n];
6340 long arr_conv_13_ref = (long)arr_conv_13_copy;
6341 ret_arr_ptr[n] = arr_conv_13_ref;
6343 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6344 CVec_TransactionZ_free(ret_var);
6348 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) {
6349 LDKChannelMonitor this_arg_conv;
6350 this_arg_conv.inner = (void*)(this_arg & (~1));
6351 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6352 unsigned char header_arr[80];
6353 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6354 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6355 unsigned char (*header_ref)[80] = &header_arr;
6356 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6357 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6358 if (txdata_constr.datalen > 0)
6359 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6361 txdata_constr.data = NULL;
6362 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6363 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6364 long arr_conv_29 = txdata_vals[d];
6365 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6366 FREE((void*)arr_conv_29);
6367 txdata_constr.data[d] = arr_conv_29_conv;
6369 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6370 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6371 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6372 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6373 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6375 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6376 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6377 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6378 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6380 LDKLogger logger_conv = *(LDKLogger*)logger;
6381 if (logger_conv.free == LDKLogger_JCalls_free) {
6382 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6383 LDKLogger_JCalls_clone(logger_conv.this_arg);
6385 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6386 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6387 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6388 for (size_t b = 0; b < ret_var.datalen; b++) {
6389 LDKC2Tuple_TxidCVec_TxOutZZ* arr_conv_27_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
6390 *arr_conv_27_ref = ret_var.data[b];
6391 ret_arr_ptr[b] = (long)arr_conv_27_ref;
6393 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6394 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(ret_var);
6398 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) {
6399 LDKChannelMonitor this_arg_conv;
6400 this_arg_conv.inner = (void*)(this_arg & (~1));
6401 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6402 unsigned char header_arr[80];
6403 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6404 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6405 unsigned char (*header_ref)[80] = &header_arr;
6406 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6407 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6408 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6409 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6411 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6412 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6413 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6414 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6416 LDKLogger logger_conv = *(LDKLogger*)logger;
6417 if (logger_conv.free == LDKLogger_JCalls_free) {
6418 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6419 LDKLogger_JCalls_clone(logger_conv.this_arg);
6421 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6425 LDKOutPoint this_ptr_conv;
6426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6427 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6428 OutPoint_free(this_ptr_conv);
6431 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6432 LDKOutPoint orig_conv;
6433 orig_conv.inner = (void*)(orig & (~1));
6434 orig_conv.is_owned = (orig & 1) || (orig == 0);
6435 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
6436 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6437 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6438 long ret_ref = (long)ret_var.inner;
6439 if (ret_var.is_owned) {
6445 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6446 LDKOutPoint this_ptr_conv;
6447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6448 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6449 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6450 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
6454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6455 LDKOutPoint this_ptr_conv;
6456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6457 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6458 LDKThirtyTwoBytes val_ref;
6459 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6460 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6461 OutPoint_set_txid(&this_ptr_conv, val_ref);
6464 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6465 LDKOutPoint this_ptr_conv;
6466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6467 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6468 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
6472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6473 LDKOutPoint this_ptr_conv;
6474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6475 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6476 OutPoint_set_index(&this_ptr_conv, val);
6479 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
6480 LDKThirtyTwoBytes txid_arg_ref;
6481 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
6482 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
6483 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
6484 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6485 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6486 long ret_ref = (long)ret_var.inner;
6487 if (ret_var.is_owned) {
6493 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6494 LDKOutPoint this_arg_conv;
6495 this_arg_conv.inner = (void*)(this_arg & (~1));
6496 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6497 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
6498 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
6502 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
6503 LDKOutPoint obj_conv;
6504 obj_conv.inner = (void*)(obj & (~1));
6505 obj_conv.is_owned = (obj & 1) || (obj == 0);
6506 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
6507 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6508 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6509 CVec_u8Z_free(arg_var);
6513 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6515 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6516 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6517 LDKOutPoint ret_var = OutPoint_read(ser_ref);
6518 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6519 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6520 long ret_ref = (long)ret_var.inner;
6521 if (ret_var.is_owned) {
6524 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6529 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
6530 FREE((void*)this_ptr);
6531 SpendableOutputDescriptor_free(this_ptr_conv);
6534 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6535 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
6536 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
6537 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
6538 long ret_ref = (long)ret_copy;
6542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6543 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
6544 FREE((void*)this_ptr);
6545 ChannelKeys_free(this_ptr_conv);
6548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6549 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
6550 FREE((void*)this_ptr);
6551 KeysInterface_free(this_ptr_conv);
6554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6555 LDKInMemoryChannelKeys this_ptr_conv;
6556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6557 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6558 InMemoryChannelKeys_free(this_ptr_conv);
6561 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6562 LDKInMemoryChannelKeys orig_conv;
6563 orig_conv.inner = (void*)(orig & (~1));
6564 orig_conv.is_owned = (orig & 1) || (orig == 0);
6565 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
6566 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6567 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6568 long ret_ref = (long)ret_var.inner;
6569 if (ret_var.is_owned) {
6575 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6576 LDKInMemoryChannelKeys this_ptr_conv;
6577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6579 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6580 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
6584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6585 LDKInMemoryChannelKeys this_ptr_conv;
6586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6587 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6588 LDKSecretKey val_ref;
6589 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6590 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6591 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
6594 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6595 LDKInMemoryChannelKeys this_ptr_conv;
6596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6597 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6598 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6599 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
6603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6604 LDKInMemoryChannelKeys this_ptr_conv;
6605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6606 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6607 LDKSecretKey val_ref;
6608 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6609 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6610 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
6613 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6614 LDKInMemoryChannelKeys this_ptr_conv;
6615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6616 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6617 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6618 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
6622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6623 LDKInMemoryChannelKeys this_ptr_conv;
6624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6625 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6626 LDKSecretKey val_ref;
6627 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6628 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6629 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
6632 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6633 LDKInMemoryChannelKeys this_ptr_conv;
6634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6635 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6636 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6637 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
6641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6642 LDKInMemoryChannelKeys this_ptr_conv;
6643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6644 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6645 LDKSecretKey val_ref;
6646 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6647 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6648 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
6651 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6652 LDKInMemoryChannelKeys this_ptr_conv;
6653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6654 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6655 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6656 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
6660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6661 LDKInMemoryChannelKeys this_ptr_conv;
6662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6663 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6664 LDKSecretKey val_ref;
6665 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6666 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6667 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6670 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
6671 LDKInMemoryChannelKeys this_ptr_conv;
6672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6673 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6674 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6675 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
6679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6680 LDKInMemoryChannelKeys this_ptr_conv;
6681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6682 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6683 LDKThirtyTwoBytes val_ref;
6684 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6685 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6686 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6689 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) {
6690 LDKSecretKey funding_key_ref;
6691 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
6692 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
6693 LDKSecretKey revocation_base_key_ref;
6694 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
6695 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
6696 LDKSecretKey payment_key_ref;
6697 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
6698 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
6699 LDKSecretKey delayed_payment_base_key_ref;
6700 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
6701 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
6702 LDKSecretKey htlc_base_key_ref;
6703 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
6704 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
6705 LDKThirtyTwoBytes commitment_seed_ref;
6706 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
6707 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
6708 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
6709 FREE((void*)key_derivation_params);
6710 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);
6711 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6712 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6713 long ret_ref = (long)ret_var.inner;
6714 if (ret_var.is_owned) {
6720 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6721 LDKInMemoryChannelKeys this_arg_conv;
6722 this_arg_conv.inner = (void*)(this_arg & (~1));
6723 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6724 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
6725 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6726 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6727 long ret_ref = (long)ret_var.inner;
6728 if (ret_var.is_owned) {
6734 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6735 LDKInMemoryChannelKeys this_arg_conv;
6736 this_arg_conv.inner = (void*)(this_arg & (~1));
6737 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6738 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
6742 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6743 LDKInMemoryChannelKeys this_arg_conv;
6744 this_arg_conv.inner = (void*)(this_arg & (~1));
6745 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6746 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
6750 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6751 LDKInMemoryChannelKeys this_arg_conv;
6752 this_arg_conv.inner = (void*)(this_arg & (~1));
6753 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6754 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6755 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
6759 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
6760 LDKInMemoryChannelKeys obj_conv;
6761 obj_conv.inner = (void*)(obj & (~1));
6762 obj_conv.is_owned = (obj & 1) || (obj == 0);
6763 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
6764 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6765 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6766 CVec_u8Z_free(arg_var);
6770 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6772 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6773 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6774 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_read(ser_ref);
6775 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6776 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6777 long ret_ref = (long)ret_var.inner;
6778 if (ret_var.is_owned) {
6781 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6786 LDKKeysManager this_ptr_conv;
6787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6788 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6789 KeysManager_free(this_ptr_conv);
6792 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) {
6793 unsigned char seed_arr[32];
6794 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
6795 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
6796 unsigned char (*seed_ref)[32] = &seed_arr;
6797 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6798 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
6799 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6800 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6801 long ret_ref = (long)ret_var.inner;
6802 if (ret_var.is_owned) {
6808 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) {
6809 LDKKeysManager this_arg_conv;
6810 this_arg_conv.inner = (void*)(this_arg & (~1));
6811 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6812 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
6813 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6814 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6815 long ret_ref = (long)ret_var.inner;
6816 if (ret_var.is_owned) {
6822 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
6823 LDKKeysManager this_arg_conv;
6824 this_arg_conv.inner = (void*)(this_arg & (~1));
6825 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6826 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6827 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
6831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6832 LDKChannelManager this_ptr_conv;
6833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6834 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6835 ChannelManager_free(this_ptr_conv);
6838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6839 LDKChannelDetails 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 ChannelDetails_free(this_ptr_conv);
6845 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6846 LDKChannelDetails orig_conv;
6847 orig_conv.inner = (void*)(orig & (~1));
6848 orig_conv.is_owned = (orig & 1) || (orig == 0);
6849 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
6850 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6851 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6852 long ret_ref = (long)ret_var.inner;
6853 if (ret_var.is_owned) {
6859 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6860 LDKChannelDetails this_ptr_conv;
6861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6863 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6864 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
6868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6869 LDKChannelDetails this_ptr_conv;
6870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6871 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6872 LDKThirtyTwoBytes val_ref;
6873 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6874 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6875 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
6878 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6879 LDKChannelDetails this_ptr_conv;
6880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6881 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6882 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6883 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
6887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6888 LDKChannelDetails this_ptr_conv;
6889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6891 LDKPublicKey val_ref;
6892 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6893 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6894 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
6897 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
6898 LDKChannelDetails this_ptr_conv;
6899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6900 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6901 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
6902 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6903 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6904 long ret_ref = (long)ret_var.inner;
6905 if (ret_var.is_owned) {
6911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6912 LDKChannelDetails this_ptr_conv;
6913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6914 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6915 LDKInitFeatures val_conv;
6916 val_conv.inner = (void*)(val & (~1));
6917 val_conv.is_owned = (val & 1) || (val == 0);
6918 // Warning: we may need a move here but can't clone!
6919 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
6922 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6923 LDKChannelDetails this_ptr_conv;
6924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6925 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6926 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
6930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6931 LDKChannelDetails this_ptr_conv;
6932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6933 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6934 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
6937 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
6945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6946 LDKChannelDetails this_ptr_conv;
6947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6948 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6949 ChannelDetails_set_user_id(&this_ptr_conv, val);
6952 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
6960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6961 LDKChannelDetails this_ptr_conv;
6962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6963 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6964 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
6967 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
6975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6976 LDKChannelDetails this_ptr_conv;
6977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6978 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6979 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
6982 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
6990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6991 LDKChannelDetails this_ptr_conv;
6992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6993 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6994 ChannelDetails_set_is_live(&this_ptr_conv, val);
6997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6998 LDKPaymentSendFailure 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 PaymentSendFailure_free(this_ptr_conv);
7004 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) {
7005 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
7006 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
7007 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
7008 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7009 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
7011 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7012 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7013 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7014 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7016 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7017 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7018 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7019 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7021 LDKLogger logger_conv = *(LDKLogger*)logger;
7022 if (logger_conv.free == LDKLogger_JCalls_free) {
7023 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7024 LDKLogger_JCalls_clone(logger_conv.this_arg);
7026 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7027 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7028 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7029 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7031 LDKUserConfig config_conv;
7032 config_conv.inner = (void*)(config & (~1));
7033 config_conv.is_owned = (config & 1) || (config == 0);
7034 if (config_conv.inner != NULL)
7035 config_conv = UserConfig_clone(&config_conv);
7036 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);
7037 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7038 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7039 long ret_ref = (long)ret_var.inner;
7040 if (ret_var.is_owned) {
7046 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) {
7047 LDKChannelManager this_arg_conv;
7048 this_arg_conv.inner = (void*)(this_arg & (~1));
7049 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7050 LDKPublicKey their_network_key_ref;
7051 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
7052 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
7053 LDKUserConfig override_config_conv;
7054 override_config_conv.inner = (void*)(override_config & (~1));
7055 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
7056 if (override_config_conv.inner != NULL)
7057 override_config_conv = UserConfig_clone(&override_config_conv);
7058 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7059 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
7060 return (long)ret_conv;
7063 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7064 LDKChannelManager this_arg_conv;
7065 this_arg_conv.inner = (void*)(this_arg & (~1));
7066 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7067 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
7068 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7069 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7070 for (size_t q = 0; q < ret_var.datalen; q++) {
7071 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7072 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7073 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7074 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7075 if (arr_conv_16_var.is_owned) {
7076 arr_conv_16_ref |= 1;
7078 ret_arr_ptr[q] = arr_conv_16_ref;
7080 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7085 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7086 LDKChannelManager this_arg_conv;
7087 this_arg_conv.inner = (void*)(this_arg & (~1));
7088 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7089 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
7090 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7091 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7092 for (size_t q = 0; q < ret_var.datalen; q++) {
7093 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7094 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7095 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7096 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7097 if (arr_conv_16_var.is_owned) {
7098 arr_conv_16_ref |= 1;
7100 ret_arr_ptr[q] = arr_conv_16_ref;
7102 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7107 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7108 LDKChannelManager this_arg_conv;
7109 this_arg_conv.inner = (void*)(this_arg & (~1));
7110 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7111 unsigned char channel_id_arr[32];
7112 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7113 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7114 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7115 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7116 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
7117 return (long)ret_conv;
7120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7121 LDKChannelManager this_arg_conv;
7122 this_arg_conv.inner = (void*)(this_arg & (~1));
7123 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7124 unsigned char channel_id_arr[32];
7125 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7126 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7127 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7128 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
7131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7132 LDKChannelManager this_arg_conv;
7133 this_arg_conv.inner = (void*)(this_arg & (~1));
7134 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7135 ChannelManager_force_close_all_channels(&this_arg_conv);
7138 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) {
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 LDKRoute route_conv;
7143 route_conv.inner = (void*)(route & (~1));
7144 route_conv.is_owned = (route & 1) || (route == 0);
7145 LDKThirtyTwoBytes payment_hash_ref;
7146 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7147 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
7148 LDKThirtyTwoBytes payment_secret_ref;
7149 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7150 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7151 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7152 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
7153 return (long)ret_conv;
7156 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) {
7157 LDKChannelManager this_arg_conv;
7158 this_arg_conv.inner = (void*)(this_arg & (~1));
7159 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7160 unsigned char temporary_channel_id_arr[32];
7161 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
7162 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
7163 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
7164 LDKOutPoint funding_txo_conv;
7165 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7166 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
7167 if (funding_txo_conv.inner != NULL)
7168 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7169 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
7172 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) {
7173 LDKChannelManager this_arg_conv;
7174 this_arg_conv.inner = (void*)(this_arg & (~1));
7175 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7176 LDKThreeBytes rgb_ref;
7177 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
7178 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
7179 LDKThirtyTwoBytes alias_ref;
7180 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
7181 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
7182 LDKCVec_NetAddressZ addresses_constr;
7183 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
7184 if (addresses_constr.datalen > 0)
7185 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7187 addresses_constr.data = NULL;
7188 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
7189 for (size_t m = 0; m < addresses_constr.datalen; m++) {
7190 long arr_conv_12 = addresses_vals[m];
7191 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
7192 FREE((void*)arr_conv_12);
7193 addresses_constr.data[m] = arr_conv_12_conv;
7195 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
7196 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
7199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
7200 LDKChannelManager this_arg_conv;
7201 this_arg_conv.inner = (void*)(this_arg & (~1));
7202 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7203 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
7206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(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_timer_chan_freshness_every_min(&this_arg_conv);
7213 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) {
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 unsigned char payment_hash_arr[32];
7218 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7219 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
7220 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
7221 LDKThirtyTwoBytes payment_secret_ref;
7222 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7223 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7224 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
7228 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) {
7229 LDKChannelManager this_arg_conv;
7230 this_arg_conv.inner = (void*)(this_arg & (~1));
7231 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7232 LDKThirtyTwoBytes payment_preimage_ref;
7233 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
7234 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
7235 LDKThirtyTwoBytes payment_secret_ref;
7236 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7237 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7238 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
7242 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
7243 LDKChannelManager this_arg_conv;
7244 this_arg_conv.inner = (void*)(this_arg & (~1));
7245 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7246 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7247 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
7251 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) {
7252 LDKChannelManager this_arg_conv;
7253 this_arg_conv.inner = (void*)(this_arg & (~1));
7254 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7255 LDKOutPoint funding_txo_conv;
7256 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7257 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
7258 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
7261 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7262 LDKChannelManager this_arg_conv;
7263 this_arg_conv.inner = (void*)(this_arg & (~1));
7264 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7265 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7266 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
7270 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7271 LDKChannelManager this_arg_conv;
7272 this_arg_conv.inner = (void*)(this_arg & (~1));
7273 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7274 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7275 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
7279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
7280 LDKChannelManager this_arg_conv;
7281 this_arg_conv.inner = (void*)(this_arg & (~1));
7282 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7283 unsigned char header_arr[80];
7284 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7285 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7286 unsigned char (*header_ref)[80] = &header_arr;
7287 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7288 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
7289 if (txdata_constr.datalen > 0)
7290 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7292 txdata_constr.data = NULL;
7293 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
7294 for (size_t d = 0; d < txdata_constr.datalen; d++) {
7295 long arr_conv_29 = txdata_vals[d];
7296 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
7297 FREE((void*)arr_conv_29);
7298 txdata_constr.data[d] = arr_conv_29_conv;
7300 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
7301 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
7304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
7305 LDKChannelManager this_arg_conv;
7306 this_arg_conv.inner = (void*)(this_arg & (~1));
7307 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7308 unsigned char header_arr[80];
7309 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7310 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7311 unsigned char (*header_ref)[80] = &header_arr;
7312 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
7315 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
7316 LDKChannelManager this_arg_conv;
7317 this_arg_conv.inner = (void*)(this_arg & (~1));
7318 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7319 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7320 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
7324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7325 LDKChannelManagerReadArgs this_ptr_conv;
7326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7327 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7328 ChannelManagerReadArgs_free(this_ptr_conv);
7331 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(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 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
7339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7340 LDKChannelManagerReadArgs this_ptr_conv;
7341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7342 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7343 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
7344 if (val_conv.free == LDKKeysInterface_JCalls_free) {
7345 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7346 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
7348 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
7351 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
7352 LDKChannelManagerReadArgs this_ptr_conv;
7353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7354 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7355 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
7359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7360 LDKChannelManagerReadArgs this_ptr_conv;
7361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7362 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7363 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
7364 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
7365 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7366 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
7368 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
7371 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
7372 LDKChannelManagerReadArgs this_ptr_conv;
7373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7374 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7375 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
7379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7380 LDKChannelManagerReadArgs this_ptr_conv;
7381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7382 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7383 LDKWatch val_conv = *(LDKWatch*)val;
7384 if (val_conv.free == LDKWatch_JCalls_free) {
7385 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7386 LDKWatch_JCalls_clone(val_conv.this_arg);
7388 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
7391 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
7392 LDKChannelManagerReadArgs this_ptr_conv;
7393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7394 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7395 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
7399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7400 LDKChannelManagerReadArgs this_ptr_conv;
7401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7402 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7403 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
7404 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
7405 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7406 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
7408 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
7411 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
7412 LDKChannelManagerReadArgs this_ptr_conv;
7413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7414 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7415 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
7419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7420 LDKChannelManagerReadArgs this_ptr_conv;
7421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7422 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7423 LDKLogger val_conv = *(LDKLogger*)val;
7424 if (val_conv.free == LDKLogger_JCalls_free) {
7425 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7426 LDKLogger_JCalls_clone(val_conv.this_arg);
7428 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
7431 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
7432 LDKChannelManagerReadArgs this_ptr_conv;
7433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7434 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7435 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
7436 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7437 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7438 long ret_ref = (long)ret_var.inner;
7439 if (ret_var.is_owned) {
7445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7446 LDKChannelManagerReadArgs this_ptr_conv;
7447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7448 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7449 LDKUserConfig val_conv;
7450 val_conv.inner = (void*)(val & (~1));
7451 val_conv.is_owned = (val & 1) || (val == 0);
7452 if (val_conv.inner != NULL)
7453 val_conv = UserConfig_clone(&val_conv);
7454 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
7457 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) {
7458 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7459 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7460 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7461 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7463 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7464 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
7465 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7466 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
7468 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7469 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7470 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7471 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7473 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7474 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7475 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7476 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7478 LDKLogger logger_conv = *(LDKLogger*)logger;
7479 if (logger_conv.free == LDKLogger_JCalls_free) {
7480 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7481 LDKLogger_JCalls_clone(logger_conv.this_arg);
7483 LDKUserConfig default_config_conv;
7484 default_config_conv.inner = (void*)(default_config & (~1));
7485 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
7486 if (default_config_conv.inner != NULL)
7487 default_config_conv = UserConfig_clone(&default_config_conv);
7488 LDKCVec_ChannelMonitorZ channel_monitors_constr;
7489 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
7490 if (channel_monitors_constr.datalen > 0)
7491 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7493 channel_monitors_constr.data = NULL;
7494 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
7495 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
7496 long arr_conv_16 = channel_monitors_vals[q];
7497 LDKChannelMonitor arr_conv_16_conv;
7498 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7499 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7500 channel_monitors_constr.data[q] = arr_conv_16_conv;
7502 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
7503 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);
7504 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7505 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7506 long ret_ref = (long)ret_var.inner;
7507 if (ret_var.is_owned) {
7513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7514 LDKDecodeError this_ptr_conv;
7515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7516 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7517 DecodeError_free(this_ptr_conv);
7520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7521 LDKInit 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 Init_free(this_ptr_conv);
7527 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7529 orig_conv.inner = (void*)(orig & (~1));
7530 orig_conv.is_owned = (orig & 1) || (orig == 0);
7531 LDKInit ret_var = Init_clone(&orig_conv);
7532 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7533 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7534 long ret_ref = (long)ret_var.inner;
7535 if (ret_var.is_owned) {
7541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7542 LDKErrorMessage this_ptr_conv;
7543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7545 ErrorMessage_free(this_ptr_conv);
7548 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7549 LDKErrorMessage orig_conv;
7550 orig_conv.inner = (void*)(orig & (~1));
7551 orig_conv.is_owned = (orig & 1) || (orig == 0);
7552 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
7553 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7554 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7555 long ret_ref = (long)ret_var.inner;
7556 if (ret_var.is_owned) {
7562 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7563 LDKErrorMessage this_ptr_conv;
7564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7565 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7566 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7567 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
7571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7572 LDKErrorMessage this_ptr_conv;
7573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7574 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7575 LDKThirtyTwoBytes val_ref;
7576 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7577 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7578 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
7581 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
7582 LDKErrorMessage this_ptr_conv;
7583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7585 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
7586 char* _buf = MALLOC(_str.len + 1, "str conv buf");
7587 memcpy(_buf, _str.chars, _str.len);
7589 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
7594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7595 LDKErrorMessage this_ptr_conv;
7596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7597 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7598 LDKCVec_u8Z val_ref;
7599 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
7600 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7601 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7602 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
7605 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
7606 LDKThirtyTwoBytes channel_id_arg_ref;
7607 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7608 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7609 LDKCVec_u8Z data_arg_ref;
7610 data_arg_ref.data = (*_env)->GetByteArrayElements (_env, data_arg, NULL);
7611 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
7612 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7613 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7614 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7615 long ret_ref = (long)ret_var.inner;
7616 if (ret_var.is_owned) {
7619 (*_env)->ReleaseByteArrayElements(_env, data_arg, (int8_t*)data_arg_ref.data, 0);
7623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7624 LDKPing this_ptr_conv;
7625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7626 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7627 Ping_free(this_ptr_conv);
7630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7632 orig_conv.inner = (void*)(orig & (~1));
7633 orig_conv.is_owned = (orig & 1) || (orig == 0);
7634 LDKPing ret_var = Ping_clone(&orig_conv);
7635 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7636 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7637 long ret_ref = (long)ret_var.inner;
7638 if (ret_var.is_owned) {
7644 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7645 LDKPing this_ptr_conv;
7646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7647 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7648 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7653 LDKPing this_ptr_conv;
7654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7655 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7656 Ping_set_ponglen(&this_ptr_conv, val);
7659 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7668 LDKPing this_ptr_conv;
7669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7670 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7671 Ping_set_byteslen(&this_ptr_conv, val);
7674 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
7675 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
7676 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7677 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7678 long ret_ref = (long)ret_var.inner;
7679 if (ret_var.is_owned) {
7685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7686 LDKPong this_ptr_conv;
7687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7688 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7689 Pong_free(this_ptr_conv);
7692 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7694 orig_conv.inner = (void*)(orig & (~1));
7695 orig_conv.is_owned = (orig & 1) || (orig == 0);
7696 LDKPong ret_var = Pong_clone(&orig_conv);
7697 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7698 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7699 long ret_ref = (long)ret_var.inner;
7700 if (ret_var.is_owned) {
7706 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7707 LDKPong this_ptr_conv;
7708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7710 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
7714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7715 LDKPong this_ptr_conv;
7716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7717 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7718 Pong_set_byteslen(&this_ptr_conv, val);
7721 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
7722 LDKPong ret_var = Pong_new(byteslen_arg);
7723 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7724 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7725 long ret_ref = (long)ret_var.inner;
7726 if (ret_var.is_owned) {
7732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7733 LDKOpenChannel this_ptr_conv;
7734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7735 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7736 OpenChannel_free(this_ptr_conv);
7739 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7740 LDKOpenChannel orig_conv;
7741 orig_conv.inner = (void*)(orig & (~1));
7742 orig_conv.is_owned = (orig & 1) || (orig == 0);
7743 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
7744 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7745 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7746 long ret_ref = (long)ret_var.inner;
7747 if (ret_var.is_owned) {
7753 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7754 LDKOpenChannel this_ptr_conv;
7755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7756 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7757 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7758 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
7762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7763 LDKOpenChannel this_ptr_conv;
7764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7765 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7766 LDKThirtyTwoBytes val_ref;
7767 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7768 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7769 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
7772 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7773 LDKOpenChannel this_ptr_conv;
7774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7776 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7777 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
7781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7782 LDKOpenChannel this_ptr_conv;
7783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7784 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7785 LDKThirtyTwoBytes val_ref;
7786 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7787 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7788 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7792 LDKOpenChannel this_ptr_conv;
7793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7794 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7795 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
7799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7800 LDKOpenChannel this_ptr_conv;
7801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7802 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7803 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
7806 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
7814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7815 LDKOpenChannel this_ptr_conv;
7816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7817 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7818 OpenChannel_set_push_msat(&this_ptr_conv, val);
7821 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
7829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7830 LDKOpenChannel this_ptr_conv;
7831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7832 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7833 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7844 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) {
7845 LDKOpenChannel this_ptr_conv;
7846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7847 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7848 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7851 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7860 LDKOpenChannel this_ptr_conv;
7861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7863 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7866 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
7874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7875 LDKOpenChannel this_ptr_conv;
7876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7877 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7878 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7881 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
7889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7890 LDKOpenChannel this_ptr_conv;
7891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7892 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7893 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
7896 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
7904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7905 LDKOpenChannel this_ptr_conv;
7906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7907 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7908 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
7911 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
7919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7920 LDKOpenChannel this_ptr_conv;
7921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7922 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7923 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7926 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7931 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7936 LDKOpenChannel this_ptr_conv;
7937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7938 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7939 LDKPublicKey val_ref;
7940 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7941 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7942 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7945 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7946 LDKOpenChannel this_ptr_conv;
7947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7948 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7949 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7950 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7955 LDKOpenChannel this_ptr_conv;
7956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7957 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7958 LDKPublicKey val_ref;
7959 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7960 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7961 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7964 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7965 LDKOpenChannel this_ptr_conv;
7966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7967 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7968 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7969 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
7973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7974 LDKOpenChannel this_ptr_conv;
7975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7976 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7977 LDKPublicKey val_ref;
7978 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7979 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7980 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
7983 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7984 LDKOpenChannel this_ptr_conv;
7985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7986 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7987 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7988 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7993 LDKOpenChannel this_ptr_conv;
7994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7995 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7996 LDKPublicKey val_ref;
7997 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7998 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7999 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8002 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8003 LDKOpenChannel this_ptr_conv;
8004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8005 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8006 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8007 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8012 LDKOpenChannel this_ptr_conv;
8013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8014 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8015 LDKPublicKey val_ref;
8016 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8017 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8018 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8021 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8022 LDKOpenChannel this_ptr_conv;
8023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8024 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8025 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8026 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8031 LDKOpenChannel this_ptr_conv;
8032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8034 LDKPublicKey val_ref;
8035 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8036 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8037 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8040 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8041 LDKOpenChannel this_ptr_conv;
8042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8043 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8044 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
8048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8049 LDKOpenChannel this_ptr_conv;
8050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8051 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8052 OpenChannel_set_channel_flags(&this_ptr_conv, val);
8055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8056 LDKAcceptChannel 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 AcceptChannel_free(this_ptr_conv);
8062 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8063 LDKAcceptChannel orig_conv;
8064 orig_conv.inner = (void*)(orig & (~1));
8065 orig_conv.is_owned = (orig & 1) || (orig == 0);
8066 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
8067 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8068 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8069 long ret_ref = (long)ret_var.inner;
8070 if (ret_var.is_owned) {
8076 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8077 LDKAcceptChannel this_ptr_conv;
8078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8079 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8080 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8081 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
8085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8086 LDKAcceptChannel this_ptr_conv;
8087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8088 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8089 LDKThirtyTwoBytes val_ref;
8090 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8091 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8092 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8095 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8096 LDKAcceptChannel this_ptr_conv;
8097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8098 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8099 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
8103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8104 LDKAcceptChannel this_ptr_conv;
8105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8106 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8107 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8110 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8118 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) {
8119 LDKAcceptChannel this_ptr_conv;
8120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8121 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8122 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8125 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8134 LDKAcceptChannel this_ptr_conv;
8135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8136 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8137 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8140 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
8148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8149 LDKAcceptChannel this_ptr_conv;
8150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8151 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8152 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8155 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
8163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8164 LDKAcceptChannel this_ptr_conv;
8165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8166 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8167 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
8170 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
8178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8179 LDKAcceptChannel this_ptr_conv;
8180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8181 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8182 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
8185 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
8193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8194 LDKAcceptChannel this_ptr_conv;
8195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8196 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8197 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8200 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8205 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8210 LDKAcceptChannel this_ptr_conv;
8211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8212 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8213 LDKPublicKey val_ref;
8214 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8215 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8216 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8219 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8220 LDKAcceptChannel this_ptr_conv;
8221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8222 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8223 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8224 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8229 LDKAcceptChannel this_ptr_conv;
8230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8231 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8232 LDKPublicKey val_ref;
8233 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8234 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8235 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8238 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8239 LDKAcceptChannel this_ptr_conv;
8240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8241 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8242 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8243 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
8247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8248 LDKAcceptChannel this_ptr_conv;
8249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8250 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8251 LDKPublicKey val_ref;
8252 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8253 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8254 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
8257 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8258 LDKAcceptChannel this_ptr_conv;
8259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8261 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8262 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8267 LDKAcceptChannel this_ptr_conv;
8268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8269 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8270 LDKPublicKey val_ref;
8271 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8272 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8273 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8276 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8277 LDKAcceptChannel this_ptr_conv;
8278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8279 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8280 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8281 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8286 LDKAcceptChannel this_ptr_conv;
8287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8288 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8289 LDKPublicKey val_ref;
8290 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8291 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8292 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8295 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8296 LDKAcceptChannel this_ptr_conv;
8297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8298 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8299 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8300 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8305 LDKAcceptChannel this_ptr_conv;
8306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8308 LDKPublicKey val_ref;
8309 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8310 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8311 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8315 LDKFundingCreated this_ptr_conv;
8316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8317 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8318 FundingCreated_free(this_ptr_conv);
8321 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8322 LDKFundingCreated orig_conv;
8323 orig_conv.inner = (void*)(orig & (~1));
8324 orig_conv.is_owned = (orig & 1) || (orig == 0);
8325 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
8326 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8327 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8328 long ret_ref = (long)ret_var.inner;
8329 if (ret_var.is_owned) {
8335 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8336 LDKFundingCreated this_ptr_conv;
8337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8339 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8340 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
8344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8345 LDKFundingCreated this_ptr_conv;
8346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8348 LDKThirtyTwoBytes val_ref;
8349 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8350 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8351 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
8354 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
8355 LDKFundingCreated this_ptr_conv;
8356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8357 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8358 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8359 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
8363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8364 LDKFundingCreated this_ptr_conv;
8365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8366 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8367 LDKThirtyTwoBytes val_ref;
8368 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8369 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8370 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
8373 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
8374 LDKFundingCreated this_ptr_conv;
8375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8376 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8377 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
8381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8382 LDKFundingCreated this_ptr_conv;
8383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8384 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8385 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
8388 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8393 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
8397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8398 LDKFundingCreated this_ptr_conv;
8399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8401 LDKSignature val_ref;
8402 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8403 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8404 FundingCreated_set_signature(&this_ptr_conv, val_ref);
8407 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) {
8408 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
8409 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
8410 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
8411 LDKThirtyTwoBytes funding_txid_arg_ref;
8412 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
8413 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
8414 LDKSignature signature_arg_ref;
8415 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8416 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8417 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
8418 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8419 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8420 long ret_ref = (long)ret_var.inner;
8421 if (ret_var.is_owned) {
8427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8428 LDKFundingSigned this_ptr_conv;
8429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8431 FundingSigned_free(this_ptr_conv);
8434 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8435 LDKFundingSigned orig_conv;
8436 orig_conv.inner = (void*)(orig & (~1));
8437 orig_conv.is_owned = (orig & 1) || (orig == 0);
8438 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
8439 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8440 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8441 long ret_ref = (long)ret_var.inner;
8442 if (ret_var.is_owned) {
8448 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8449 LDKFundingSigned this_ptr_conv;
8450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8452 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8453 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
8457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8458 LDKFundingSigned this_ptr_conv;
8459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8460 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8461 LDKThirtyTwoBytes val_ref;
8462 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8463 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8464 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
8467 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8468 LDKFundingSigned this_ptr_conv;
8469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8471 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8472 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
8476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8477 LDKFundingSigned this_ptr_conv;
8478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8479 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8480 LDKSignature val_ref;
8481 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8482 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8483 FundingSigned_set_signature(&this_ptr_conv, val_ref);
8486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
8487 LDKThirtyTwoBytes channel_id_arg_ref;
8488 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8489 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8490 LDKSignature signature_arg_ref;
8491 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8492 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8493 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
8494 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8495 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8496 long ret_ref = (long)ret_var.inner;
8497 if (ret_var.is_owned) {
8503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8504 LDKFundingLocked this_ptr_conv;
8505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8506 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8507 FundingLocked_free(this_ptr_conv);
8510 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8511 LDKFundingLocked orig_conv;
8512 orig_conv.inner = (void*)(orig & (~1));
8513 orig_conv.is_owned = (orig & 1) || (orig == 0);
8514 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
8515 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8516 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8517 long ret_ref = (long)ret_var.inner;
8518 if (ret_var.is_owned) {
8524 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8525 LDKFundingLocked this_ptr_conv;
8526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8527 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8528 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8529 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
8533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8534 LDKFundingLocked this_ptr_conv;
8535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8536 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8537 LDKThirtyTwoBytes val_ref;
8538 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8539 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8540 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
8543 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8544 LDKFundingLocked this_ptr_conv;
8545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8546 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8547 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8548 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8553 LDKFundingLocked this_ptr_conv;
8554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8555 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8556 LDKPublicKey val_ref;
8557 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8558 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8559 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8562 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
8563 LDKThirtyTwoBytes channel_id_arg_ref;
8564 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8565 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8566 LDKPublicKey next_per_commitment_point_arg_ref;
8567 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8568 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8569 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
8570 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8571 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8572 long ret_ref = (long)ret_var.inner;
8573 if (ret_var.is_owned) {
8579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8580 LDKShutdown this_ptr_conv;
8581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8582 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8583 Shutdown_free(this_ptr_conv);
8586 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8587 LDKShutdown orig_conv;
8588 orig_conv.inner = (void*)(orig & (~1));
8589 orig_conv.is_owned = (orig & 1) || (orig == 0);
8590 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
8591 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8592 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8593 long ret_ref = (long)ret_var.inner;
8594 if (ret_var.is_owned) {
8600 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8601 LDKShutdown this_ptr_conv;
8602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8603 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8604 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8605 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
8609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8610 LDKShutdown this_ptr_conv;
8611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8612 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8613 LDKThirtyTwoBytes val_ref;
8614 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8615 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8616 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8619 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8620 LDKShutdown this_ptr_conv;
8621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8623 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8624 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8625 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8630 LDKShutdown this_ptr_conv;
8631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8632 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8633 LDKCVec_u8Z val_ref;
8634 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
8635 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
8636 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8637 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
8640 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
8641 LDKThirtyTwoBytes channel_id_arg_ref;
8642 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8643 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8644 LDKCVec_u8Z scriptpubkey_arg_ref;
8645 scriptpubkey_arg_ref.data = (*_env)->GetByteArrayElements (_env, scriptpubkey_arg, NULL);
8646 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
8647 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8648 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8649 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8650 long ret_ref = (long)ret_var.inner;
8651 if (ret_var.is_owned) {
8654 (*_env)->ReleaseByteArrayElements(_env, scriptpubkey_arg, (int8_t*)scriptpubkey_arg_ref.data, 0);
8658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8659 LDKClosingSigned this_ptr_conv;
8660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8661 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8662 ClosingSigned_free(this_ptr_conv);
8665 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8666 LDKClosingSigned orig_conv;
8667 orig_conv.inner = (void*)(orig & (~1));
8668 orig_conv.is_owned = (orig & 1) || (orig == 0);
8669 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
8670 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8671 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8672 long ret_ref = (long)ret_var.inner;
8673 if (ret_var.is_owned) {
8679 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8680 LDKClosingSigned this_ptr_conv;
8681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8682 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8683 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8684 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
8688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8689 LDKClosingSigned this_ptr_conv;
8690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8691 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8692 LDKThirtyTwoBytes val_ref;
8693 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8694 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8695 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
8698 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8699 LDKClosingSigned this_ptr_conv;
8700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8701 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8702 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
8706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8707 LDKClosingSigned this_ptr_conv;
8708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8710 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
8713 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8718 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
8722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8723 LDKClosingSigned this_ptr_conv;
8724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8725 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8726 LDKSignature val_ref;
8727 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8728 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8729 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
8732 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) {
8733 LDKThirtyTwoBytes channel_id_arg_ref;
8734 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8735 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8736 LDKSignature signature_arg_ref;
8737 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8738 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8739 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
8740 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8741 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8742 long ret_ref = (long)ret_var.inner;
8743 if (ret_var.is_owned) {
8749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8750 LDKUpdateAddHTLC this_ptr_conv;
8751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8752 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8753 UpdateAddHTLC_free(this_ptr_conv);
8756 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8757 LDKUpdateAddHTLC orig_conv;
8758 orig_conv.inner = (void*)(orig & (~1));
8759 orig_conv.is_owned = (orig & 1) || (orig == 0);
8760 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
8761 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8762 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8763 long ret_ref = (long)ret_var.inner;
8764 if (ret_var.is_owned) {
8770 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8771 LDKUpdateAddHTLC this_ptr_conv;
8772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8773 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8774 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8775 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
8779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8780 LDKUpdateAddHTLC this_ptr_conv;
8781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8782 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8783 LDKThirtyTwoBytes val_ref;
8784 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8785 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8786 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
8789 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8790 LDKUpdateAddHTLC this_ptr_conv;
8791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8792 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8793 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
8797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8798 LDKUpdateAddHTLC this_ptr_conv;
8799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8800 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8801 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
8804 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
8812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8813 LDKUpdateAddHTLC this_ptr_conv;
8814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8816 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
8819 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8824 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
8828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8829 LDKUpdateAddHTLC this_ptr_conv;
8830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8831 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8832 LDKThirtyTwoBytes val_ref;
8833 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8834 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8835 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
8838 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
8839 LDKUpdateAddHTLC this_ptr_conv;
8840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8841 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8842 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
8846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8847 LDKUpdateAddHTLC this_ptr_conv;
8848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8849 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8850 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
8853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8854 LDKUpdateFulfillHTLC 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 UpdateFulfillHTLC_free(this_ptr_conv);
8860 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8861 LDKUpdateFulfillHTLC orig_conv;
8862 orig_conv.inner = (void*)(orig & (~1));
8863 orig_conv.is_owned = (orig & 1) || (orig == 0);
8864 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
8865 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8866 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8867 long ret_ref = (long)ret_var.inner;
8868 if (ret_var.is_owned) {
8874 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8875 LDKUpdateFulfillHTLC this_ptr_conv;
8876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8877 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8878 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8879 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
8883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8884 LDKUpdateFulfillHTLC this_ptr_conv;
8885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8886 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8887 LDKThirtyTwoBytes val_ref;
8888 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8889 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8890 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
8893 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8894 LDKUpdateFulfillHTLC this_ptr_conv;
8895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8896 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8897 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
8901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8902 LDKUpdateFulfillHTLC this_ptr_conv;
8903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8905 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
8908 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8913 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
8917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8918 LDKUpdateFulfillHTLC this_ptr_conv;
8919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8920 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8921 LDKThirtyTwoBytes val_ref;
8922 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8923 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8924 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
8927 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) {
8928 LDKThirtyTwoBytes channel_id_arg_ref;
8929 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8930 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8931 LDKThirtyTwoBytes payment_preimage_arg_ref;
8932 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
8933 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
8934 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
8935 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8936 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8937 long ret_ref = (long)ret_var.inner;
8938 if (ret_var.is_owned) {
8944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8945 LDKUpdateFailHTLC this_ptr_conv;
8946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8947 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8948 UpdateFailHTLC_free(this_ptr_conv);
8951 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8952 LDKUpdateFailHTLC orig_conv;
8953 orig_conv.inner = (void*)(orig & (~1));
8954 orig_conv.is_owned = (orig & 1) || (orig == 0);
8955 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
8956 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8957 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8958 long ret_ref = (long)ret_var.inner;
8959 if (ret_var.is_owned) {
8965 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8966 LDKUpdateFailHTLC this_ptr_conv;
8967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8968 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8969 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8970 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
8974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8975 LDKUpdateFailHTLC this_ptr_conv;
8976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8977 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8978 LDKThirtyTwoBytes val_ref;
8979 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8980 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8981 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
8984 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8985 LDKUpdateFailHTLC this_ptr_conv;
8986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8987 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8988 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
8992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8993 LDKUpdateFailHTLC this_ptr_conv;
8994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8995 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8996 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
8999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9000 LDKUpdateFailMalformedHTLC 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 UpdateFailMalformedHTLC_free(this_ptr_conv);
9006 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9007 LDKUpdateFailMalformedHTLC orig_conv;
9008 orig_conv.inner = (void*)(orig & (~1));
9009 orig_conv.is_owned = (orig & 1) || (orig == 0);
9010 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
9011 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9012 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9013 long ret_ref = (long)ret_var.inner;
9014 if (ret_var.is_owned) {
9020 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9021 LDKUpdateFailMalformedHTLC this_ptr_conv;
9022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9023 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9024 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9025 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
9029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9030 LDKUpdateFailMalformedHTLC this_ptr_conv;
9031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9032 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9033 LDKThirtyTwoBytes val_ref;
9034 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9035 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9036 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
9039 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9040 LDKUpdateFailMalformedHTLC this_ptr_conv;
9041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9042 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9043 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
9047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9048 LDKUpdateFailMalformedHTLC this_ptr_conv;
9049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9051 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
9054 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
9062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9063 LDKUpdateFailMalformedHTLC this_ptr_conv;
9064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9066 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
9069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9070 LDKCommitmentSigned 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 CommitmentSigned_free(this_ptr_conv);
9076 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9077 LDKCommitmentSigned orig_conv;
9078 orig_conv.inner = (void*)(orig & (~1));
9079 orig_conv.is_owned = (orig & 1) || (orig == 0);
9080 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
9081 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9082 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9083 long ret_ref = (long)ret_var.inner;
9084 if (ret_var.is_owned) {
9090 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9091 LDKCommitmentSigned this_ptr_conv;
9092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9094 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9095 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
9099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9100 LDKCommitmentSigned this_ptr_conv;
9101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9102 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9103 LDKThirtyTwoBytes val_ref;
9104 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9105 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9106 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
9109 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9110 LDKCommitmentSigned this_ptr_conv;
9111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9112 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9113 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9114 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
9118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9119 LDKCommitmentSigned this_ptr_conv;
9120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9121 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9122 LDKSignature val_ref;
9123 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9124 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9125 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
9128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
9129 LDKCommitmentSigned this_ptr_conv;
9130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9131 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9132 LDKCVec_SignatureZ val_constr;
9133 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9134 if (val_constr.datalen > 0)
9135 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9137 val_constr.data = NULL;
9138 for (size_t i = 0; i < val_constr.datalen; i++) {
9139 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
9140 LDKSignature arr_conv_8_ref;
9141 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9142 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9143 val_constr.data[i] = arr_conv_8_ref;
9145 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
9148 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) {
9149 LDKThirtyTwoBytes channel_id_arg_ref;
9150 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9151 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9152 LDKSignature signature_arg_ref;
9153 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9154 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9155 LDKCVec_SignatureZ htlc_signatures_arg_constr;
9156 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
9157 if (htlc_signatures_arg_constr.datalen > 0)
9158 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9160 htlc_signatures_arg_constr.data = NULL;
9161 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
9162 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
9163 LDKSignature arr_conv_8_ref;
9164 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9165 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9166 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
9168 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
9169 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9170 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9171 long ret_ref = (long)ret_var.inner;
9172 if (ret_var.is_owned) {
9178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9179 LDKRevokeAndACK this_ptr_conv;
9180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9181 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9182 RevokeAndACK_free(this_ptr_conv);
9185 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9186 LDKRevokeAndACK orig_conv;
9187 orig_conv.inner = (void*)(orig & (~1));
9188 orig_conv.is_owned = (orig & 1) || (orig == 0);
9189 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
9190 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9191 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9192 long ret_ref = (long)ret_var.inner;
9193 if (ret_var.is_owned) {
9199 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9200 LDKRevokeAndACK this_ptr_conv;
9201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9202 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9203 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9204 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
9208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9209 LDKRevokeAndACK this_ptr_conv;
9210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9211 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9212 LDKThirtyTwoBytes val_ref;
9213 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9214 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9215 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
9218 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9219 LDKRevokeAndACK this_ptr_conv;
9220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9221 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9222 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9223 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
9227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9228 LDKRevokeAndACK this_ptr_conv;
9229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9230 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9231 LDKThirtyTwoBytes val_ref;
9232 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9233 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9234 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
9237 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9238 LDKRevokeAndACK this_ptr_conv;
9239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9240 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9241 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9242 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
9246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9247 LDKRevokeAndACK this_ptr_conv;
9248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9249 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9250 LDKPublicKey val_ref;
9251 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9252 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9253 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
9256 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) {
9257 LDKThirtyTwoBytes channel_id_arg_ref;
9258 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9259 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9260 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
9261 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
9262 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
9263 LDKPublicKey next_per_commitment_point_arg_ref;
9264 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
9265 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
9266 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
9267 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9268 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9269 long ret_ref = (long)ret_var.inner;
9270 if (ret_var.is_owned) {
9276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9277 LDKUpdateFee this_ptr_conv;
9278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9279 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9280 UpdateFee_free(this_ptr_conv);
9283 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9284 LDKUpdateFee orig_conv;
9285 orig_conv.inner = (void*)(orig & (~1));
9286 orig_conv.is_owned = (orig & 1) || (orig == 0);
9287 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
9288 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9289 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9290 long ret_ref = (long)ret_var.inner;
9291 if (ret_var.is_owned) {
9297 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9298 LDKUpdateFee this_ptr_conv;
9299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9300 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9301 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9302 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
9306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9307 LDKUpdateFee this_ptr_conv;
9308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9309 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9310 LDKThirtyTwoBytes val_ref;
9311 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9312 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9313 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
9316 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
9317 LDKUpdateFee this_ptr_conv;
9318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9319 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9320 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
9324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9325 LDKUpdateFee this_ptr_conv;
9326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9327 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9328 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
9331 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
9332 LDKThirtyTwoBytes channel_id_arg_ref;
9333 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9334 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9335 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
9336 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9337 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9338 long ret_ref = (long)ret_var.inner;
9339 if (ret_var.is_owned) {
9345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9346 LDKDataLossProtect this_ptr_conv;
9347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9348 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9349 DataLossProtect_free(this_ptr_conv);
9352 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9353 LDKDataLossProtect orig_conv;
9354 orig_conv.inner = (void*)(orig & (~1));
9355 orig_conv.is_owned = (orig & 1) || (orig == 0);
9356 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
9357 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9358 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9359 long ret_ref = (long)ret_var.inner;
9360 if (ret_var.is_owned) {
9366 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9367 LDKDataLossProtect this_ptr_conv;
9368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9369 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9370 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9371 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
9375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9376 LDKDataLossProtect this_ptr_conv;
9377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9378 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9379 LDKThirtyTwoBytes val_ref;
9380 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9381 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9382 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
9385 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9386 LDKDataLossProtect this_ptr_conv;
9387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9388 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9389 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9390 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
9394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9395 LDKDataLossProtect this_ptr_conv;
9396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9397 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9398 LDKPublicKey val_ref;
9399 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9400 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9401 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
9404 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) {
9405 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
9406 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
9407 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
9408 LDKPublicKey my_current_per_commitment_point_arg_ref;
9409 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
9410 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
9411 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
9412 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9413 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9414 long ret_ref = (long)ret_var.inner;
9415 if (ret_var.is_owned) {
9421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9422 LDKChannelReestablish this_ptr_conv;
9423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9424 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9425 ChannelReestablish_free(this_ptr_conv);
9428 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9429 LDKChannelReestablish orig_conv;
9430 orig_conv.inner = (void*)(orig & (~1));
9431 orig_conv.is_owned = (orig & 1) || (orig == 0);
9432 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
9433 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9434 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9435 long ret_ref = (long)ret_var.inner;
9436 if (ret_var.is_owned) {
9442 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9443 LDKChannelReestablish this_ptr_conv;
9444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9445 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9446 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9447 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
9451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9452 LDKChannelReestablish this_ptr_conv;
9453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9454 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9455 LDKThirtyTwoBytes val_ref;
9456 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9457 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9458 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
9461 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9462 LDKChannelReestablish this_ptr_conv;
9463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9464 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9465 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
9469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9470 LDKChannelReestablish this_ptr_conv;
9471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9472 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9473 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
9476 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
9484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9485 LDKChannelReestablish this_ptr_conv;
9486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9487 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9488 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
9491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9492 LDKAnnouncementSignatures 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 AnnouncementSignatures_free(this_ptr_conv);
9498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9499 LDKAnnouncementSignatures orig_conv;
9500 orig_conv.inner = (void*)(orig & (~1));
9501 orig_conv.is_owned = (orig & 1) || (orig == 0);
9502 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
9503 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9504 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9505 long ret_ref = (long)ret_var.inner;
9506 if (ret_var.is_owned) {
9512 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9513 LDKAnnouncementSignatures this_ptr_conv;
9514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9515 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9516 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9517 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
9521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9522 LDKAnnouncementSignatures this_ptr_conv;
9523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9524 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9525 LDKThirtyTwoBytes val_ref;
9526 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9527 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9528 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
9531 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9532 LDKAnnouncementSignatures this_ptr_conv;
9533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9534 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9535 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
9539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9540 LDKAnnouncementSignatures this_ptr_conv;
9541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9542 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9543 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
9546 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9551 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
9555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9556 LDKAnnouncementSignatures this_ptr_conv;
9557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9558 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9559 LDKSignature val_ref;
9560 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9561 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9562 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
9565 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9566 LDKAnnouncementSignatures this_ptr_conv;
9567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9569 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9570 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
9574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9575 LDKAnnouncementSignatures this_ptr_conv;
9576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9577 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9578 LDKSignature val_ref;
9579 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9580 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9581 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
9584 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) {
9585 LDKThirtyTwoBytes channel_id_arg_ref;
9586 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9587 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9588 LDKSignature node_signature_arg_ref;
9589 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
9590 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
9591 LDKSignature bitcoin_signature_arg_ref;
9592 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
9593 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
9594 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
9595 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9596 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9597 long ret_ref = (long)ret_var.inner;
9598 if (ret_var.is_owned) {
9604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9605 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
9606 FREE((void*)this_ptr);
9607 NetAddress_free(this_ptr_conv);
9610 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9611 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
9612 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9613 *ret_copy = NetAddress_clone(orig_conv);
9614 long ret_ref = (long)ret_copy;
9618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9619 LDKUnsignedNodeAnnouncement this_ptr_conv;
9620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9621 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9622 UnsignedNodeAnnouncement_free(this_ptr_conv);
9625 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9626 LDKUnsignedNodeAnnouncement orig_conv;
9627 orig_conv.inner = (void*)(orig & (~1));
9628 orig_conv.is_owned = (orig & 1) || (orig == 0);
9629 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
9630 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9631 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9632 long ret_ref = (long)ret_var.inner;
9633 if (ret_var.is_owned) {
9639 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9640 LDKUnsignedNodeAnnouncement this_ptr_conv;
9641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9642 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9643 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9644 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9645 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9646 long ret_ref = (long)ret_var.inner;
9647 if (ret_var.is_owned) {
9653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9654 LDKUnsignedNodeAnnouncement this_ptr_conv;
9655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9656 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9657 LDKNodeFeatures val_conv;
9658 val_conv.inner = (void*)(val & (~1));
9659 val_conv.is_owned = (val & 1) || (val == 0);
9660 // Warning: we may need a move here but can't clone!
9661 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9664 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9665 LDKUnsignedNodeAnnouncement this_ptr_conv;
9666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9667 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9668 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9673 LDKUnsignedNodeAnnouncement this_ptr_conv;
9674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9675 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9676 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9679 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9684 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
9688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9689 LDKUnsignedNodeAnnouncement this_ptr_conv;
9690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9691 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9692 LDKPublicKey val_ref;
9693 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9694 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9695 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
9698 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
9699 LDKUnsignedNodeAnnouncement this_ptr_conv;
9700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9701 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9702 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
9703 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
9707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9708 LDKUnsignedNodeAnnouncement this_ptr_conv;
9709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9710 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9711 LDKThreeBytes val_ref;
9712 CHECK((*_env)->GetArrayLength (_env, val) == 3);
9713 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
9714 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
9717 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
9718 LDKUnsignedNodeAnnouncement this_ptr_conv;
9719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9720 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9721 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9722 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
9726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9727 LDKUnsignedNodeAnnouncement this_ptr_conv;
9728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9729 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9730 LDKThirtyTwoBytes val_ref;
9731 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9732 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9733 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
9736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9737 LDKUnsignedNodeAnnouncement this_ptr_conv;
9738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9739 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9740 LDKCVec_NetAddressZ val_constr;
9741 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9742 if (val_constr.datalen > 0)
9743 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9745 val_constr.data = NULL;
9746 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9747 for (size_t m = 0; m < val_constr.datalen; m++) {
9748 long arr_conv_12 = val_vals[m];
9749 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9750 FREE((void*)arr_conv_12);
9751 val_constr.data[m] = arr_conv_12_conv;
9753 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9754 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
9757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9758 LDKNodeAnnouncement this_ptr_conv;
9759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9760 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9761 NodeAnnouncement_free(this_ptr_conv);
9764 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9765 LDKNodeAnnouncement orig_conv;
9766 orig_conv.inner = (void*)(orig & (~1));
9767 orig_conv.is_owned = (orig & 1) || (orig == 0);
9768 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
9769 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9770 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9771 long ret_ref = (long)ret_var.inner;
9772 if (ret_var.is_owned) {
9778 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9779 LDKNodeAnnouncement this_ptr_conv;
9780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9781 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9782 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9783 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
9787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9788 LDKNodeAnnouncement this_ptr_conv;
9789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9790 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9791 LDKSignature val_ref;
9792 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9793 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9794 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
9797 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9798 LDKNodeAnnouncement this_ptr_conv;
9799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9800 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9801 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
9802 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9803 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9804 long ret_ref = (long)ret_var.inner;
9805 if (ret_var.is_owned) {
9811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9812 LDKNodeAnnouncement this_ptr_conv;
9813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9814 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9815 LDKUnsignedNodeAnnouncement val_conv;
9816 val_conv.inner = (void*)(val & (~1));
9817 val_conv.is_owned = (val & 1) || (val == 0);
9818 if (val_conv.inner != NULL)
9819 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
9820 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
9823 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9824 LDKSignature signature_arg_ref;
9825 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9826 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9827 LDKUnsignedNodeAnnouncement contents_arg_conv;
9828 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9829 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9830 if (contents_arg_conv.inner != NULL)
9831 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
9832 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
9833 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9834 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9835 long ret_ref = (long)ret_var.inner;
9836 if (ret_var.is_owned) {
9842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9843 LDKUnsignedChannelAnnouncement this_ptr_conv;
9844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9845 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9846 UnsignedChannelAnnouncement_free(this_ptr_conv);
9849 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9850 LDKUnsignedChannelAnnouncement orig_conv;
9851 orig_conv.inner = (void*)(orig & (~1));
9852 orig_conv.is_owned = (orig & 1) || (orig == 0);
9853 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
9854 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9855 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9856 long ret_ref = (long)ret_var.inner;
9857 if (ret_var.is_owned) {
9863 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9864 LDKUnsignedChannelAnnouncement this_ptr_conv;
9865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9866 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9867 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
9868 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9869 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9870 long ret_ref = (long)ret_var.inner;
9871 if (ret_var.is_owned) {
9877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9878 LDKUnsignedChannelAnnouncement this_ptr_conv;
9879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9881 LDKChannelFeatures val_conv;
9882 val_conv.inner = (void*)(val & (~1));
9883 val_conv.is_owned = (val & 1) || (val == 0);
9884 // Warning: we may need a move here but can't clone!
9885 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
9888 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9889 LDKUnsignedChannelAnnouncement this_ptr_conv;
9890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9891 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9892 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9893 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
9897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9898 LDKUnsignedChannelAnnouncement this_ptr_conv;
9899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9900 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9901 LDKThirtyTwoBytes val_ref;
9902 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9903 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9904 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
9907 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9908 LDKUnsignedChannelAnnouncement this_ptr_conv;
9909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9910 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9911 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
9915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9916 LDKUnsignedChannelAnnouncement this_ptr_conv;
9917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9918 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9919 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
9922 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9927 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
9931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9932 LDKUnsignedChannelAnnouncement this_ptr_conv;
9933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9934 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9935 LDKPublicKey val_ref;
9936 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9937 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9938 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
9941 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9942 LDKUnsignedChannelAnnouncement this_ptr_conv;
9943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9944 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9945 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9946 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
9950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9951 LDKUnsignedChannelAnnouncement this_ptr_conv;
9952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9953 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9954 LDKPublicKey val_ref;
9955 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9956 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9957 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
9960 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9961 LDKUnsignedChannelAnnouncement this_ptr_conv;
9962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9963 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9964 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9965 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
9969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9970 LDKUnsignedChannelAnnouncement this_ptr_conv;
9971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9972 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9973 LDKPublicKey val_ref;
9974 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9975 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9976 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
9979 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9980 LDKUnsignedChannelAnnouncement this_ptr_conv;
9981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9982 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9983 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9984 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
9988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9989 LDKUnsignedChannelAnnouncement this_ptr_conv;
9990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9991 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9992 LDKPublicKey val_ref;
9993 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9994 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9995 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
9998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9999 LDKChannelAnnouncement this_ptr_conv;
10000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10001 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10002 ChannelAnnouncement_free(this_ptr_conv);
10005 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10006 LDKChannelAnnouncement orig_conv;
10007 orig_conv.inner = (void*)(orig & (~1));
10008 orig_conv.is_owned = (orig & 1) || (orig == 0);
10009 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
10010 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10011 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10012 long ret_ref = (long)ret_var.inner;
10013 if (ret_var.is_owned) {
10019 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10020 LDKChannelAnnouncement this_ptr_conv;
10021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10022 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10023 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10024 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
10028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10029 LDKChannelAnnouncement this_ptr_conv;
10030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10031 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10032 LDKSignature val_ref;
10033 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10034 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10035 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
10038 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10039 LDKChannelAnnouncement this_ptr_conv;
10040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10041 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10042 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10043 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
10047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10048 LDKChannelAnnouncement this_ptr_conv;
10049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10051 LDKSignature val_ref;
10052 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10053 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10054 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
10057 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10058 LDKChannelAnnouncement this_ptr_conv;
10059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10060 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10061 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10062 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
10066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10067 LDKChannelAnnouncement this_ptr_conv;
10068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10069 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10070 LDKSignature val_ref;
10071 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10072 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10073 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
10076 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10077 LDKChannelAnnouncement this_ptr_conv;
10078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10079 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10080 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10081 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
10085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10086 LDKChannelAnnouncement this_ptr_conv;
10087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10088 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10089 LDKSignature val_ref;
10090 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10091 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10092 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
10095 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10096 LDKChannelAnnouncement this_ptr_conv;
10097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10098 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10099 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
10100 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10101 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10102 long ret_ref = (long)ret_var.inner;
10103 if (ret_var.is_owned) {
10109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10110 LDKChannelAnnouncement this_ptr_conv;
10111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10112 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10113 LDKUnsignedChannelAnnouncement val_conv;
10114 val_conv.inner = (void*)(val & (~1));
10115 val_conv.is_owned = (val & 1) || (val == 0);
10116 if (val_conv.inner != NULL)
10117 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
10118 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
10121 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) {
10122 LDKSignature node_signature_1_arg_ref;
10123 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
10124 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
10125 LDKSignature node_signature_2_arg_ref;
10126 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
10127 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
10128 LDKSignature bitcoin_signature_1_arg_ref;
10129 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
10130 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
10131 LDKSignature bitcoin_signature_2_arg_ref;
10132 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
10133 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
10134 LDKUnsignedChannelAnnouncement contents_arg_conv;
10135 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10136 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10137 if (contents_arg_conv.inner != NULL)
10138 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
10139 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);
10140 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10141 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10142 long ret_ref = (long)ret_var.inner;
10143 if (ret_var.is_owned) {
10149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10150 LDKUnsignedChannelUpdate this_ptr_conv;
10151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10152 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10153 UnsignedChannelUpdate_free(this_ptr_conv);
10156 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10157 LDKUnsignedChannelUpdate orig_conv;
10158 orig_conv.inner = (void*)(orig & (~1));
10159 orig_conv.is_owned = (orig & 1) || (orig == 0);
10160 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
10161 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10162 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10163 long ret_ref = (long)ret_var.inner;
10164 if (ret_var.is_owned) {
10170 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10171 LDKUnsignedChannelUpdate this_ptr_conv;
10172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10173 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10174 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10175 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
10179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10180 LDKUnsignedChannelUpdate this_ptr_conv;
10181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10182 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10183 LDKThirtyTwoBytes val_ref;
10184 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10185 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10186 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
10189 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10190 LDKUnsignedChannelUpdate this_ptr_conv;
10191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10192 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10193 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
10197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10198 LDKUnsignedChannelUpdate this_ptr_conv;
10199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10200 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10201 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
10204 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
10212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10213 LDKUnsignedChannelUpdate this_ptr_conv;
10214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10215 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10216 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
10219 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
10227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
10228 LDKUnsignedChannelUpdate this_ptr_conv;
10229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10230 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10231 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
10234 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
10242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10243 LDKUnsignedChannelUpdate this_ptr_conv;
10244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10245 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10246 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
10249 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
10257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10258 LDKUnsignedChannelUpdate this_ptr_conv;
10259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10261 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
10264 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
10272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10273 LDKUnsignedChannelUpdate this_ptr_conv;
10274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10275 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10276 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
10279 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
10287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10288 LDKUnsignedChannelUpdate this_ptr_conv;
10289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10290 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10291 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
10294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10295 LDKChannelUpdate 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 ChannelUpdate_free(this_ptr_conv);
10301 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10302 LDKChannelUpdate orig_conv;
10303 orig_conv.inner = (void*)(orig & (~1));
10304 orig_conv.is_owned = (orig & 1) || (orig == 0);
10305 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
10306 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10307 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10308 long ret_ref = (long)ret_var.inner;
10309 if (ret_var.is_owned) {
10315 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10316 LDKChannelUpdate this_ptr_conv;
10317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10319 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10320 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
10324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10325 LDKChannelUpdate this_ptr_conv;
10326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10327 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10328 LDKSignature val_ref;
10329 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10330 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10331 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
10334 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10335 LDKChannelUpdate this_ptr_conv;
10336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10337 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10338 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
10339 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10340 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10341 long ret_ref = (long)ret_var.inner;
10342 if (ret_var.is_owned) {
10348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10349 LDKChannelUpdate this_ptr_conv;
10350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10351 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10352 LDKUnsignedChannelUpdate val_conv;
10353 val_conv.inner = (void*)(val & (~1));
10354 val_conv.is_owned = (val & 1) || (val == 0);
10355 if (val_conv.inner != NULL)
10356 val_conv = UnsignedChannelUpdate_clone(&val_conv);
10357 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
10360 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
10361 LDKSignature signature_arg_ref;
10362 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10363 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10364 LDKUnsignedChannelUpdate contents_arg_conv;
10365 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10366 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10367 if (contents_arg_conv.inner != NULL)
10368 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
10369 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
10370 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10371 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10372 long ret_ref = (long)ret_var.inner;
10373 if (ret_var.is_owned) {
10379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10380 LDKQueryChannelRange this_ptr_conv;
10381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10382 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10383 QueryChannelRange_free(this_ptr_conv);
10386 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10387 LDKQueryChannelRange orig_conv;
10388 orig_conv.inner = (void*)(orig & (~1));
10389 orig_conv.is_owned = (orig & 1) || (orig == 0);
10390 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
10391 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10392 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10393 long ret_ref = (long)ret_var.inner;
10394 if (ret_var.is_owned) {
10400 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10401 LDKQueryChannelRange this_ptr_conv;
10402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10404 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10405 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
10409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10410 LDKQueryChannelRange this_ptr_conv;
10411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10412 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10413 LDKThirtyTwoBytes val_ref;
10414 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10415 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10416 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10419 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10420 LDKQueryChannelRange this_ptr_conv;
10421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10422 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10423 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
10427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10428 LDKQueryChannelRange this_ptr_conv;
10429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10431 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
10434 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
10442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10443 LDKQueryChannelRange this_ptr_conv;
10444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10445 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10446 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10449 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) {
10450 LDKThirtyTwoBytes chain_hash_arg_ref;
10451 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10452 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10453 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
10454 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10455 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10456 long ret_ref = (long)ret_var.inner;
10457 if (ret_var.is_owned) {
10463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10464 LDKReplyChannelRange this_ptr_conv;
10465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10467 ReplyChannelRange_free(this_ptr_conv);
10470 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10471 LDKReplyChannelRange orig_conv;
10472 orig_conv.inner = (void*)(orig & (~1));
10473 orig_conv.is_owned = (orig & 1) || (orig == 0);
10474 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
10475 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10476 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10477 long ret_ref = (long)ret_var.inner;
10478 if (ret_var.is_owned) {
10484 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10485 LDKReplyChannelRange this_ptr_conv;
10486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10487 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10488 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10489 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
10493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10494 LDKReplyChannelRange this_ptr_conv;
10495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10496 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10497 LDKThirtyTwoBytes val_ref;
10498 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10499 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10500 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10503 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10504 LDKReplyChannelRange this_ptr_conv;
10505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10506 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10507 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
10511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10512 LDKReplyChannelRange this_ptr_conv;
10513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10514 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10515 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
10518 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
10526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10527 LDKReplyChannelRange this_ptr_conv;
10528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10529 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10530 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10533 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
10541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10542 LDKReplyChannelRange this_ptr_conv;
10543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10545 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
10548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray 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 LDKCVec_u64Z val_constr;
10553 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10554 if (val_constr.datalen > 0)
10555 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10557 val_constr.data = NULL;
10558 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10559 for (size_t g = 0; g < val_constr.datalen; g++) {
10560 long arr_conv_6 = val_vals[g];
10561 val_constr.data[g] = arr_conv_6;
10563 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10564 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
10567 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) {
10568 LDKThirtyTwoBytes chain_hash_arg_ref;
10569 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10570 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10571 LDKCVec_u64Z short_channel_ids_arg_constr;
10572 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10573 if (short_channel_ids_arg_constr.datalen > 0)
10574 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10576 short_channel_ids_arg_constr.data = NULL;
10577 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10578 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10579 long arr_conv_6 = short_channel_ids_arg_vals[g];
10580 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10582 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10583 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
10584 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10585 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10586 long ret_ref = (long)ret_var.inner;
10587 if (ret_var.is_owned) {
10593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10594 LDKQueryShortChannelIds this_ptr_conv;
10595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10596 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10597 QueryShortChannelIds_free(this_ptr_conv);
10600 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10601 LDKQueryShortChannelIds orig_conv;
10602 orig_conv.inner = (void*)(orig & (~1));
10603 orig_conv.is_owned = (orig & 1) || (orig == 0);
10604 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
10605 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10606 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10607 long ret_ref = (long)ret_var.inner;
10608 if (ret_var.is_owned) {
10614 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10615 LDKQueryShortChannelIds this_ptr_conv;
10616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10617 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10618 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10619 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
10623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10624 LDKQueryShortChannelIds this_ptr_conv;
10625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10626 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10627 LDKThirtyTwoBytes val_ref;
10628 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10629 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10630 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
10633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10634 LDKQueryShortChannelIds this_ptr_conv;
10635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10636 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10637 LDKCVec_u64Z val_constr;
10638 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10639 if (val_constr.datalen > 0)
10640 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10642 val_constr.data = NULL;
10643 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10644 for (size_t g = 0; g < val_constr.datalen; g++) {
10645 long arr_conv_6 = val_vals[g];
10646 val_constr.data[g] = arr_conv_6;
10648 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10649 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
10652 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
10653 LDKThirtyTwoBytes chain_hash_arg_ref;
10654 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10655 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10656 LDKCVec_u64Z short_channel_ids_arg_constr;
10657 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10658 if (short_channel_ids_arg_constr.datalen > 0)
10659 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10661 short_channel_ids_arg_constr.data = NULL;
10662 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10663 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10664 long arr_conv_6 = short_channel_ids_arg_vals[g];
10665 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10667 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10668 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
10669 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10670 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10671 long ret_ref = (long)ret_var.inner;
10672 if (ret_var.is_owned) {
10678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10679 LDKReplyShortChannelIdsEnd this_ptr_conv;
10680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10681 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10682 ReplyShortChannelIdsEnd_free(this_ptr_conv);
10685 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10686 LDKReplyShortChannelIdsEnd orig_conv;
10687 orig_conv.inner = (void*)(orig & (~1));
10688 orig_conv.is_owned = (orig & 1) || (orig == 0);
10689 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
10690 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10691 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10692 long ret_ref = (long)ret_var.inner;
10693 if (ret_var.is_owned) {
10699 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10700 LDKReplyShortChannelIdsEnd this_ptr_conv;
10701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10702 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10703 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10704 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
10708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10709 LDKReplyShortChannelIdsEnd this_ptr_conv;
10710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10711 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10712 LDKThirtyTwoBytes val_ref;
10713 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10714 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10715 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
10718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10719 LDKReplyShortChannelIdsEnd this_ptr_conv;
10720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10721 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10722 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
10726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10727 LDKReplyShortChannelIdsEnd this_ptr_conv;
10728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10729 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10730 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
10733 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
10734 LDKThirtyTwoBytes chain_hash_arg_ref;
10735 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10736 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10737 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
10738 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10739 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10740 long ret_ref = (long)ret_var.inner;
10741 if (ret_var.is_owned) {
10747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10748 LDKGossipTimestampFilter this_ptr_conv;
10749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10750 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10751 GossipTimestampFilter_free(this_ptr_conv);
10754 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10755 LDKGossipTimestampFilter orig_conv;
10756 orig_conv.inner = (void*)(orig & (~1));
10757 orig_conv.is_owned = (orig & 1) || (orig == 0);
10758 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
10759 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10760 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10761 long ret_ref = (long)ret_var.inner;
10762 if (ret_var.is_owned) {
10768 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10769 LDKGossipTimestampFilter this_ptr_conv;
10770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10771 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10772 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10773 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
10777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10778 LDKGossipTimestampFilter this_ptr_conv;
10779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10780 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10781 LDKThirtyTwoBytes val_ref;
10782 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10783 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10784 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
10787 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10788 LDKGossipTimestampFilter this_ptr_conv;
10789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10790 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10791 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
10795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10796 LDKGossipTimestampFilter this_ptr_conv;
10797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10799 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
10802 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
10810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10811 LDKGossipTimestampFilter this_ptr_conv;
10812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10813 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10814 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
10817 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) {
10818 LDKThirtyTwoBytes chain_hash_arg_ref;
10819 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10820 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10821 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
10822 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10823 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10824 long ret_ref = (long)ret_var.inner;
10825 if (ret_var.is_owned) {
10831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10832 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
10833 FREE((void*)this_ptr);
10834 ErrorAction_free(this_ptr_conv);
10837 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10838 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
10839 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10840 *ret_copy = ErrorAction_clone(orig_conv);
10841 long ret_ref = (long)ret_copy;
10845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10846 LDKLightningError this_ptr_conv;
10847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10848 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10849 LightningError_free(this_ptr_conv);
10852 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(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 LDKStr _str = LightningError_get_err(&this_ptr_conv);
10857 char* _buf = MALLOC(_str.len + 1, "str conv buf");
10858 memcpy(_buf, _str.chars, _str.len);
10859 _buf[_str.len] = 0;
10860 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
10865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10866 LDKLightningError this_ptr_conv;
10867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10868 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10869 LDKCVec_u8Z val_ref;
10870 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
10871 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
10872 LightningError_set_err(&this_ptr_conv, val_ref);
10873 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
10876 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
10877 LDKLightningError this_ptr_conv;
10878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10879 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10880 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10881 *ret_copy = LightningError_get_action(&this_ptr_conv);
10882 long ret_ref = (long)ret_copy;
10886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10887 LDKLightningError this_ptr_conv;
10888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10889 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10890 LDKErrorAction val_conv = *(LDKErrorAction*)val;
10892 LightningError_set_action(&this_ptr_conv, val_conv);
10895 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
10896 LDKCVec_u8Z err_arg_ref;
10897 err_arg_ref.data = (*_env)->GetByteArrayElements (_env, err_arg, NULL);
10898 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
10899 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
10900 FREE((void*)action_arg);
10901 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
10902 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10903 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10904 long ret_ref = (long)ret_var.inner;
10905 if (ret_var.is_owned) {
10908 (*_env)->ReleaseByteArrayElements(_env, err_arg, (int8_t*)err_arg_ref.data, 0);
10912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10913 LDKCommitmentUpdate this_ptr_conv;
10914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10915 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10916 CommitmentUpdate_free(this_ptr_conv);
10919 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10920 LDKCommitmentUpdate orig_conv;
10921 orig_conv.inner = (void*)(orig & (~1));
10922 orig_conv.is_owned = (orig & 1) || (orig == 0);
10923 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
10924 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10925 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10926 long ret_ref = (long)ret_var.inner;
10927 if (ret_var.is_owned) {
10933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10934 LDKCommitmentUpdate this_ptr_conv;
10935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10936 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10937 LDKCVec_UpdateAddHTLCZ val_constr;
10938 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10939 if (val_constr.datalen > 0)
10940 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10942 val_constr.data = NULL;
10943 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10944 for (size_t p = 0; p < val_constr.datalen; p++) {
10945 long arr_conv_15 = val_vals[p];
10946 LDKUpdateAddHTLC arr_conv_15_conv;
10947 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10948 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10949 if (arr_conv_15_conv.inner != NULL)
10950 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10951 val_constr.data[p] = arr_conv_15_conv;
10953 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10954 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
10957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10958 LDKCommitmentUpdate this_ptr_conv;
10959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10961 LDKCVec_UpdateFulfillHTLCZ val_constr;
10962 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10963 if (val_constr.datalen > 0)
10964 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10966 val_constr.data = NULL;
10967 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10968 for (size_t t = 0; t < val_constr.datalen; t++) {
10969 long arr_conv_19 = val_vals[t];
10970 LDKUpdateFulfillHTLC arr_conv_19_conv;
10971 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10972 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10973 if (arr_conv_19_conv.inner != NULL)
10974 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10975 val_constr.data[t] = arr_conv_19_conv;
10977 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10978 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
10981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10982 LDKCommitmentUpdate this_ptr_conv;
10983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10984 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10985 LDKCVec_UpdateFailHTLCZ val_constr;
10986 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10987 if (val_constr.datalen > 0)
10988 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10990 val_constr.data = NULL;
10991 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10992 for (size_t q = 0; q < val_constr.datalen; q++) {
10993 long arr_conv_16 = val_vals[q];
10994 LDKUpdateFailHTLC arr_conv_16_conv;
10995 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10996 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10997 if (arr_conv_16_conv.inner != NULL)
10998 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
10999 val_constr.data[q] = arr_conv_16_conv;
11001 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11002 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
11005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11006 LDKCommitmentUpdate this_ptr_conv;
11007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11008 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11009 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
11010 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11011 if (val_constr.datalen > 0)
11012 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11014 val_constr.data = NULL;
11015 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11016 for (size_t z = 0; z < val_constr.datalen; z++) {
11017 long arr_conv_25 = val_vals[z];
11018 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11019 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11020 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11021 if (arr_conv_25_conv.inner != NULL)
11022 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11023 val_constr.data[z] = arr_conv_25_conv;
11025 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11026 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
11029 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
11030 LDKCommitmentUpdate this_ptr_conv;
11031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11032 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11033 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
11034 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11035 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11036 long ret_ref = (long)ret_var.inner;
11037 if (ret_var.is_owned) {
11043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11044 LDKCommitmentUpdate this_ptr_conv;
11045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11046 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11047 LDKUpdateFee val_conv;
11048 val_conv.inner = (void*)(val & (~1));
11049 val_conv.is_owned = (val & 1) || (val == 0);
11050 if (val_conv.inner != NULL)
11051 val_conv = UpdateFee_clone(&val_conv);
11052 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
11055 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
11056 LDKCommitmentUpdate this_ptr_conv;
11057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11058 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11059 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
11060 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11061 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11062 long ret_ref = (long)ret_var.inner;
11063 if (ret_var.is_owned) {
11069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11070 LDKCommitmentUpdate this_ptr_conv;
11071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11072 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11073 LDKCommitmentSigned val_conv;
11074 val_conv.inner = (void*)(val & (~1));
11075 val_conv.is_owned = (val & 1) || (val == 0);
11076 if (val_conv.inner != NULL)
11077 val_conv = CommitmentSigned_clone(&val_conv);
11078 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
11081 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) {
11082 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
11083 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
11084 if (update_add_htlcs_arg_constr.datalen > 0)
11085 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11087 update_add_htlcs_arg_constr.data = NULL;
11088 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
11089 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
11090 long arr_conv_15 = update_add_htlcs_arg_vals[p];
11091 LDKUpdateAddHTLC arr_conv_15_conv;
11092 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11093 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11094 if (arr_conv_15_conv.inner != NULL)
11095 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11096 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
11098 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
11099 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
11100 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
11101 if (update_fulfill_htlcs_arg_constr.datalen > 0)
11102 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11104 update_fulfill_htlcs_arg_constr.data = NULL;
11105 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
11106 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
11107 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
11108 LDKUpdateFulfillHTLC arr_conv_19_conv;
11109 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11110 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11111 if (arr_conv_19_conv.inner != NULL)
11112 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11113 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
11115 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
11116 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
11117 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
11118 if (update_fail_htlcs_arg_constr.datalen > 0)
11119 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11121 update_fail_htlcs_arg_constr.data = NULL;
11122 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
11123 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
11124 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
11125 LDKUpdateFailHTLC arr_conv_16_conv;
11126 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11127 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11128 if (arr_conv_16_conv.inner != NULL)
11129 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11130 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
11132 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
11133 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
11134 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
11135 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
11136 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11138 update_fail_malformed_htlcs_arg_constr.data = NULL;
11139 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
11140 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
11141 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
11142 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11143 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11144 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11145 if (arr_conv_25_conv.inner != NULL)
11146 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11147 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
11149 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
11150 LDKUpdateFee update_fee_arg_conv;
11151 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
11152 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
11153 if (update_fee_arg_conv.inner != NULL)
11154 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
11155 LDKCommitmentSigned commitment_signed_arg_conv;
11156 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
11157 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
11158 if (commitment_signed_arg_conv.inner != NULL)
11159 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
11160 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);
11161 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11162 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11163 long ret_ref = (long)ret_var.inner;
11164 if (ret_var.is_owned) {
11170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11171 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
11172 FREE((void*)this_ptr);
11173 HTLCFailChannelUpdate_free(this_ptr_conv);
11176 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11177 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
11178 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
11179 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
11180 long ret_ref = (long)ret_copy;
11184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11185 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
11186 FREE((void*)this_ptr);
11187 ChannelMessageHandler_free(this_ptr_conv);
11190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11191 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
11192 FREE((void*)this_ptr);
11193 RoutingMessageHandler_free(this_ptr_conv);
11196 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11197 LDKAcceptChannel obj_conv;
11198 obj_conv.inner = (void*)(obj & (~1));
11199 obj_conv.is_owned = (obj & 1) || (obj == 0);
11200 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
11201 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11202 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11203 CVec_u8Z_free(arg_var);
11207 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11208 LDKu8slice ser_ref;
11209 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11210 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11211 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
11212 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11213 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11214 long ret_ref = (long)ret_var.inner;
11215 if (ret_var.is_owned) {
11218 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11222 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
11223 LDKAnnouncementSignatures obj_conv;
11224 obj_conv.inner = (void*)(obj & (~1));
11225 obj_conv.is_owned = (obj & 1) || (obj == 0);
11226 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
11227 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11228 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11229 CVec_u8Z_free(arg_var);
11233 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11234 LDKu8slice ser_ref;
11235 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11236 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11237 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
11238 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11239 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11240 long ret_ref = (long)ret_var.inner;
11241 if (ret_var.is_owned) {
11244 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11248 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
11249 LDKChannelReestablish obj_conv;
11250 obj_conv.inner = (void*)(obj & (~1));
11251 obj_conv.is_owned = (obj & 1) || (obj == 0);
11252 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
11253 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11254 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11255 CVec_u8Z_free(arg_var);
11259 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11260 LDKu8slice ser_ref;
11261 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11262 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11263 LDKChannelReestablish ret_var = ChannelReestablish_read(ser_ref);
11264 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11265 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11266 long ret_ref = (long)ret_var.inner;
11267 if (ret_var.is_owned) {
11270 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11274 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11275 LDKClosingSigned obj_conv;
11276 obj_conv.inner = (void*)(obj & (~1));
11277 obj_conv.is_owned = (obj & 1) || (obj == 0);
11278 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
11279 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11280 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11281 CVec_u8Z_free(arg_var);
11285 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11286 LDKu8slice ser_ref;
11287 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11288 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11289 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
11290 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11291 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11292 long ret_ref = (long)ret_var.inner;
11293 if (ret_var.is_owned) {
11296 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11300 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11301 LDKCommitmentSigned obj_conv;
11302 obj_conv.inner = (void*)(obj & (~1));
11303 obj_conv.is_owned = (obj & 1) || (obj == 0);
11304 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
11305 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11306 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11307 CVec_u8Z_free(arg_var);
11311 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11312 LDKu8slice ser_ref;
11313 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11314 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11315 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
11316 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11317 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11318 long ret_ref = (long)ret_var.inner;
11319 if (ret_var.is_owned) {
11322 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11326 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
11327 LDKFundingCreated obj_conv;
11328 obj_conv.inner = (void*)(obj & (~1));
11329 obj_conv.is_owned = (obj & 1) || (obj == 0);
11330 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
11331 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11332 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11333 CVec_u8Z_free(arg_var);
11337 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11338 LDKu8slice ser_ref;
11339 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11340 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11341 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
11342 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11343 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11344 long ret_ref = (long)ret_var.inner;
11345 if (ret_var.is_owned) {
11348 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11352 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11353 LDKFundingSigned obj_conv;
11354 obj_conv.inner = (void*)(obj & (~1));
11355 obj_conv.is_owned = (obj & 1) || (obj == 0);
11356 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
11357 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11358 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11359 CVec_u8Z_free(arg_var);
11363 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11364 LDKu8slice ser_ref;
11365 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11366 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11367 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
11368 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11369 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11370 long ret_ref = (long)ret_var.inner;
11371 if (ret_var.is_owned) {
11374 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11378 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
11379 LDKFundingLocked obj_conv;
11380 obj_conv.inner = (void*)(obj & (~1));
11381 obj_conv.is_owned = (obj & 1) || (obj == 0);
11382 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
11383 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11384 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11385 CVec_u8Z_free(arg_var);
11389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11390 LDKu8slice ser_ref;
11391 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11392 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11393 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
11394 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11395 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11396 long ret_ref = (long)ret_var.inner;
11397 if (ret_var.is_owned) {
11400 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11404 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
11406 obj_conv.inner = (void*)(obj & (~1));
11407 obj_conv.is_owned = (obj & 1) || (obj == 0);
11408 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
11409 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11410 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11411 CVec_u8Z_free(arg_var);
11415 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11416 LDKu8slice ser_ref;
11417 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11418 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11419 LDKInit ret_var = Init_read(ser_ref);
11420 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11421 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11422 long ret_ref = (long)ret_var.inner;
11423 if (ret_var.is_owned) {
11426 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11430 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11431 LDKOpenChannel obj_conv;
11432 obj_conv.inner = (void*)(obj & (~1));
11433 obj_conv.is_owned = (obj & 1) || (obj == 0);
11434 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
11435 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11436 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11437 CVec_u8Z_free(arg_var);
11441 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11442 LDKu8slice ser_ref;
11443 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11444 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11445 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
11446 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11447 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11448 long ret_ref = (long)ret_var.inner;
11449 if (ret_var.is_owned) {
11452 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11456 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
11457 LDKRevokeAndACK obj_conv;
11458 obj_conv.inner = (void*)(obj & (~1));
11459 obj_conv.is_owned = (obj & 1) || (obj == 0);
11460 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
11461 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11462 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11463 CVec_u8Z_free(arg_var);
11467 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11468 LDKu8slice ser_ref;
11469 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11470 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11471 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
11472 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11473 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11474 long ret_ref = (long)ret_var.inner;
11475 if (ret_var.is_owned) {
11478 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11482 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
11483 LDKShutdown obj_conv;
11484 obj_conv.inner = (void*)(obj & (~1));
11485 obj_conv.is_owned = (obj & 1) || (obj == 0);
11486 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
11487 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11488 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11489 CVec_u8Z_free(arg_var);
11493 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11494 LDKu8slice ser_ref;
11495 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11496 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11497 LDKShutdown ret_var = Shutdown_read(ser_ref);
11498 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11499 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11500 long ret_ref = (long)ret_var.inner;
11501 if (ret_var.is_owned) {
11504 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11508 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11509 LDKUpdateFailHTLC obj_conv;
11510 obj_conv.inner = (void*)(obj & (~1));
11511 obj_conv.is_owned = (obj & 1) || (obj == 0);
11512 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
11513 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11514 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11515 CVec_u8Z_free(arg_var);
11519 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11520 LDKu8slice ser_ref;
11521 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11522 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11523 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
11524 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11525 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11526 long ret_ref = (long)ret_var.inner;
11527 if (ret_var.is_owned) {
11530 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11534 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11535 LDKUpdateFailMalformedHTLC obj_conv;
11536 obj_conv.inner = (void*)(obj & (~1));
11537 obj_conv.is_owned = (obj & 1) || (obj == 0);
11538 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
11539 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11540 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11541 CVec_u8Z_free(arg_var);
11545 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11546 LDKu8slice ser_ref;
11547 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11548 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11549 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
11550 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11551 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11552 long ret_ref = (long)ret_var.inner;
11553 if (ret_var.is_owned) {
11556 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11560 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
11561 LDKUpdateFee obj_conv;
11562 obj_conv.inner = (void*)(obj & (~1));
11563 obj_conv.is_owned = (obj & 1) || (obj == 0);
11564 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
11565 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11566 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11567 CVec_u8Z_free(arg_var);
11571 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11572 LDKu8slice ser_ref;
11573 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11574 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11575 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
11576 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11577 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11578 long ret_ref = (long)ret_var.inner;
11579 if (ret_var.is_owned) {
11582 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11586 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11587 LDKUpdateFulfillHTLC obj_conv;
11588 obj_conv.inner = (void*)(obj & (~1));
11589 obj_conv.is_owned = (obj & 1) || (obj == 0);
11590 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
11591 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11592 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11593 CVec_u8Z_free(arg_var);
11597 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11598 LDKu8slice ser_ref;
11599 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11600 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11601 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
11602 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11603 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11604 long ret_ref = (long)ret_var.inner;
11605 if (ret_var.is_owned) {
11608 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11612 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11613 LDKUpdateAddHTLC obj_conv;
11614 obj_conv.inner = (void*)(obj & (~1));
11615 obj_conv.is_owned = (obj & 1) || (obj == 0);
11616 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
11617 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11618 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11619 CVec_u8Z_free(arg_var);
11623 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11624 LDKu8slice ser_ref;
11625 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11626 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11627 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
11628 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11629 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11630 long ret_ref = (long)ret_var.inner;
11631 if (ret_var.is_owned) {
11634 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11638 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
11640 obj_conv.inner = (void*)(obj & (~1));
11641 obj_conv.is_owned = (obj & 1) || (obj == 0);
11642 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
11643 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11644 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11645 CVec_u8Z_free(arg_var);
11649 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11650 LDKu8slice ser_ref;
11651 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11652 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11653 LDKPing ret_var = Ping_read(ser_ref);
11654 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11655 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11656 long ret_ref = (long)ret_var.inner;
11657 if (ret_var.is_owned) {
11660 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11664 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
11666 obj_conv.inner = (void*)(obj & (~1));
11667 obj_conv.is_owned = (obj & 1) || (obj == 0);
11668 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
11669 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11670 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11671 CVec_u8Z_free(arg_var);
11675 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11676 LDKu8slice ser_ref;
11677 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11678 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11679 LDKPong ret_var = Pong_read(ser_ref);
11680 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11681 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11682 long ret_ref = (long)ret_var.inner;
11683 if (ret_var.is_owned) {
11686 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11690 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11691 LDKUnsignedChannelAnnouncement obj_conv;
11692 obj_conv.inner = (void*)(obj & (~1));
11693 obj_conv.is_owned = (obj & 1) || (obj == 0);
11694 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
11695 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11696 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11697 CVec_u8Z_free(arg_var);
11701 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11702 LDKu8slice ser_ref;
11703 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11704 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11705 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_read(ser_ref);
11706 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11707 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11708 long ret_ref = (long)ret_var.inner;
11709 if (ret_var.is_owned) {
11712 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11716 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11717 LDKChannelAnnouncement obj_conv;
11718 obj_conv.inner = (void*)(obj & (~1));
11719 obj_conv.is_owned = (obj & 1) || (obj == 0);
11720 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
11721 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11722 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11723 CVec_u8Z_free(arg_var);
11727 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11728 LDKu8slice ser_ref;
11729 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11730 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11731 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
11732 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11733 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11734 long ret_ref = (long)ret_var.inner;
11735 if (ret_var.is_owned) {
11738 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11742 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
11743 LDKUnsignedChannelUpdate obj_conv;
11744 obj_conv.inner = (void*)(obj & (~1));
11745 obj_conv.is_owned = (obj & 1) || (obj == 0);
11746 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
11747 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11748 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11749 CVec_u8Z_free(arg_var);
11753 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11754 LDKu8slice ser_ref;
11755 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11756 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11757 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_read(ser_ref);
11758 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11759 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11760 long ret_ref = (long)ret_var.inner;
11761 if (ret_var.is_owned) {
11764 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11768 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
11769 LDKChannelUpdate obj_conv;
11770 obj_conv.inner = (void*)(obj & (~1));
11771 obj_conv.is_owned = (obj & 1) || (obj == 0);
11772 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
11773 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11774 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11775 CVec_u8Z_free(arg_var);
11779 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11780 LDKu8slice ser_ref;
11781 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11782 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11783 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
11784 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11785 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11786 long ret_ref = (long)ret_var.inner;
11787 if (ret_var.is_owned) {
11790 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11794 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
11795 LDKErrorMessage obj_conv;
11796 obj_conv.inner = (void*)(obj & (~1));
11797 obj_conv.is_owned = (obj & 1) || (obj == 0);
11798 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
11799 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11800 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11801 CVec_u8Z_free(arg_var);
11805 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11806 LDKu8slice ser_ref;
11807 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11808 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11809 LDKErrorMessage ret_var = ErrorMessage_read(ser_ref);
11810 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11811 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11812 long ret_ref = (long)ret_var.inner;
11813 if (ret_var.is_owned) {
11816 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11820 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11821 LDKUnsignedNodeAnnouncement obj_conv;
11822 obj_conv.inner = (void*)(obj & (~1));
11823 obj_conv.is_owned = (obj & 1) || (obj == 0);
11824 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
11825 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11826 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11827 CVec_u8Z_free(arg_var);
11831 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11832 LDKu8slice ser_ref;
11833 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11834 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11835 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_read(ser_ref);
11836 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11837 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11838 long ret_ref = (long)ret_var.inner;
11839 if (ret_var.is_owned) {
11842 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11846 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11847 LDKNodeAnnouncement obj_conv;
11848 obj_conv.inner = (void*)(obj & (~1));
11849 obj_conv.is_owned = (obj & 1) || (obj == 0);
11850 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
11851 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11852 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11853 CVec_u8Z_free(arg_var);
11857 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11858 LDKu8slice ser_ref;
11859 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11860 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11861 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
11862 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11863 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11864 long ret_ref = (long)ret_var.inner;
11865 if (ret_var.is_owned) {
11868 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11872 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11873 LDKu8slice ser_ref;
11874 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11875 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11876 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_read(ser_ref);
11877 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11878 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11879 long ret_ref = (long)ret_var.inner;
11880 if (ret_var.is_owned) {
11883 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11887 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
11888 LDKQueryShortChannelIds obj_conv;
11889 obj_conv.inner = (void*)(obj & (~1));
11890 obj_conv.is_owned = (obj & 1) || (obj == 0);
11891 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
11892 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11893 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11894 CVec_u8Z_free(arg_var);
11898 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11899 LDKu8slice ser_ref;
11900 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11901 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11902 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_read(ser_ref);
11903 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11904 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11905 long ret_ref = (long)ret_var.inner;
11906 if (ret_var.is_owned) {
11909 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11913 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
11914 LDKReplyShortChannelIdsEnd obj_conv;
11915 obj_conv.inner = (void*)(obj & (~1));
11916 obj_conv.is_owned = (obj & 1) || (obj == 0);
11917 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
11918 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11919 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11920 CVec_u8Z_free(arg_var);
11924 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11925 LDKu8slice ser_ref;
11926 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11927 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11928 LDKQueryChannelRange ret_var = QueryChannelRange_read(ser_ref);
11929 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11930 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11931 long ret_ref = (long)ret_var.inner;
11932 if (ret_var.is_owned) {
11935 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11939 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
11940 LDKQueryChannelRange obj_conv;
11941 obj_conv.inner = (void*)(obj & (~1));
11942 obj_conv.is_owned = (obj & 1) || (obj == 0);
11943 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
11944 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11945 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11946 CVec_u8Z_free(arg_var);
11950 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11951 LDKu8slice ser_ref;
11952 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11953 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11954 LDKReplyChannelRange ret_var = ReplyChannelRange_read(ser_ref);
11955 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11956 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11957 long ret_ref = (long)ret_var.inner;
11958 if (ret_var.is_owned) {
11961 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11965 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
11966 LDKReplyChannelRange obj_conv;
11967 obj_conv.inner = (void*)(obj & (~1));
11968 obj_conv.is_owned = (obj & 1) || (obj == 0);
11969 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
11970 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11971 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11972 CVec_u8Z_free(arg_var);
11976 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11977 LDKu8slice ser_ref;
11978 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11979 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11980 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_read(ser_ref);
11981 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11982 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11983 long ret_ref = (long)ret_var.inner;
11984 if (ret_var.is_owned) {
11987 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11991 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
11992 LDKGossipTimestampFilter obj_conv;
11993 obj_conv.inner = (void*)(obj & (~1));
11994 obj_conv.is_owned = (obj & 1) || (obj == 0);
11995 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
11996 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11997 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11998 CVec_u8Z_free(arg_var);
12002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12003 LDKMessageHandler this_ptr_conv;
12004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12005 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12006 MessageHandler_free(this_ptr_conv);
12009 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(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 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
12017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12018 LDKMessageHandler this_ptr_conv;
12019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12020 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12021 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
12022 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
12023 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12024 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
12026 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
12029 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12030 LDKMessageHandler this_ptr_conv;
12031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12032 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12033 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
12037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12038 LDKMessageHandler this_ptr_conv;
12039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12040 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12041 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
12042 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12043 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12044 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
12046 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
12049 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
12050 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
12051 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
12052 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12053 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
12055 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
12056 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12057 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12058 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
12060 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
12061 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12062 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12063 long ret_ref = (long)ret_var.inner;
12064 if (ret_var.is_owned) {
12070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12071 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
12072 FREE((void*)this_ptr);
12073 SocketDescriptor_free(this_ptr_conv);
12076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12077 LDKPeerHandleError this_ptr_conv;
12078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12079 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12080 PeerHandleError_free(this_ptr_conv);
12083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(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 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
12091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12092 LDKPeerHandleError this_ptr_conv;
12093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12094 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12095 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
12098 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
12099 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
12100 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12101 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12102 long ret_ref = (long)ret_var.inner;
12103 if (ret_var.is_owned) {
12109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12110 LDKPeerManager this_ptr_conv;
12111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12112 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12113 PeerManager_free(this_ptr_conv);
12116 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) {
12117 LDKMessageHandler message_handler_conv;
12118 message_handler_conv.inner = (void*)(message_handler & (~1));
12119 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
12120 // Warning: we may need a move here but can't clone!
12121 LDKSecretKey our_node_secret_ref;
12122 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
12123 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
12124 unsigned char ephemeral_random_data_arr[32];
12125 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
12126 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
12127 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
12128 LDKLogger logger_conv = *(LDKLogger*)logger;
12129 if (logger_conv.free == LDKLogger_JCalls_free) {
12130 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12131 LDKLogger_JCalls_clone(logger_conv.this_arg);
12133 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
12134 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12135 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12136 long ret_ref = (long)ret_var.inner;
12137 if (ret_var.is_owned) {
12143 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
12144 LDKPeerManager this_arg_conv;
12145 this_arg_conv.inner = (void*)(this_arg & (~1));
12146 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12147 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
12148 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, NULL, NULL);
12149 for (size_t i = 0; i < ret_var.datalen; i++) {
12150 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
12151 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
12152 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
12154 CVec_PublicKeyZ_free(ret_var);
12158 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) {
12159 LDKPeerManager this_arg_conv;
12160 this_arg_conv.inner = (void*)(this_arg & (~1));
12161 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12162 LDKPublicKey their_node_id_ref;
12163 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
12164 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12165 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12166 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12167 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12168 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12170 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
12171 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
12172 return (long)ret_conv;
12175 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12176 LDKPeerManager this_arg_conv;
12177 this_arg_conv.inner = (void*)(this_arg & (~1));
12178 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12179 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12180 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12181 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12182 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12184 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12185 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
12186 return (long)ret_conv;
12189 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12190 LDKPeerManager this_arg_conv;
12191 this_arg_conv.inner = (void*)(this_arg & (~1));
12192 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12193 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12194 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12195 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
12196 return (long)ret_conv;
12199 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
12200 LDKPeerManager this_arg_conv;
12201 this_arg_conv.inner = (void*)(this_arg & (~1));
12202 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12203 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
12204 LDKu8slice data_ref;
12205 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
12206 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
12207 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12208 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
12209 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
12210 return (long)ret_conv;
12213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
12214 LDKPeerManager this_arg_conv;
12215 this_arg_conv.inner = (void*)(this_arg & (~1));
12216 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12217 PeerManager_process_events(&this_arg_conv);
12220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
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 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12225 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
12228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
12229 LDKPeerManager this_arg_conv;
12230 this_arg_conv.inner = (void*)(this_arg & (~1));
12231 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12232 PeerManager_timer_tick_occured(&this_arg_conv);
12235 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
12236 unsigned char commitment_seed_arr[32];
12237 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
12238 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
12239 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
12240 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
12241 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
12245 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
12246 LDKPublicKey per_commitment_point_ref;
12247 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12248 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12249 unsigned char base_secret_arr[32];
12250 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
12251 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
12252 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
12253 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12254 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
12255 return (long)ret_conv;
12258 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
12259 LDKPublicKey per_commitment_point_ref;
12260 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12261 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12262 LDKPublicKey base_point_ref;
12263 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
12264 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
12265 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12266 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
12267 return (long)ret_conv;
12270 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) {
12271 unsigned char per_commitment_secret_arr[32];
12272 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
12273 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
12274 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
12275 unsigned char countersignatory_revocation_base_secret_arr[32];
12276 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
12277 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
12278 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
12279 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12280 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
12281 return (long)ret_conv;
12284 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) {
12285 LDKPublicKey per_commitment_point_ref;
12286 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12287 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12288 LDKPublicKey countersignatory_revocation_base_point_ref;
12289 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
12290 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
12291 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12292 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
12293 return (long)ret_conv;
12296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12297 LDKTxCreationKeys this_ptr_conv;
12298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12299 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12300 TxCreationKeys_free(this_ptr_conv);
12303 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12304 LDKTxCreationKeys orig_conv;
12305 orig_conv.inner = (void*)(orig & (~1));
12306 orig_conv.is_owned = (orig & 1) || (orig == 0);
12307 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
12308 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12309 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12310 long ret_ref = (long)ret_var.inner;
12311 if (ret_var.is_owned) {
12317 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12318 LDKTxCreationKeys this_ptr_conv;
12319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12320 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12321 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12322 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
12326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12327 LDKTxCreationKeys this_ptr_conv;
12328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12329 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12330 LDKPublicKey val_ref;
12331 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12332 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12333 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
12336 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12337 LDKTxCreationKeys this_ptr_conv;
12338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12339 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12340 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12341 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
12345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12346 LDKTxCreationKeys this_ptr_conv;
12347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12348 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12349 LDKPublicKey val_ref;
12350 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12351 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12352 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
12355 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12356 LDKTxCreationKeys this_ptr_conv;
12357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12358 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12359 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12360 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
12364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12365 LDKTxCreationKeys this_ptr_conv;
12366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12367 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12368 LDKPublicKey val_ref;
12369 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12370 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12371 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
12374 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12375 LDKTxCreationKeys this_ptr_conv;
12376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12377 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12378 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12379 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
12383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12384 LDKTxCreationKeys this_ptr_conv;
12385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12387 LDKPublicKey val_ref;
12388 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12389 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12390 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
12393 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12394 LDKTxCreationKeys this_ptr_conv;
12395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12396 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12397 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12398 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
12402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12403 LDKTxCreationKeys this_ptr_conv;
12404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12405 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12406 LDKPublicKey val_ref;
12407 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12408 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12409 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
12412 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) {
12413 LDKPublicKey per_commitment_point_arg_ref;
12414 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
12415 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
12416 LDKPublicKey revocation_key_arg_ref;
12417 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
12418 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
12419 LDKPublicKey broadcaster_htlc_key_arg_ref;
12420 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
12421 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
12422 LDKPublicKey countersignatory_htlc_key_arg_ref;
12423 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
12424 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
12425 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
12426 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
12427 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
12428 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);
12429 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12430 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12431 long ret_ref = (long)ret_var.inner;
12432 if (ret_var.is_owned) {
12438 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12439 LDKTxCreationKeys obj_conv;
12440 obj_conv.inner = (void*)(obj & (~1));
12441 obj_conv.is_owned = (obj & 1) || (obj == 0);
12442 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
12443 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12444 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12445 CVec_u8Z_free(arg_var);
12449 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12450 LDKu8slice ser_ref;
12451 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12452 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12453 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
12454 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12455 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12456 long ret_ref = (long)ret_var.inner;
12457 if (ret_var.is_owned) {
12460 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12465 LDKPreCalculatedTxCreationKeys this_ptr_conv;
12466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12467 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12468 PreCalculatedTxCreationKeys_free(this_ptr_conv);
12471 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
12472 LDKTxCreationKeys keys_conv;
12473 keys_conv.inner = (void*)(keys & (~1));
12474 keys_conv.is_owned = (keys & 1) || (keys == 0);
12475 if (keys_conv.inner != NULL)
12476 keys_conv = TxCreationKeys_clone(&keys_conv);
12477 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_new(keys_conv);
12478 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12479 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12480 long ret_ref = (long)ret_var.inner;
12481 if (ret_var.is_owned) {
12487 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
12488 LDKPreCalculatedTxCreationKeys this_arg_conv;
12489 this_arg_conv.inner = (void*)(this_arg & (~1));
12490 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12491 LDKTxCreationKeys ret_var = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
12492 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12493 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12494 long ret_ref = (long)ret_var.inner;
12495 if (ret_var.is_owned) {
12501 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
12502 LDKPreCalculatedTxCreationKeys this_arg_conv;
12503 this_arg_conv.inner = (void*)(this_arg & (~1));
12504 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12505 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12506 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
12510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12511 LDKChannelPublicKeys this_ptr_conv;
12512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12513 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12514 ChannelPublicKeys_free(this_ptr_conv);
12517 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12518 LDKChannelPublicKeys orig_conv;
12519 orig_conv.inner = (void*)(orig & (~1));
12520 orig_conv.is_owned = (orig & 1) || (orig == 0);
12521 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
12522 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12523 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12524 long ret_ref = (long)ret_var.inner;
12525 if (ret_var.is_owned) {
12531 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
12532 LDKChannelPublicKeys this_ptr_conv;
12533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12534 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12535 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12536 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
12540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12541 LDKChannelPublicKeys this_ptr_conv;
12542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12544 LDKPublicKey val_ref;
12545 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12546 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12547 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
12550 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12551 LDKChannelPublicKeys this_ptr_conv;
12552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12554 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12555 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
12559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12560 LDKChannelPublicKeys this_ptr_conv;
12561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12562 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12563 LDKPublicKey val_ref;
12564 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12565 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12566 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
12569 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12570 LDKChannelPublicKeys this_ptr_conv;
12571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12572 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12573 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12574 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
12578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12579 LDKChannelPublicKeys this_ptr_conv;
12580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12582 LDKPublicKey val_ref;
12583 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12584 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12585 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
12588 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12589 LDKChannelPublicKeys this_ptr_conv;
12590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12591 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12592 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12593 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
12597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12598 LDKChannelPublicKeys this_ptr_conv;
12599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12600 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12601 LDKPublicKey val_ref;
12602 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12603 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12604 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12607 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12608 LDKChannelPublicKeys this_ptr_conv;
12609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12610 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12611 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12612 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
12616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12617 LDKChannelPublicKeys this_ptr_conv;
12618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12619 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12620 LDKPublicKey val_ref;
12621 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12622 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12623 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
12626 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) {
12627 LDKPublicKey funding_pubkey_arg_ref;
12628 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
12629 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
12630 LDKPublicKey revocation_basepoint_arg_ref;
12631 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
12632 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
12633 LDKPublicKey payment_point_arg_ref;
12634 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
12635 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
12636 LDKPublicKey delayed_payment_basepoint_arg_ref;
12637 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
12638 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
12639 LDKPublicKey htlc_basepoint_arg_ref;
12640 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
12641 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
12642 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);
12643 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12644 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12645 long ret_ref = (long)ret_var.inner;
12646 if (ret_var.is_owned) {
12652 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12653 LDKChannelPublicKeys obj_conv;
12654 obj_conv.inner = (void*)(obj & (~1));
12655 obj_conv.is_owned = (obj & 1) || (obj == 0);
12656 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
12657 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12658 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12659 CVec_u8Z_free(arg_var);
12663 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12664 LDKu8slice ser_ref;
12665 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12666 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12667 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
12668 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12669 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12670 long ret_ref = (long)ret_var.inner;
12671 if (ret_var.is_owned) {
12674 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12678 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) {
12679 LDKPublicKey per_commitment_point_ref;
12680 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12681 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12682 LDKPublicKey broadcaster_delayed_payment_base_ref;
12683 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
12684 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
12685 LDKPublicKey broadcaster_htlc_base_ref;
12686 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
12687 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
12688 LDKPublicKey countersignatory_revocation_base_ref;
12689 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
12690 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
12691 LDKPublicKey countersignatory_htlc_base_ref;
12692 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
12693 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
12694 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
12695 *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);
12696 return (long)ret_conv;
12699 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) {
12700 LDKPublicKey revocation_key_ref;
12701 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
12702 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
12703 LDKPublicKey broadcaster_delayed_payment_key_ref;
12704 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
12705 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
12706 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
12707 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12708 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12709 CVec_u8Z_free(arg_var);
12713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12714 LDKHTLCOutputInCommitment this_ptr_conv;
12715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12717 HTLCOutputInCommitment_free(this_ptr_conv);
12720 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12721 LDKHTLCOutputInCommitment orig_conv;
12722 orig_conv.inner = (void*)(orig & (~1));
12723 orig_conv.is_owned = (orig & 1) || (orig == 0);
12724 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
12725 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12726 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12727 long ret_ref = (long)ret_var.inner;
12728 if (ret_var.is_owned) {
12734 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
12735 LDKHTLCOutputInCommitment this_ptr_conv;
12736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12738 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
12742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12743 LDKHTLCOutputInCommitment this_ptr_conv;
12744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12745 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12746 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
12749 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
12757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12758 LDKHTLCOutputInCommitment this_ptr_conv;
12759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12760 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12761 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
12764 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
12772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12773 LDKHTLCOutputInCommitment this_ptr_conv;
12774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12776 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
12779 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12784 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
12788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12789 LDKHTLCOutputInCommitment this_ptr_conv;
12790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12791 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12792 LDKThirtyTwoBytes val_ref;
12793 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12794 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12795 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
12798 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
12799 LDKHTLCOutputInCommitment obj_conv;
12800 obj_conv.inner = (void*)(obj & (~1));
12801 obj_conv.is_owned = (obj & 1) || (obj == 0);
12802 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
12803 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12804 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12805 CVec_u8Z_free(arg_var);
12809 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12810 LDKu8slice ser_ref;
12811 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12812 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12813 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
12814 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12815 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12816 long ret_ref = (long)ret_var.inner;
12817 if (ret_var.is_owned) {
12820 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12824 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
12825 LDKHTLCOutputInCommitment htlc_conv;
12826 htlc_conv.inner = (void*)(htlc & (~1));
12827 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
12828 LDKTxCreationKeys keys_conv;
12829 keys_conv.inner = (void*)(keys & (~1));
12830 keys_conv.is_owned = (keys & 1) || (keys == 0);
12831 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
12832 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12833 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12834 CVec_u8Z_free(arg_var);
12838 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
12839 LDKPublicKey broadcaster_ref;
12840 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
12841 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
12842 LDKPublicKey countersignatory_ref;
12843 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
12844 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
12845 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
12846 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12847 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12848 CVec_u8Z_free(arg_var);
12852 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) {
12853 unsigned char prev_hash_arr[32];
12854 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
12855 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
12856 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
12857 LDKHTLCOutputInCommitment htlc_conv;
12858 htlc_conv.inner = (void*)(htlc & (~1));
12859 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
12860 LDKPublicKey broadcaster_delayed_payment_key_ref;
12861 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
12862 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
12863 LDKPublicKey revocation_key_ref;
12864 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
12865 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
12866 LDKTransaction *ret_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
12867 *ret_copy = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
12868 long ret_ref = (long)ret_copy;
12872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12873 LDKHolderCommitmentTransaction this_ptr_conv;
12874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12875 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12876 HolderCommitmentTransaction_free(this_ptr_conv);
12879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12880 LDKHolderCommitmentTransaction orig_conv;
12881 orig_conv.inner = (void*)(orig & (~1));
12882 orig_conv.is_owned = (orig & 1) || (orig == 0);
12883 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
12884 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12885 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12886 long ret_ref = (long)ret_var.inner;
12887 if (ret_var.is_owned) {
12893 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
12894 LDKHolderCommitmentTransaction this_ptr_conv;
12895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12896 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12897 LDKTransaction *ret_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
12898 *ret_copy = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
12899 long ret_ref = (long)ret_copy;
12903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12904 LDKHolderCommitmentTransaction this_ptr_conv;
12905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12906 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12907 LDKTransaction val_conv = *(LDKTransaction*)val;
12908 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
12911 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
12912 LDKHolderCommitmentTransaction this_ptr_conv;
12913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12914 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12915 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
12916 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
12920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12921 LDKHolderCommitmentTransaction this_ptr_conv;
12922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12923 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12924 LDKSignature val_ref;
12925 CHECK((*_env)->GetArrayLength (_env, val) == 64);
12926 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
12927 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
12930 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
12931 LDKHolderCommitmentTransaction this_ptr_conv;
12932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12933 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12934 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
12938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12939 LDKHolderCommitmentTransaction this_ptr_conv;
12940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12941 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12942 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
12945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray 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 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_constr;
12950 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12951 if (val_constr.datalen > 0)
12952 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
12954 val_constr.data = NULL;
12955 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
12956 for (size_t q = 0; q < val_constr.datalen; q++) {
12957 long arr_conv_42 = val_vals[q];
12958 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
12959 FREE((void*)arr_conv_42);
12960 val_constr.data[q] = arr_conv_42_conv;
12962 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
12963 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_constr);
12966 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) {
12967 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
12968 LDKSignature counterparty_sig_ref;
12969 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
12970 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
12971 LDKPublicKey holder_funding_key_ref;
12972 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
12973 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
12974 LDKPublicKey counterparty_funding_key_ref;
12975 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
12976 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
12977 LDKTxCreationKeys keys_conv;
12978 keys_conv.inner = (void*)(keys & (~1));
12979 keys_conv.is_owned = (keys & 1) || (keys == 0);
12980 if (keys_conv.inner != NULL)
12981 keys_conv = TxCreationKeys_clone(&keys_conv);
12982 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_constr;
12983 htlc_data_constr.datalen = (*_env)->GetArrayLength (_env, htlc_data);
12984 if (htlc_data_constr.datalen > 0)
12985 htlc_data_constr.data = MALLOC(htlc_data_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
12987 htlc_data_constr.data = NULL;
12988 long* htlc_data_vals = (*_env)->GetLongArrayElements (_env, htlc_data, NULL);
12989 for (size_t q = 0; q < htlc_data_constr.datalen; q++) {
12990 long arr_conv_42 = htlc_data_vals[q];
12991 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
12992 FREE((void*)arr_conv_42);
12993 htlc_data_constr.data[q] = arr_conv_42_conv;
12995 (*_env)->ReleaseLongArrayElements (_env, htlc_data, htlc_data_vals, 0);
12996 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);
12997 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12998 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12999 long ret_ref = (long)ret_var.inner;
13000 if (ret_var.is_owned) {
13006 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
13007 LDKHolderCommitmentTransaction this_arg_conv;
13008 this_arg_conv.inner = (void*)(this_arg & (~1));
13009 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13010 LDKTxCreationKeys ret_var = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
13011 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13012 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13013 long ret_ref = (long)ret_var.inner;
13014 if (ret_var.is_owned) {
13020 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
13021 LDKHolderCommitmentTransaction this_arg_conv;
13022 this_arg_conv.inner = (void*)(this_arg & (~1));
13023 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13024 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
13025 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
13029 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) {
13030 LDKHolderCommitmentTransaction this_arg_conv;
13031 this_arg_conv.inner = (void*)(this_arg & (~1));
13032 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13033 unsigned char funding_key_arr[32];
13034 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
13035 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
13036 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
13037 LDKu8slice funding_redeemscript_ref;
13038 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
13039 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
13040 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
13041 (*_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);
13042 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
13046 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) {
13047 LDKHolderCommitmentTransaction this_arg_conv;
13048 this_arg_conv.inner = (void*)(this_arg & (~1));
13049 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13050 unsigned char htlc_base_key_arr[32];
13051 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
13052 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
13053 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
13054 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
13055 *ret_conv = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
13056 return (long)ret_conv;
13059 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
13060 LDKHolderCommitmentTransaction obj_conv;
13061 obj_conv.inner = (void*)(obj & (~1));
13062 obj_conv.is_owned = (obj & 1) || (obj == 0);
13063 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
13064 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13065 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13066 CVec_u8Z_free(arg_var);
13070 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13071 LDKu8slice ser_ref;
13072 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13073 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13074 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
13075 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13076 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13077 long ret_ref = (long)ret_var.inner;
13078 if (ret_var.is_owned) {
13081 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13086 LDKInitFeatures this_ptr_conv;
13087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13088 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13089 InitFeatures_free(this_ptr_conv);
13092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13093 LDKNodeFeatures 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 NodeFeatures_free(this_ptr_conv);
13099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13100 LDKChannelFeatures 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 ChannelFeatures_free(this_ptr_conv);
13106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13107 LDKRouteHop 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 RouteHop_free(this_ptr_conv);
13113 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13114 LDKRouteHop orig_conv;
13115 orig_conv.inner = (void*)(orig & (~1));
13116 orig_conv.is_owned = (orig & 1) || (orig == 0);
13117 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
13118 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13119 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13120 long ret_ref = (long)ret_var.inner;
13121 if (ret_var.is_owned) {
13127 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
13128 LDKRouteHop this_ptr_conv;
13129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13130 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13131 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13132 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
13136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13137 LDKRouteHop this_ptr_conv;
13138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13139 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13140 LDKPublicKey val_ref;
13141 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13142 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13143 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
13146 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13147 LDKRouteHop this_ptr_conv;
13148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13149 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13150 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
13151 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13152 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13153 long ret_ref = (long)ret_var.inner;
13154 if (ret_var.is_owned) {
13160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13161 LDKRouteHop this_ptr_conv;
13162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13163 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13164 LDKNodeFeatures val_conv;
13165 val_conv.inner = (void*)(val & (~1));
13166 val_conv.is_owned = (val & 1) || (val == 0);
13167 // Warning: we may need a move here but can't clone!
13168 RouteHop_set_node_features(&this_ptr_conv, val_conv);
13171 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13172 LDKRouteHop this_ptr_conv;
13173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13174 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13175 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
13179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13180 LDKRouteHop this_ptr_conv;
13181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13182 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13183 RouteHop_set_short_channel_id(&this_ptr_conv, val);
13186 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
13191 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13192 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13193 long ret_ref = (long)ret_var.inner;
13194 if (ret_var.is_owned) {
13200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13201 LDKRouteHop this_ptr_conv;
13202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13203 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13204 LDKChannelFeatures val_conv;
13205 val_conv.inner = (void*)(val & (~1));
13206 val_conv.is_owned = (val & 1) || (val == 0);
13207 // Warning: we may need a move here but can't clone!
13208 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
13211 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13212 LDKRouteHop this_ptr_conv;
13213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13214 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13215 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
13219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13220 LDKRouteHop this_ptr_conv;
13221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13222 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13223 RouteHop_set_fee_msat(&this_ptr_conv, val);
13226 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
13234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13235 LDKRouteHop this_ptr_conv;
13236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13237 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13238 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
13241 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) {
13242 LDKPublicKey pubkey_arg_ref;
13243 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
13244 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
13245 LDKNodeFeatures node_features_arg_conv;
13246 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
13247 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
13248 // Warning: we may need a move here but can't clone!
13249 LDKChannelFeatures channel_features_arg_conv;
13250 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
13251 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
13252 // Warning: we may need a move here but can't clone!
13253 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);
13254 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13255 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13256 long ret_ref = (long)ret_var.inner;
13257 if (ret_var.is_owned) {
13263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13264 LDKRoute this_ptr_conv;
13265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13266 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13267 Route_free(this_ptr_conv);
13270 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13271 LDKRoute orig_conv;
13272 orig_conv.inner = (void*)(orig & (~1));
13273 orig_conv.is_owned = (orig & 1) || (orig == 0);
13274 LDKRoute ret_var = Route_clone(&orig_conv);
13275 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13276 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13277 long ret_ref = (long)ret_var.inner;
13278 if (ret_var.is_owned) {
13284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
13285 LDKRoute this_ptr_conv;
13286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13288 LDKCVec_CVec_RouteHopZZ val_constr;
13289 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13290 if (val_constr.datalen > 0)
13291 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13293 val_constr.data = NULL;
13294 for (size_t m = 0; m < val_constr.datalen; m++) {
13295 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
13296 LDKCVec_RouteHopZ arr_conv_12_constr;
13297 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13298 if (arr_conv_12_constr.datalen > 0)
13299 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13301 arr_conv_12_constr.data = NULL;
13302 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13303 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13304 long arr_conv_10 = arr_conv_12_vals[k];
13305 LDKRouteHop arr_conv_10_conv;
13306 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13307 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13308 if (arr_conv_10_conv.inner != NULL)
13309 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13310 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13312 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13313 val_constr.data[m] = arr_conv_12_constr;
13315 Route_set_paths(&this_ptr_conv, val_constr);
13318 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
13319 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
13320 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
13321 if (paths_arg_constr.datalen > 0)
13322 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13324 paths_arg_constr.data = NULL;
13325 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
13326 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
13327 LDKCVec_RouteHopZ arr_conv_12_constr;
13328 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13329 if (arr_conv_12_constr.datalen > 0)
13330 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13332 arr_conv_12_constr.data = NULL;
13333 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13334 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13335 long arr_conv_10 = arr_conv_12_vals[k];
13336 LDKRouteHop arr_conv_10_conv;
13337 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13338 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13339 if (arr_conv_10_conv.inner != NULL)
13340 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13341 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13343 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13344 paths_arg_constr.data[m] = arr_conv_12_constr;
13346 LDKRoute ret_var = Route_new(paths_arg_constr);
13347 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13348 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13349 long ret_ref = (long)ret_var.inner;
13350 if (ret_var.is_owned) {
13356 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
13358 obj_conv.inner = (void*)(obj & (~1));
13359 obj_conv.is_owned = (obj & 1) || (obj == 0);
13360 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
13361 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13362 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13363 CVec_u8Z_free(arg_var);
13367 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13368 LDKu8slice ser_ref;
13369 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13370 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13371 LDKRoute ret_var = Route_read(ser_ref);
13372 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13373 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13374 long ret_ref = (long)ret_var.inner;
13375 if (ret_var.is_owned) {
13378 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13383 LDKRouteHint this_ptr_conv;
13384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13385 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13386 RouteHint_free(this_ptr_conv);
13389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13390 LDKRouteHint orig_conv;
13391 orig_conv.inner = (void*)(orig & (~1));
13392 orig_conv.is_owned = (orig & 1) || (orig == 0);
13393 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
13394 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13395 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13396 long ret_ref = (long)ret_var.inner;
13397 if (ret_var.is_owned) {
13403 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13404 LDKRouteHint this_ptr_conv;
13405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13406 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13407 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13408 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
13412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13413 LDKRouteHint this_ptr_conv;
13414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13415 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13416 LDKPublicKey val_ref;
13417 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13418 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13419 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
13422 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13423 LDKRouteHint this_ptr_conv;
13424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13425 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13426 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
13430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13431 LDKRouteHint this_ptr_conv;
13432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13433 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13434 RouteHint_set_short_channel_id(&this_ptr_conv, val);
13437 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
13442 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13443 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13444 long ret_ref = (long)ret_var.inner;
13445 if (ret_var.is_owned) {
13451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13452 LDKRouteHint this_ptr_conv;
13453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13454 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13455 LDKRoutingFees val_conv;
13456 val_conv.inner = (void*)(val & (~1));
13457 val_conv.is_owned = (val & 1) || (val == 0);
13458 if (val_conv.inner != NULL)
13459 val_conv = RoutingFees_clone(&val_conv);
13460 RouteHint_set_fees(&this_ptr_conv, val_conv);
13463 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13464 LDKRouteHint this_ptr_conv;
13465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13467 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
13471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13472 LDKRouteHint this_ptr_conv;
13473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13474 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13475 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
13478 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
13486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13487 LDKRouteHint this_ptr_conv;
13488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13489 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13490 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
13493 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) {
13494 LDKPublicKey src_node_id_arg_ref;
13495 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
13496 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
13497 LDKRoutingFees fees_arg_conv;
13498 fees_arg_conv.inner = (void*)(fees_arg & (~1));
13499 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
13500 if (fees_arg_conv.inner != NULL)
13501 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
13502 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);
13503 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13504 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13505 long ret_ref = (long)ret_var.inner;
13506 if (ret_var.is_owned) {
13512 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) {
13513 LDKPublicKey our_node_id_ref;
13514 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
13515 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
13516 LDKNetworkGraph network_conv;
13517 network_conv.inner = (void*)(network & (~1));
13518 network_conv.is_owned = (network & 1) || (network == 0);
13519 LDKPublicKey target_ref;
13520 CHECK((*_env)->GetArrayLength (_env, target) == 33);
13521 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
13522 LDKCVec_ChannelDetailsZ first_hops_constr;
13523 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
13524 if (first_hops_constr.datalen > 0)
13525 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13527 first_hops_constr.data = NULL;
13528 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
13529 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13530 long arr_conv_16 = first_hops_vals[q];
13531 LDKChannelDetails arr_conv_16_conv;
13532 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13533 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13534 first_hops_constr.data[q] = arr_conv_16_conv;
13536 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
13537 LDKCVec_RouteHintZ last_hops_constr;
13538 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
13539 if (last_hops_constr.datalen > 0)
13540 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13542 last_hops_constr.data = NULL;
13543 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
13544 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
13545 long arr_conv_11 = last_hops_vals[l];
13546 LDKRouteHint arr_conv_11_conv;
13547 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
13548 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
13549 if (arr_conv_11_conv.inner != NULL)
13550 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
13551 last_hops_constr.data[l] = arr_conv_11_conv;
13553 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
13554 LDKLogger logger_conv = *(LDKLogger*)logger;
13555 if (logger_conv.free == LDKLogger_JCalls_free) {
13556 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13557 LDKLogger_JCalls_clone(logger_conv.this_arg);
13559 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13560 *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);
13561 FREE(first_hops_constr.data);
13562 return (long)ret_conv;
13565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13566 LDKNetworkGraph this_ptr_conv;
13567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13569 NetworkGraph_free(this_ptr_conv);
13572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13573 LDKLockedNetworkGraph 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 LockedNetworkGraph_free(this_ptr_conv);
13579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13580 LDKNetGraphMsgHandler 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 NetGraphMsgHandler_free(this_ptr_conv);
13586 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
13587 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13588 LDKLogger logger_conv = *(LDKLogger*)logger;
13589 if (logger_conv.free == LDKLogger_JCalls_free) {
13590 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13591 LDKLogger_JCalls_clone(logger_conv.this_arg);
13593 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
13594 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13595 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13596 long ret_ref = (long)ret_var.inner;
13597 if (ret_var.is_owned) {
13603 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
13604 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13605 LDKLogger logger_conv = *(LDKLogger*)logger;
13606 if (logger_conv.free == LDKLogger_JCalls_free) {
13607 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13608 LDKLogger_JCalls_clone(logger_conv.this_arg);
13610 LDKNetworkGraph network_graph_conv;
13611 network_graph_conv.inner = (void*)(network_graph & (~1));
13612 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
13613 // Warning: we may need a move here but can't clone!
13614 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
13615 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13616 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13617 long ret_ref = (long)ret_var.inner;
13618 if (ret_var.is_owned) {
13624 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13625 LDKNetGraphMsgHandler this_arg_conv;
13626 this_arg_conv.inner = (void*)(this_arg & (~1));
13627 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13628 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
13629 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13630 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13631 long ret_ref = (long)ret_var.inner;
13632 if (ret_var.is_owned) {
13638 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13639 LDKLockedNetworkGraph this_arg_conv;
13640 this_arg_conv.inner = (void*)(this_arg & (~1));
13641 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13642 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
13643 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13644 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13645 long ret_ref = (long)ret_var.inner;
13646 if (ret_var.is_owned) {
13652 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
13653 LDKNetGraphMsgHandler this_arg_conv;
13654 this_arg_conv.inner = (void*)(this_arg & (~1));
13655 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13656 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13657 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
13661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13662 LDKDirectionalChannelInfo this_ptr_conv;
13663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13664 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13665 DirectionalChannelInfo_free(this_ptr_conv);
13668 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(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 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
13676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13677 LDKDirectionalChannelInfo this_ptr_conv;
13678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13679 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13680 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
13683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
13691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
13692 LDKDirectionalChannelInfo this_ptr_conv;
13693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13694 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13695 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
13698 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
13706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13707 LDKDirectionalChannelInfo this_ptr_conv;
13708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13710 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
13713 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
13721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13722 LDKDirectionalChannelInfo this_ptr_conv;
13723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13724 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13725 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
13728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
13733 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13734 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13735 long ret_ref = (long)ret_var.inner;
13736 if (ret_var.is_owned) {
13742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13743 LDKDirectionalChannelInfo this_ptr_conv;
13744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13745 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13746 LDKChannelUpdate val_conv;
13747 val_conv.inner = (void*)(val & (~1));
13748 val_conv.is_owned = (val & 1) || (val == 0);
13749 if (val_conv.inner != NULL)
13750 val_conv = ChannelUpdate_clone(&val_conv);
13751 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
13754 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13755 LDKDirectionalChannelInfo obj_conv;
13756 obj_conv.inner = (void*)(obj & (~1));
13757 obj_conv.is_owned = (obj & 1) || (obj == 0);
13758 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
13759 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13760 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13761 CVec_u8Z_free(arg_var);
13765 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13766 LDKu8slice ser_ref;
13767 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13768 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13769 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
13770 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13771 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13772 long ret_ref = (long)ret_var.inner;
13773 if (ret_var.is_owned) {
13776 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13781 LDKChannelInfo this_ptr_conv;
13782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13783 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13784 ChannelInfo_free(this_ptr_conv);
13787 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(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 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
13792 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13793 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13794 long ret_ref = (long)ret_var.inner;
13795 if (ret_var.is_owned) {
13801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13802 LDKChannelInfo this_ptr_conv;
13803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13804 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13805 LDKChannelFeatures val_conv;
13806 val_conv.inner = (void*)(val & (~1));
13807 val_conv.is_owned = (val & 1) || (val == 0);
13808 // Warning: we may need a move here but can't clone!
13809 ChannelInfo_set_features(&this_ptr_conv, val_conv);
13812 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
13813 LDKChannelInfo this_ptr_conv;
13814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13816 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13817 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
13821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13822 LDKChannelInfo this_ptr_conv;
13823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13824 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13825 LDKPublicKey val_ref;
13826 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13827 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13828 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
13831 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
13832 LDKChannelInfo this_ptr_conv;
13833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13834 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13835 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
13836 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13837 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13838 long ret_ref = (long)ret_var.inner;
13839 if (ret_var.is_owned) {
13845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13846 LDKChannelInfo this_ptr_conv;
13847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13848 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13849 LDKDirectionalChannelInfo val_conv;
13850 val_conv.inner = (void*)(val & (~1));
13851 val_conv.is_owned = (val & 1) || (val == 0);
13852 // Warning: we may need a move here but can't clone!
13853 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
13856 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
13857 LDKChannelInfo this_ptr_conv;
13858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13859 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13860 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13861 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
13865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13866 LDKChannelInfo this_ptr_conv;
13867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13868 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13869 LDKPublicKey val_ref;
13870 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13871 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13872 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
13875 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
13876 LDKChannelInfo this_ptr_conv;
13877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13879 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
13880 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13881 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13882 long ret_ref = (long)ret_var.inner;
13883 if (ret_var.is_owned) {
13889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13890 LDKChannelInfo this_ptr_conv;
13891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13892 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13893 LDKDirectionalChannelInfo val_conv;
13894 val_conv.inner = (void*)(val & (~1));
13895 val_conv.is_owned = (val & 1) || (val == 0);
13896 // Warning: we may need a move here but can't clone!
13897 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
13900 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
13901 LDKChannelInfo this_ptr_conv;
13902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13903 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13904 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
13905 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13906 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13907 long ret_ref = (long)ret_var.inner;
13908 if (ret_var.is_owned) {
13914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13915 LDKChannelInfo this_ptr_conv;
13916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13917 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13918 LDKChannelAnnouncement val_conv;
13919 val_conv.inner = (void*)(val & (~1));
13920 val_conv.is_owned = (val & 1) || (val == 0);
13921 if (val_conv.inner != NULL)
13922 val_conv = ChannelAnnouncement_clone(&val_conv);
13923 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
13926 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13927 LDKChannelInfo obj_conv;
13928 obj_conv.inner = (void*)(obj & (~1));
13929 obj_conv.is_owned = (obj & 1) || (obj == 0);
13930 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
13931 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13932 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13933 CVec_u8Z_free(arg_var);
13937 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13938 LDKu8slice ser_ref;
13939 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13940 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13941 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
13942 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13943 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13944 long ret_ref = (long)ret_var.inner;
13945 if (ret_var.is_owned) {
13948 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13953 LDKRoutingFees this_ptr_conv;
13954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13955 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13956 RoutingFees_free(this_ptr_conv);
13959 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13960 LDKRoutingFees orig_conv;
13961 orig_conv.inner = (void*)(orig & (~1));
13962 orig_conv.is_owned = (orig & 1) || (orig == 0);
13963 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
13964 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13965 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13966 long ret_ref = (long)ret_var.inner;
13967 if (ret_var.is_owned) {
13973 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13974 LDKRoutingFees this_ptr_conv;
13975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13976 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13977 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
13981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13982 LDKRoutingFees this_ptr_conv;
13983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13984 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13985 RoutingFees_set_base_msat(&this_ptr_conv, val);
13988 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
13996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13997 LDKRoutingFees this_ptr_conv;
13998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13999 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14000 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
14003 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
14004 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
14005 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14006 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14007 long ret_ref = (long)ret_var.inner;
14008 if (ret_var.is_owned) {
14014 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14015 LDKu8slice ser_ref;
14016 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14017 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14018 LDKRoutingFees ret_var = RoutingFees_read(ser_ref);
14019 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14020 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14021 long ret_ref = (long)ret_var.inner;
14022 if (ret_var.is_owned) {
14025 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14029 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
14030 LDKRoutingFees obj_conv;
14031 obj_conv.inner = (void*)(obj & (~1));
14032 obj_conv.is_owned = (obj & 1) || (obj == 0);
14033 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
14034 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14035 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14036 CVec_u8Z_free(arg_var);
14040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14041 LDKNodeAnnouncementInfo this_ptr_conv;
14042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14043 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14044 NodeAnnouncementInfo_free(this_ptr_conv);
14047 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(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 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
14052 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14053 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14054 long ret_ref = (long)ret_var.inner;
14055 if (ret_var.is_owned) {
14061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14062 LDKNodeAnnouncementInfo this_ptr_conv;
14063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14064 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14065 LDKNodeFeatures val_conv;
14066 val_conv.inner = (void*)(val & (~1));
14067 val_conv.is_owned = (val & 1) || (val == 0);
14068 // Warning: we may need a move here but can't clone!
14069 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
14072 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
14073 LDKNodeAnnouncementInfo this_ptr_conv;
14074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14075 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14076 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
14080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14081 LDKNodeAnnouncementInfo this_ptr_conv;
14082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14083 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14084 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
14087 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
14092 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
14096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14097 LDKNodeAnnouncementInfo this_ptr_conv;
14098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14099 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14100 LDKThreeBytes val_ref;
14101 CHECK((*_env)->GetArrayLength (_env, val) == 3);
14102 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
14103 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
14106 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
14107 LDKNodeAnnouncementInfo this_ptr_conv;
14108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14109 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14110 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
14111 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
14115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14116 LDKNodeAnnouncementInfo this_ptr_conv;
14117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14118 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14119 LDKThirtyTwoBytes val_ref;
14120 CHECK((*_env)->GetArrayLength (_env, val) == 32);
14121 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
14122 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
14125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14126 LDKNodeAnnouncementInfo this_ptr_conv;
14127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14128 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14129 LDKCVec_NetAddressZ val_constr;
14130 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14131 if (val_constr.datalen > 0)
14132 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14134 val_constr.data = NULL;
14135 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14136 for (size_t m = 0; m < val_constr.datalen; m++) {
14137 long arr_conv_12 = val_vals[m];
14138 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14139 FREE((void*)arr_conv_12);
14140 val_constr.data[m] = arr_conv_12_conv;
14142 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14143 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
14146 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14147 LDKNodeAnnouncementInfo this_ptr_conv;
14148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14149 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14150 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
14151 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14152 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14153 long ret_ref = (long)ret_var.inner;
14154 if (ret_var.is_owned) {
14160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14161 LDKNodeAnnouncementInfo this_ptr_conv;
14162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14163 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14164 LDKNodeAnnouncement val_conv;
14165 val_conv.inner = (void*)(val & (~1));
14166 val_conv.is_owned = (val & 1) || (val == 0);
14167 if (val_conv.inner != NULL)
14168 val_conv = NodeAnnouncement_clone(&val_conv);
14169 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
14172 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) {
14173 LDKNodeFeatures features_arg_conv;
14174 features_arg_conv.inner = (void*)(features_arg & (~1));
14175 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
14176 // Warning: we may need a move here but can't clone!
14177 LDKThreeBytes rgb_arg_ref;
14178 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
14179 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
14180 LDKThirtyTwoBytes alias_arg_ref;
14181 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
14182 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
14183 LDKCVec_NetAddressZ addresses_arg_constr;
14184 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
14185 if (addresses_arg_constr.datalen > 0)
14186 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14188 addresses_arg_constr.data = NULL;
14189 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
14190 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
14191 long arr_conv_12 = addresses_arg_vals[m];
14192 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14193 FREE((void*)arr_conv_12);
14194 addresses_arg_constr.data[m] = arr_conv_12_conv;
14196 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
14197 LDKNodeAnnouncement announcement_message_arg_conv;
14198 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
14199 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
14200 if (announcement_message_arg_conv.inner != NULL)
14201 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
14202 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
14203 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14204 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14205 long ret_ref = (long)ret_var.inner;
14206 if (ret_var.is_owned) {
14212 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14213 LDKNodeAnnouncementInfo obj_conv;
14214 obj_conv.inner = (void*)(obj & (~1));
14215 obj_conv.is_owned = (obj & 1) || (obj == 0);
14216 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
14217 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14218 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14219 CVec_u8Z_free(arg_var);
14223 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14224 LDKu8slice ser_ref;
14225 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14226 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14227 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_read(ser_ref);
14228 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14229 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14230 long ret_ref = (long)ret_var.inner;
14231 if (ret_var.is_owned) {
14234 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14239 LDKNodeInfo this_ptr_conv;
14240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14241 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14242 NodeInfo_free(this_ptr_conv);
14245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
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 LDKCVec_u64Z val_constr;
14250 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14251 if (val_constr.datalen > 0)
14252 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14254 val_constr.data = NULL;
14255 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14256 for (size_t g = 0; g < val_constr.datalen; g++) {
14257 long arr_conv_6 = val_vals[g];
14258 val_constr.data[g] = arr_conv_6;
14260 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14261 NodeInfo_set_channels(&this_ptr_conv, val_constr);
14264 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
14265 LDKNodeInfo this_ptr_conv;
14266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14268 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
14269 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14270 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14271 long ret_ref = (long)ret_var.inner;
14272 if (ret_var.is_owned) {
14278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14279 LDKNodeInfo this_ptr_conv;
14280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14281 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14282 LDKRoutingFees val_conv;
14283 val_conv.inner = (void*)(val & (~1));
14284 val_conv.is_owned = (val & 1) || (val == 0);
14285 if (val_conv.inner != NULL)
14286 val_conv = RoutingFees_clone(&val_conv);
14287 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
14290 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
14291 LDKNodeInfo this_ptr_conv;
14292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14293 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14294 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
14295 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14296 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14297 long ret_ref = (long)ret_var.inner;
14298 if (ret_var.is_owned) {
14304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14305 LDKNodeInfo this_ptr_conv;
14306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14308 LDKNodeAnnouncementInfo val_conv;
14309 val_conv.inner = (void*)(val & (~1));
14310 val_conv.is_owned = (val & 1) || (val == 0);
14311 // Warning: we may need a move here but can't clone!
14312 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
14315 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) {
14316 LDKCVec_u64Z channels_arg_constr;
14317 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
14318 if (channels_arg_constr.datalen > 0)
14319 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14321 channels_arg_constr.data = NULL;
14322 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
14323 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
14324 long arr_conv_6 = channels_arg_vals[g];
14325 channels_arg_constr.data[g] = arr_conv_6;
14327 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
14328 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
14329 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
14330 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
14331 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
14332 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
14333 LDKNodeAnnouncementInfo announcement_info_arg_conv;
14334 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
14335 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
14336 // Warning: we may need a move here but can't clone!
14337 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
14338 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14339 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14340 long ret_ref = (long)ret_var.inner;
14341 if (ret_var.is_owned) {
14347 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14348 LDKNodeInfo obj_conv;
14349 obj_conv.inner = (void*)(obj & (~1));
14350 obj_conv.is_owned = (obj & 1) || (obj == 0);
14351 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
14352 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14353 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14354 CVec_u8Z_free(arg_var);
14358 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14359 LDKu8slice ser_ref;
14360 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14361 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14362 LDKNodeInfo ret_var = NodeInfo_read(ser_ref);
14363 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14364 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14365 long ret_ref = (long)ret_var.inner;
14366 if (ret_var.is_owned) {
14369 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14373 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
14374 LDKNetworkGraph obj_conv;
14375 obj_conv.inner = (void*)(obj & (~1));
14376 obj_conv.is_owned = (obj & 1) || (obj == 0);
14377 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
14378 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14379 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14380 CVec_u8Z_free(arg_var);
14384 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14385 LDKu8slice ser_ref;
14386 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14387 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14388 LDKNetworkGraph ret_var = NetworkGraph_read(ser_ref);
14389 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14390 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14391 long ret_ref = (long)ret_var.inner;
14392 if (ret_var.is_owned) {
14395 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14399 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
14400 LDKNetworkGraph ret_var = NetworkGraph_new();
14401 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14402 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14403 long ret_ref = (long)ret_var.inner;
14404 if (ret_var.is_owned) {
14410 JNIEXPORT 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) {
14411 LDKNetworkGraph this_arg_conv;
14412 this_arg_conv.inner = (void*)(this_arg & (~1));
14413 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
14414 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);