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 jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
475 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
477 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
478 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
479 CHECK(val->result_ok);
480 return *val->contents.result;
482 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
483 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
484 CHECK(!val->result_ok);
485 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(_env, (*val->contents.err));
488 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
489 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
491 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
492 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
493 CHECK(val->result_ok);
494 return *val->contents.result;
496 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
497 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
498 CHECK(!val->result_ok);
499 LDKMonitorUpdateError err_var = (*val->contents.err);
500 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
501 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
502 long err_ref = (long)err_var.inner & ~1;
505 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
506 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
508 a_conv.inner = (void*)(a & (~1));
509 a_conv.is_owned = (a & 1) || (a == 0);
510 if (a_conv.inner != NULL)
511 a_conv = OutPoint_clone(&a_conv);
514 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
515 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
517 //TODO: Really need to call (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0); here
520 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
521 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
522 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
524 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
525 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
526 ret->datalen = (*env)->GetArrayLength(env, elems);
527 if (ret->datalen == 0) {
530 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
531 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
532 for (size_t i = 0; i < ret->datalen; i++) {
533 jlong arr_elem = java_elems[i];
534 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
535 FREE((void*)arr_elem);
536 ret->data[i] = arr_elem_conv;
538 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlongArray b) {
543 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
544 LDKThirtyTwoBytes a_ref;
545 CHECK((*_env)->GetArrayLength (_env, a) == 32);
546 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
548 LDKCVecTempl_TxOut b_constr;
549 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
550 if (b_constr.datalen > 0)
551 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVecTempl_TxOut Elements");
553 b_constr.data = NULL;
554 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
555 for (size_t h = 0; h < b_constr.datalen; h++) {
556 long arr_conv_7 = b_vals[h];
557 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
558 FREE((void*)arr_conv_7);
559 b_constr.data[h] = arr_conv_7_conv;
561 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
565 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
566 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
571 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
572 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
573 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
575 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jbyteArray a, jobjectArray b) {
576 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
578 CHECK((*_env)->GetArrayLength (_env, a) == 64);
579 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
581 LDKCVecTempl_Signature b_constr;
582 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
583 if (b_constr.datalen > 0)
584 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVecTempl_Signature Elements");
586 b_constr.data = NULL;
587 for (size_t i = 0; i < b_constr.datalen; i++) {
588 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
589 LDKSignature arr_conv_8_ref;
590 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
591 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
592 b_constr.data[i] = arr_conv_8_ref;
597 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
598 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
600 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
601 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
602 CHECK(val->result_ok);
603 long res_ref = (long)&(*val->contents.result);
606 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
607 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
608 CHECK(!val->result_ok);
609 return *val->contents.err;
611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
612 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
614 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
615 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
616 CHECK(val->result_ok);
617 jbyteArray res_arr = (*_env)->NewByteArray(_env, 64);
618 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 64, (*val->contents.result).compact_form);
621 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
622 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
623 CHECK(!val->result_ok);
624 return *val->contents.err;
626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
627 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
629 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
630 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
631 CHECK(val->result_ok);
632 LDKCVecTempl_Signature res_var = (*val->contents.result);
633 jobjectArray res_arr = (*_env)->NewObjectArray(_env, res_var.datalen, NULL, NULL);
634 for (size_t i = 0; i < res_var.datalen; i++) {
635 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
636 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
637 (*_env)->SetObjectArrayElement(_env, res_arr, i, arr_conv_8_arr);
641 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
642 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
643 CHECK(!val->result_ok);
644 return *val->contents.err;
646 static jclass LDKAPIError_APIMisuseError_class = NULL;
647 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
648 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
649 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
650 static jclass LDKAPIError_RouteError_class = NULL;
651 static jmethodID LDKAPIError_RouteError_meth = NULL;
652 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
653 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
654 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
655 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
657 LDKAPIError_APIMisuseError_class =
658 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
659 CHECK(LDKAPIError_APIMisuseError_class != NULL);
660 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
661 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
662 LDKAPIError_FeeRateTooHigh_class =
663 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
664 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
665 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
666 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
667 LDKAPIError_RouteError_class =
668 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
669 CHECK(LDKAPIError_RouteError_class != NULL);
670 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
671 CHECK(LDKAPIError_RouteError_meth != NULL);
672 LDKAPIError_ChannelUnavailable_class =
673 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
674 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
675 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
676 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
677 LDKAPIError_MonitorUpdateFailed_class =
678 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
679 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
680 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
681 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
683 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
684 LDKAPIError *obj = (LDKAPIError*)ptr;
686 case LDKAPIError_APIMisuseError: {
687 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
688 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
689 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
690 return (*_env)->NewObject(_env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
692 case LDKAPIError_FeeRateTooHigh: {
693 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
694 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
695 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
696 return (*_env)->NewObject(_env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
698 case LDKAPIError_RouteError: {
699 LDKStr err_str = obj->route_error.err;
700 char* err_buf = MALLOC(err_str.len + 1, "str conv buf");
701 memcpy(err_buf, err_str.chars, err_str.len);
702 err_buf[err_str.len] = 0;
703 jstring err_conv = (*_env)->NewStringUTF(_env, err_str.chars);
705 return (*_env)->NewObject(_env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
707 case LDKAPIError_ChannelUnavailable: {
708 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
709 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
710 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
711 return (*_env)->NewObject(_env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
713 case LDKAPIError_MonitorUpdateFailed: {
714 return (*_env)->NewObject(_env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
719 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
720 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
722 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
723 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
724 CHECK(val->result_ok);
725 return *val->contents.result;
727 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
728 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
729 CHECK(!val->result_ok);
730 long err_ref = (long)&(*val->contents.err);
733 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
734 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
736 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
737 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
738 CHECK(val->result_ok);
739 return *val->contents.result;
741 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
742 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
743 CHECK(!val->result_ok);
744 LDKPaymentSendFailure err_var = (*val->contents.err);
745 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
746 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
747 long err_ref = (long)err_var.inner & ~1;
750 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) {
751 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
752 LDKChannelAnnouncement a_conv;
753 a_conv.inner = (void*)(a & (~1));
754 a_conv.is_owned = (a & 1) || (a == 0);
755 if (a_conv.inner != NULL)
756 a_conv = ChannelAnnouncement_clone(&a_conv);
758 LDKChannelUpdate b_conv;
759 b_conv.inner = (void*)(b & (~1));
760 b_conv.is_owned = (b & 1) || (b == 0);
761 if (b_conv.inner != NULL)
762 b_conv = ChannelUpdate_clone(&b_conv);
764 LDKChannelUpdate c_conv;
765 c_conv.inner = (void*)(c & (~1));
766 c_conv.is_owned = (c & 1) || (c == 0);
767 if (c_conv.inner != NULL)
768 c_conv = ChannelUpdate_clone(&c_conv);
772 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
773 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
775 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
776 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
777 CHECK(val->result_ok);
778 return *val->contents.result;
780 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
781 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
782 CHECK(!val->result_ok);
783 LDKPeerHandleError err_var = (*val->contents.err);
784 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
785 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
786 long err_ref = (long)err_var.inner & ~1;
789 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
790 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
791 LDKHTLCOutputInCommitment a_conv;
792 a_conv.inner = (void*)(a & (~1));
793 a_conv.is_owned = (a & 1) || (a == 0);
794 if (a_conv.inner != NULL)
795 a_conv = HTLCOutputInCommitment_clone(&a_conv);
798 CHECK((*_env)->GetArrayLength (_env, b) == 64);
799 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
803 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
804 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
805 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
806 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
807 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
808 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
810 LDKSpendableOutputDescriptor_StaticOutput_class =
811 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
812 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
813 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
814 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
815 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
816 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
817 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
818 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
819 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
820 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
821 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
822 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
823 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
824 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
826 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
827 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
829 case LDKSpendableOutputDescriptor_StaticOutput: {
830 LDKOutPoint outpoint_var = obj->static_output.outpoint;
831 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
832 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
833 long outpoint_ref = (long)outpoint_var.inner & ~1;
834 long output_ref = (long)&obj->static_output.output;
835 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
837 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
838 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
839 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
840 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
841 long outpoint_ref = (long)outpoint_var.inner & ~1;
842 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
843 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
844 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
845 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
846 jbyteArray revocation_pubkey_arr = (*_env)->NewByteArray(_env, 33);
847 (*_env)->SetByteArrayRegion(_env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
848 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);
850 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
851 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
852 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
853 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
854 long outpoint_ref = (long)outpoint_var.inner & ~1;
855 long output_ref = (long)&obj->static_output_counterparty_payment.output;
856 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
857 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
862 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
863 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
864 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
866 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
867 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
868 ret->datalen = (*env)->GetArrayLength(env, elems);
869 if (ret->datalen == 0) {
872 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
873 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
874 for (size_t i = 0; i < ret->datalen; i++) {
875 jlong arr_elem = java_elems[i];
876 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
877 FREE((void*)arr_elem);
878 ret->data[i] = arr_elem_conv;
880 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
884 static jclass LDKEvent_FundingGenerationReady_class = NULL;
885 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
886 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
887 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
888 static jclass LDKEvent_PaymentReceived_class = NULL;
889 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
890 static jclass LDKEvent_PaymentSent_class = NULL;
891 static jmethodID LDKEvent_PaymentSent_meth = NULL;
892 static jclass LDKEvent_PaymentFailed_class = NULL;
893 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
894 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
895 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
896 static jclass LDKEvent_SpendableOutputs_class = NULL;
897 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
899 LDKEvent_FundingGenerationReady_class =
900 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
901 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
902 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
903 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
904 LDKEvent_FundingBroadcastSafe_class =
905 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
906 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
907 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
908 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
909 LDKEvent_PaymentReceived_class =
910 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
911 CHECK(LDKEvent_PaymentReceived_class != NULL);
912 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
913 CHECK(LDKEvent_PaymentReceived_meth != NULL);
914 LDKEvent_PaymentSent_class =
915 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
916 CHECK(LDKEvent_PaymentSent_class != NULL);
917 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
918 CHECK(LDKEvent_PaymentSent_meth != NULL);
919 LDKEvent_PaymentFailed_class =
920 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
921 CHECK(LDKEvent_PaymentFailed_class != NULL);
922 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
923 CHECK(LDKEvent_PaymentFailed_meth != NULL);
924 LDKEvent_PendingHTLCsForwardable_class =
925 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
926 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
927 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
928 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
929 LDKEvent_SpendableOutputs_class =
930 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
931 CHECK(LDKEvent_SpendableOutputs_class != NULL);
932 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
933 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
935 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
936 LDKEvent *obj = (LDKEvent*)ptr;
938 case LDKEvent_FundingGenerationReady: {
939 jbyteArray temporary_channel_id_arr = (*_env)->NewByteArray(_env, 32);
940 (*_env)->SetByteArrayRegion(_env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
941 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
942 jbyteArray output_script_arr = (*_env)->NewByteArray(_env, output_script_var.datalen);
943 (*_env)->SetByteArrayRegion(_env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
944 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);
946 case LDKEvent_FundingBroadcastSafe: {
947 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
948 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
949 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
950 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
951 return (*_env)->NewObject(_env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
953 case LDKEvent_PaymentReceived: {
954 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
955 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
956 jbyteArray payment_secret_arr = (*_env)->NewByteArray(_env, 32);
957 (*_env)->SetByteArrayRegion(_env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
958 return (*_env)->NewObject(_env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
960 case LDKEvent_PaymentSent: {
961 jbyteArray payment_preimage_arr = (*_env)->NewByteArray(_env, 32);
962 (*_env)->SetByteArrayRegion(_env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
963 return (*_env)->NewObject(_env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
965 case LDKEvent_PaymentFailed: {
966 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
967 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
968 return (*_env)->NewObject(_env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
970 case LDKEvent_PendingHTLCsForwardable: {
971 return (*_env)->NewObject(_env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
973 case LDKEvent_SpendableOutputs: {
974 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
975 jlongArray outputs_arr = (*_env)->NewLongArray(_env, outputs_var.datalen);
976 jlong *outputs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, outputs_arr, NULL);
977 for (size_t b = 0; b < outputs_var.datalen; b++) {
978 long arr_conv_27_ref = (long)&outputs_var.data[b];
979 outputs_arr_ptr[b] = arr_conv_27_ref;
981 (*_env)->ReleasePrimitiveArrayCritical(_env, outputs_arr, outputs_arr_ptr, 0);
982 return (*_env)->NewObject(_env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
987 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
988 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
989 static jclass LDKErrorAction_IgnoreError_class = NULL;
990 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
991 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
992 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
994 LDKErrorAction_DisconnectPeer_class =
995 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
996 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
997 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
998 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
999 LDKErrorAction_IgnoreError_class =
1000 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1001 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1002 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1003 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1004 LDKErrorAction_SendErrorMessage_class =
1005 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1006 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1007 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1008 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1010 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1011 LDKErrorAction *obj = (LDKErrorAction*)ptr;
1013 case LDKErrorAction_DisconnectPeer: {
1014 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1015 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1016 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1017 long msg_ref = (long)msg_var.inner & ~1;
1018 return (*_env)->NewObject(_env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1020 case LDKErrorAction_IgnoreError: {
1021 return (*_env)->NewObject(_env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1023 case LDKErrorAction_SendErrorMessage: {
1024 LDKErrorMessage msg_var = obj->send_error_message.msg;
1025 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1026 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1027 long msg_ref = (long)msg_var.inner & ~1;
1028 return (*_env)->NewObject(_env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1033 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1034 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1035 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1036 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1037 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1038 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
1040 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1041 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1042 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1043 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1044 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1045 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1046 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1047 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1048 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1049 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1050 LDKHTLCFailChannelUpdate_NodeFailure_class =
1051 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1052 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1053 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1054 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1056 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1057 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
1059 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1060 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1061 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1062 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1063 long msg_ref = (long)msg_var.inner & ~1;
1064 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1066 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1067 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1069 case LDKHTLCFailChannelUpdate_NodeFailure: {
1070 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1071 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1072 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1077 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1078 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1079 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1080 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1081 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1082 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1083 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1084 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1085 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1086 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1087 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1088 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1089 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1090 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1091 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1092 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1093 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1094 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1095 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1096 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1097 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1098 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1099 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1100 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1101 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1102 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1103 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1104 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1105 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1106 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1107 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1108 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1110 LDKMessageSendEvent_SendAcceptChannel_class =
1111 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1112 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1113 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1114 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1115 LDKMessageSendEvent_SendOpenChannel_class =
1116 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1117 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1118 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1119 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1120 LDKMessageSendEvent_SendFundingCreated_class =
1121 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1122 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1123 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1124 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1125 LDKMessageSendEvent_SendFundingSigned_class =
1126 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1127 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1128 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1129 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1130 LDKMessageSendEvent_SendFundingLocked_class =
1131 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1132 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1133 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1134 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1135 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1136 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1137 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1138 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1139 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1140 LDKMessageSendEvent_UpdateHTLCs_class =
1141 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1142 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1143 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1144 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1145 LDKMessageSendEvent_SendRevokeAndACK_class =
1146 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1147 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1148 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1149 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1150 LDKMessageSendEvent_SendClosingSigned_class =
1151 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1152 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1153 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1154 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1155 LDKMessageSendEvent_SendShutdown_class =
1156 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1157 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1158 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1159 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1160 LDKMessageSendEvent_SendChannelReestablish_class =
1161 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1162 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1163 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1164 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1165 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1166 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1167 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1168 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1169 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1170 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1171 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1172 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1173 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1174 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1175 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1176 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1177 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1178 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1179 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1180 LDKMessageSendEvent_HandleError_class =
1181 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1182 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1183 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1184 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1185 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1186 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1187 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1188 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1189 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1191 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1192 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1194 case LDKMessageSendEvent_SendAcceptChannel: {
1195 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1196 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1197 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1198 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1199 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1200 long msg_ref = (long)msg_var.inner & ~1;
1201 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1203 case LDKMessageSendEvent_SendOpenChannel: {
1204 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1205 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1206 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1207 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1208 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1209 long msg_ref = (long)msg_var.inner & ~1;
1210 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1212 case LDKMessageSendEvent_SendFundingCreated: {
1213 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1214 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1215 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1216 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1217 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1218 long msg_ref = (long)msg_var.inner & ~1;
1219 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1221 case LDKMessageSendEvent_SendFundingSigned: {
1222 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1223 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1224 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1225 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1226 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1227 long msg_ref = (long)msg_var.inner & ~1;
1228 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1230 case LDKMessageSendEvent_SendFundingLocked: {
1231 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1232 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1233 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1234 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1235 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1236 long msg_ref = (long)msg_var.inner & ~1;
1237 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1239 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1240 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1241 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1242 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1243 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1244 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1245 long msg_ref = (long)msg_var.inner & ~1;
1246 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1248 case LDKMessageSendEvent_UpdateHTLCs: {
1249 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1250 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1251 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1252 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1253 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1254 long updates_ref = (long)updates_var.inner & ~1;
1255 return (*_env)->NewObject(_env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1257 case LDKMessageSendEvent_SendRevokeAndACK: {
1258 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1259 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1260 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1261 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1262 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1263 long msg_ref = (long)msg_var.inner & ~1;
1264 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1266 case LDKMessageSendEvent_SendClosingSigned: {
1267 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1268 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1269 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1270 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1271 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1272 long msg_ref = (long)msg_var.inner & ~1;
1273 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1275 case LDKMessageSendEvent_SendShutdown: {
1276 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1277 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1278 LDKShutdown msg_var = obj->send_shutdown.msg;
1279 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1280 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1281 long msg_ref = (long)msg_var.inner & ~1;
1282 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1284 case LDKMessageSendEvent_SendChannelReestablish: {
1285 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1286 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1287 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1288 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1289 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1290 long msg_ref = (long)msg_var.inner & ~1;
1291 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1293 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1294 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1295 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1296 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1297 long msg_ref = (long)msg_var.inner & ~1;
1298 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1299 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1300 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1301 long update_msg_ref = (long)update_msg_var.inner & ~1;
1302 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1304 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1305 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1306 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1307 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1308 long msg_ref = (long)msg_var.inner & ~1;
1309 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1311 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1312 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1313 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1314 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1315 long msg_ref = (long)msg_var.inner & ~1;
1316 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1318 case LDKMessageSendEvent_HandleError: {
1319 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1320 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1321 long action_ref = (long)&obj->handle_error.action;
1322 return (*_env)->NewObject(_env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1324 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1325 long update_ref = (long)&obj->payment_failure_network_update.update;
1326 return (*_env)->NewObject(_env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1331 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1332 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1333 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1335 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1336 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1337 ret->datalen = (*env)->GetArrayLength(env, elems);
1338 if (ret->datalen == 0) {
1341 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1342 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1343 for (size_t i = 0; i < ret->datalen; i++) {
1344 jlong arr_elem = java_elems[i];
1345 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1346 FREE((void*)arr_elem);
1347 ret->data[i] = arr_elem_conv;
1349 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1353 typedef struct LDKMessageSendEventsProvider_JCalls {
1354 atomic_size_t refcnt;
1357 jmethodID get_and_clear_pending_msg_events_meth;
1358 } LDKMessageSendEventsProvider_JCalls;
1359 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1360 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1362 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1363 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1365 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1366 LDKCVec_MessageSendEventZ arg_constr;
1367 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
1368 if (arg_constr.datalen > 0)
1369 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
1371 arg_constr.data = NULL;
1372 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
1373 for (size_t s = 0; s < arg_constr.datalen; s++) {
1374 long arr_conv_18 = arg_vals[s];
1375 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
1376 FREE((void*)arr_conv_18);
1377 arg_constr.data[s] = arr_conv_18_conv;
1379 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
1382 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1383 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1384 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1386 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1387 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1391 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1392 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1393 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1394 return (void*) this_arg;
1396 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1397 jclass c = (*env)->GetObjectClass(env, o);
1399 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1400 atomic_init(&calls->refcnt, 1);
1401 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1402 calls->o = (*env)->NewWeakGlobalRef(env, o);
1403 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
1404 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
1406 LDKMessageSendEventsProvider ret = {
1407 .this_arg = (void*) calls,
1408 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1409 .free = LDKMessageSendEventsProvider_JCalls_free,
1413 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1414 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1415 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1416 return (long)res_ptr;
1418 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1419 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1423 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1424 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1425 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1426 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1427 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1428 for (size_t s = 0; s < ret_var.datalen; s++) {
1429 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
1430 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
1431 long arr_conv_18_ref = (long)arr_conv_18_copy;
1432 ret_arr_ptr[s] = arr_conv_18_ref;
1434 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1435 CVec_MessageSendEventZ_free(ret_var);
1439 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1440 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1441 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1444 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1445 ret->datalen = (*env)->GetArrayLength(env, elems);
1446 if (ret->datalen == 0) {
1449 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1450 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1451 for (size_t i = 0; i < ret->datalen; i++) {
1452 jlong arr_elem = java_elems[i];
1453 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1454 FREE((void*)arr_elem);
1455 ret->data[i] = arr_elem_conv;
1457 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1461 typedef struct LDKEventsProvider_JCalls {
1462 atomic_size_t refcnt;
1465 jmethodID get_and_clear_pending_events_meth;
1466 } LDKEventsProvider_JCalls;
1467 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1468 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1470 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1471 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1473 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_events_meth);
1474 LDKCVec_EventZ arg_constr;
1475 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
1476 if (arg_constr.datalen > 0)
1477 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
1479 arg_constr.data = NULL;
1480 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
1481 for (size_t h = 0; h < arg_constr.datalen; h++) {
1482 long arr_conv_7 = arg_vals[h];
1483 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
1484 FREE((void*)arr_conv_7);
1485 arg_constr.data[h] = arr_conv_7_conv;
1487 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
1490 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1491 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1492 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1494 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1495 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1499 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1500 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1501 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1502 return (void*) this_arg;
1504 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1505 jclass c = (*env)->GetObjectClass(env, o);
1507 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1508 atomic_init(&calls->refcnt, 1);
1509 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1510 calls->o = (*env)->NewWeakGlobalRef(env, o);
1511 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
1512 CHECK(calls->get_and_clear_pending_events_meth != NULL);
1514 LDKEventsProvider ret = {
1515 .this_arg = (void*) calls,
1516 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1517 .free = LDKEventsProvider_JCalls_free,
1521 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1522 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1523 *res_ptr = LDKEventsProvider_init(env, _a, o);
1524 return (long)res_ptr;
1526 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1527 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1531 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1532 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1533 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1534 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1535 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1536 for (size_t h = 0; h < ret_var.datalen; h++) {
1537 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
1538 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
1539 long arr_conv_7_ref = (long)arr_conv_7_copy;
1540 ret_arr_ptr[h] = arr_conv_7_ref;
1542 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1543 CVec_EventZ_free(ret_var);
1547 typedef struct LDKLogger_JCalls {
1548 atomic_size_t refcnt;
1553 void log_jcall(const void* this_arg, const char *record) {
1554 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1556 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1557 jstring record_conv = (*_env)->NewStringUTF(_env, record);
1558 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1560 return (*_env)->CallVoidMethod(_env, obj, j_calls->log_meth, record_conv);
1562 static void LDKLogger_JCalls_free(void* this_arg) {
1563 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1564 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1566 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1567 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1571 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1572 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1573 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1574 return (void*) this_arg;
1576 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1577 jclass c = (*env)->GetObjectClass(env, o);
1579 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1580 atomic_init(&calls->refcnt, 1);
1581 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1582 calls->o = (*env)->NewWeakGlobalRef(env, o);
1583 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1584 CHECK(calls->log_meth != NULL);
1587 .this_arg = (void*) calls,
1589 .free = LDKLogger_JCalls_free,
1593 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1594 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1595 *res_ptr = LDKLogger_init(env, _a, o);
1596 return (long)res_ptr;
1598 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1599 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1603 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1604 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1607 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1608 CHECK(val->result_ok);
1609 long res_ref = (long)&(*val->contents.result);
1612 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1613 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1614 CHECK(!val->result_ok);
1615 jclass err_conv = LDKAccessError_to_java(_env, (*val->contents.err));
1618 typedef struct LDKAccess_JCalls {
1619 atomic_size_t refcnt;
1622 jmethodID get_utxo_meth;
1624 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1625 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1627 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1628 jbyteArray genesis_hash_arr = (*_env)->NewByteArray(_env, 32);
1629 (*_env)->SetByteArrayRegion(_env, genesis_hash_arr, 0, 32, *genesis_hash);
1630 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1632 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1633 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)ret;
1637 static void LDKAccess_JCalls_free(void* this_arg) {
1638 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1639 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1641 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1642 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1646 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1647 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1648 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1649 return (void*) this_arg;
1651 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1652 jclass c = (*env)->GetObjectClass(env, o);
1654 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1655 atomic_init(&calls->refcnt, 1);
1656 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1657 calls->o = (*env)->NewWeakGlobalRef(env, o);
1658 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1659 CHECK(calls->get_utxo_meth != NULL);
1662 .this_arg = (void*) calls,
1663 .get_utxo = get_utxo_jcall,
1664 .free = LDKAccess_JCalls_free,
1668 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1669 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1670 *res_ptr = LDKAccess_init(env, _a, o);
1671 return (long)res_ptr;
1673 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1674 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1678 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) {
1679 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1680 unsigned char genesis_hash_arr[32];
1681 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
1682 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1683 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1684 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1685 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1686 return (long)ret_conv;
1689 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1690 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1691 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1692 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1693 for (size_t i = 0; i < vec->datalen; i++) {
1694 CHECK((((long)vec->data[i].inner) & 1) == 0);
1695 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1697 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1700 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1701 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1702 ret->datalen = (*env)->GetArrayLength(env, elems);
1703 if (ret->datalen == 0) {
1706 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1707 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1708 for (size_t i = 0; i < ret->datalen; i++) {
1709 jlong arr_elem = java_elems[i];
1710 LDKHTLCOutputInCommitment arr_elem_conv;
1711 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1712 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1713 if (arr_elem_conv.inner != NULL)
1714 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1715 ret->data[i] = arr_elem_conv;
1717 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1721 typedef struct LDKChannelKeys_JCalls {
1722 atomic_size_t refcnt;
1725 jmethodID get_per_commitment_point_meth;
1726 jmethodID release_commitment_secret_meth;
1727 jmethodID key_derivation_params_meth;
1728 jmethodID sign_counterparty_commitment_meth;
1729 jmethodID sign_holder_commitment_meth;
1730 jmethodID sign_holder_commitment_htlc_transactions_meth;
1731 jmethodID sign_justice_transaction_meth;
1732 jmethodID sign_counterparty_htlc_transaction_meth;
1733 jmethodID sign_closing_transaction_meth;
1734 jmethodID sign_channel_announcement_meth;
1735 jmethodID on_accept_meth;
1736 } LDKChannelKeys_JCalls;
1737 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1738 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1740 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1741 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1743 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_per_commitment_point_meth, idx);
1744 LDKPublicKey arg_ref;
1745 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
1746 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
1749 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1750 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1752 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1753 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1755 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_commitment_secret_meth, idx);
1756 LDKThirtyTwoBytes arg_ref;
1757 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
1758 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
1761 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1762 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1764 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1765 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1767 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*_env)->CallLongMethod(_env, obj, j_calls->key_derivation_params_meth);
1768 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)ret;
1772 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) {
1773 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1775 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1776 LDKTransaction *commitment_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1777 *commitment_tx_copy = commitment_tx;
1778 long commitment_tx_ref = (long)commitment_tx_copy;
1779 long ret_keys = (long)keys;
1780 LDKCVec_HTLCOutputInCommitmentZ htlcs_var = htlcs;
1781 jlongArray htlcs_arr = (*_env)->NewLongArray(_env, htlcs_var.datalen);
1782 jlong *htlcs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, htlcs_arr, NULL);
1783 for (size_t y = 0; y < htlcs_var.datalen; y++) {
1784 LDKHTLCOutputInCommitment arr_conv_24_var = htlcs_var.data[y];
1785 CHECK((((long)arr_conv_24_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1786 CHECK((((long)&arr_conv_24_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1787 long arr_conv_24_ref = (long)arr_conv_24_var.inner;
1788 if (arr_conv_24_var.is_owned) {
1789 arr_conv_24_ref |= 1;
1791 htlcs_arr_ptr[y] = arr_conv_24_ref;
1793 (*_env)->ReleasePrimitiveArrayCritical(_env, htlcs_arr, htlcs_arr_ptr, 0);
1794 FREE(htlcs_var.data);
1795 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1797 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);
1798 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret;
1802 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1803 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1805 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1806 long ret_holder_commitment_tx = (long)holder_commitment_tx;
1807 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1809 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, ret_holder_commitment_tx);
1810 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1814 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1815 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1817 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1818 long ret_holder_commitment_tx = (long)holder_commitment_tx;
1819 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1821 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, ret_holder_commitment_tx);
1822 LDKCResult_CVec_SignatureZNoneZ ret_conv = *(LDKCResult_CVec_SignatureZNoneZ*)ret;
1826 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) {
1827 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1829 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1830 LDKTransaction *justice_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1831 *justice_tx_copy = justice_tx;
1832 long justice_tx_ref = (long)justice_tx_copy;
1833 jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32);
1834 (*_env)->SetByteArrayRegion(_env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1835 long ret_htlc = (long)htlc;
1836 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1838 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);
1839 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1843 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) {
1844 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1846 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1847 LDKTransaction *htlc_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1848 *htlc_tx_copy = htlc_tx;
1849 long htlc_tx_ref = (long)htlc_tx_copy;
1850 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
1851 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1852 long ret_htlc = (long)htlc;
1853 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1855 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);
1856 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1860 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1861 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1863 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1864 LDKTransaction *closing_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1865 *closing_tx_copy = closing_tx;
1866 long closing_tx_ref = (long)closing_tx_copy;
1867 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1869 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1870 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1874 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1875 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1877 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1878 long ret_msg = (long)msg;
1879 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1881 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, ret_msg);
1882 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1886 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1887 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1889 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1890 long ret_channel_points = (long)channel_points;
1891 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1893 return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, ret_channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
1895 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1896 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1897 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1899 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1900 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1904 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1905 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1906 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1907 return (void*) this_arg;
1909 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
1910 jclass c = (*env)->GetObjectClass(env, o);
1912 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1913 atomic_init(&calls->refcnt, 1);
1914 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1915 calls->o = (*env)->NewWeakGlobalRef(env, o);
1916 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1917 CHECK(calls->get_per_commitment_point_meth != NULL);
1918 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1919 CHECK(calls->release_commitment_secret_meth != NULL);
1920 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1921 CHECK(calls->key_derivation_params_meth != NULL);
1922 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJ[J)J");
1923 CHECK(calls->sign_counterparty_commitment_meth != NULL);
1924 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1925 CHECK(calls->sign_holder_commitment_meth != NULL);
1926 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1927 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1928 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
1929 CHECK(calls->sign_justice_transaction_meth != NULL);
1930 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
1931 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
1932 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
1933 CHECK(calls->sign_closing_transaction_meth != NULL);
1934 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1935 CHECK(calls->sign_channel_announcement_meth != NULL);
1936 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
1937 CHECK(calls->on_accept_meth != NULL);
1939 LDKChannelPublicKeys pubkeys_conv;
1940 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1941 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1942 if (pubkeys_conv.inner != NULL)
1943 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1945 LDKChannelKeys ret = {
1946 .this_arg = (void*) calls,
1947 .get_per_commitment_point = get_per_commitment_point_jcall,
1948 .release_commitment_secret = release_commitment_secret_jcall,
1949 .key_derivation_params = key_derivation_params_jcall,
1950 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1951 .sign_holder_commitment = sign_holder_commitment_jcall,
1952 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1953 .sign_justice_transaction = sign_justice_transaction_jcall,
1954 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1955 .sign_closing_transaction = sign_closing_transaction_jcall,
1956 .sign_channel_announcement = sign_channel_announcement_jcall,
1957 .on_accept = on_accept_jcall,
1958 .clone = LDKChannelKeys_JCalls_clone,
1959 .free = LDKChannelKeys_JCalls_free,
1960 .pubkeys = pubkeys_conv,
1961 .set_pubkeys = NULL,
1965 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
1966 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1967 *res_ptr = LDKChannelKeys_init(env, _a, o, pubkeys);
1968 return (long)res_ptr;
1970 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1971 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
1975 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1976 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1977 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
1978 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
1982 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1983 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1984 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
1985 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
1989 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
1990 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1991 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1992 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1993 return (long)ret_ref;
1996 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) {
1997 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1998 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
1999 LDKPreCalculatedTxCreationKeys keys_conv;
2000 keys_conv.inner = (void*)(keys & (~1));
2001 keys_conv.is_owned = (keys & 1) || (keys == 0);
2002 LDKCVec_HTLCOutputInCommitmentZ htlcs_constr;
2003 htlcs_constr.datalen = (*_env)->GetArrayLength (_env, htlcs);
2004 if (htlcs_constr.datalen > 0)
2005 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
2007 htlcs_constr.data = NULL;
2008 long* htlcs_vals = (*_env)->GetLongArrayElements (_env, htlcs, NULL);
2009 for (size_t y = 0; y < htlcs_constr.datalen; y++) {
2010 long arr_conv_24 = htlcs_vals[y];
2011 LDKHTLCOutputInCommitment arr_conv_24_conv;
2012 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
2013 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
2014 if (arr_conv_24_conv.inner != NULL)
2015 arr_conv_24_conv = HTLCOutputInCommitment_clone(&arr_conv_24_conv);
2016 htlcs_constr.data[y] = arr_conv_24_conv;
2018 (*_env)->ReleaseLongArrayElements (_env, htlcs, htlcs_vals, 0);
2019 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2020 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_constr);
2021 return (long)ret_conv;
2024 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
2025 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2026 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2027 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2028 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
2029 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2030 *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2031 return (long)ret_conv;
2034 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) {
2035 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2036 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2037 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2038 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
2039 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
2040 *ret_conv = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2041 return (long)ret_conv;
2044 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) {
2045 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2046 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
2047 unsigned char per_commitment_key_arr[32];
2048 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
2049 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
2050 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2051 LDKHTLCOutputInCommitment htlc_conv;
2052 htlc_conv.inner = (void*)(htlc & (~1));
2053 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2054 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2055 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
2056 return (long)ret_conv;
2059 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) {
2060 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2061 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
2062 LDKPublicKey per_commitment_point_ref;
2063 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
2064 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2065 LDKHTLCOutputInCommitment htlc_conv;
2066 htlc_conv.inner = (void*)(htlc & (~1));
2067 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2068 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2069 *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);
2070 return (long)ret_conv;
2073 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) {
2074 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2075 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
2076 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2077 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv);
2078 return (long)ret_conv;
2081 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
2082 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2083 LDKUnsignedChannelAnnouncement msg_conv;
2084 msg_conv.inner = (void*)(msg & (~1));
2085 msg_conv.is_owned = (msg & 1) || (msg == 0);
2086 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2087 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2088 return (long)ret_conv;
2091 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) {
2092 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2093 LDKChannelPublicKeys channel_points_conv;
2094 channel_points_conv.inner = (void*)(channel_points & (~1));
2095 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2096 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2099 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
2100 if (this_arg->set_pubkeys != NULL)
2101 this_arg->set_pubkeys(this_arg);
2102 return this_arg->pubkeys;
2104 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
2105 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2106 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
2107 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2108 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2109 long ret_ref = (long)ret_var.inner;
2110 if (ret_var.is_owned) {
2116 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2117 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2118 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2119 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2120 for (size_t i = 0; i < vec->datalen; i++) {
2121 CHECK((((long)vec->data[i].inner) & 1) == 0);
2122 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2124 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2127 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2128 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2129 ret->datalen = (*env)->GetArrayLength(env, elems);
2130 if (ret->datalen == 0) {
2133 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2134 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2135 for (size_t i = 0; i < ret->datalen; i++) {
2136 jlong arr_elem = java_elems[i];
2137 LDKMonitorEvent arr_elem_conv;
2138 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2139 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2140 if (arr_elem_conv.inner != NULL)
2141 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
2142 ret->data[i] = arr_elem_conv;
2144 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2148 typedef struct LDKWatch_JCalls {
2149 atomic_size_t refcnt;
2152 jmethodID watch_channel_meth;
2153 jmethodID update_channel_meth;
2154 jmethodID release_pending_monitor_events_meth;
2156 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2157 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2159 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2160 LDKOutPoint funding_txo_var = funding_txo;
2161 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2162 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2163 long funding_txo_ref = (long)funding_txo_var.inner;
2164 if (funding_txo_var.is_owned) {
2165 funding_txo_ref |= 1;
2167 LDKChannelMonitor monitor_var = monitor;
2168 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2169 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2170 long monitor_ref = (long)monitor_var.inner;
2171 if (monitor_var.is_owned) {
2174 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2176 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2177 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2181 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2182 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2184 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2185 LDKOutPoint funding_txo_var = funding_txo;
2186 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2187 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2188 long funding_txo_ref = (long)funding_txo_var.inner;
2189 if (funding_txo_var.is_owned) {
2190 funding_txo_ref |= 1;
2192 LDKChannelMonitorUpdate update_var = update;
2193 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2194 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2195 long update_ref = (long)update_var.inner;
2196 if (update_var.is_owned) {
2199 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2201 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2202 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2206 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2207 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2209 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2210 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2212 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_pending_monitor_events_meth);
2213 LDKCVec_MonitorEventZ arg_constr;
2214 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
2215 if (arg_constr.datalen > 0)
2216 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2218 arg_constr.data = NULL;
2219 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
2220 for (size_t o = 0; o < arg_constr.datalen; o++) {
2221 long arr_conv_14 = arg_vals[o];
2222 LDKMonitorEvent arr_conv_14_conv;
2223 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2224 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2225 if (arr_conv_14_conv.inner != NULL)
2226 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2227 arg_constr.data[o] = arr_conv_14_conv;
2229 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
2232 static void LDKWatch_JCalls_free(void* this_arg) {
2233 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2234 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2236 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2237 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2241 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2242 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2243 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2244 return (void*) this_arg;
2246 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2247 jclass c = (*env)->GetObjectClass(env, o);
2249 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2250 atomic_init(&calls->refcnt, 1);
2251 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2252 calls->o = (*env)->NewWeakGlobalRef(env, o);
2253 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2254 CHECK(calls->watch_channel_meth != NULL);
2255 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2256 CHECK(calls->update_channel_meth != NULL);
2257 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2258 CHECK(calls->release_pending_monitor_events_meth != NULL);
2261 .this_arg = (void*) calls,
2262 .watch_channel = watch_channel_jcall,
2263 .update_channel = update_channel_jcall,
2264 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2265 .free = LDKWatch_JCalls_free,
2269 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2270 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2271 *res_ptr = LDKWatch_init(env, _a, o);
2272 return (long)res_ptr;
2274 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2275 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2279 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2280 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2281 LDKOutPoint funding_txo_conv;
2282 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2283 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2284 if (funding_txo_conv.inner != NULL)
2285 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2286 LDKChannelMonitor monitor_conv;
2287 monitor_conv.inner = (void*)(monitor & (~1));
2288 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2289 // Warning: we may need a move here but can't clone!
2290 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2291 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2292 return (long)ret_conv;
2295 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2296 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2297 LDKOutPoint funding_txo_conv;
2298 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2299 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2300 if (funding_txo_conv.inner != NULL)
2301 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2302 LDKChannelMonitorUpdate update_conv;
2303 update_conv.inner = (void*)(update & (~1));
2304 update_conv.is_owned = (update & 1) || (update == 0);
2305 if (update_conv.inner != NULL)
2306 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2307 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2308 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2309 return (long)ret_conv;
2312 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2313 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2314 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2315 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
2316 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
2317 for (size_t o = 0; o < ret_var.datalen; o++) {
2318 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2319 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2320 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2321 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2322 if (arr_conv_14_var.is_owned) {
2323 arr_conv_14_ref |= 1;
2325 ret_arr_ptr[o] = arr_conv_14_ref;
2327 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
2332 typedef struct LDKFilter_JCalls {
2333 atomic_size_t refcnt;
2336 jmethodID register_tx_meth;
2337 jmethodID register_output_meth;
2339 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2340 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2342 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2343 jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
2344 (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
2345 LDKu8slice script_pubkey_var = script_pubkey;
2346 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2347 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2348 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2350 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2352 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2353 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2355 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2356 long ret_outpoint = (long)outpoint;
2357 LDKu8slice script_pubkey_var = script_pubkey;
2358 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2359 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2360 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2362 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, ret_outpoint, script_pubkey_arr);
2364 static void LDKFilter_JCalls_free(void* this_arg) {
2365 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2366 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2368 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2369 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2373 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2374 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2375 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2376 return (void*) this_arg;
2378 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2379 jclass c = (*env)->GetObjectClass(env, o);
2381 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2382 atomic_init(&calls->refcnt, 1);
2383 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2384 calls->o = (*env)->NewWeakGlobalRef(env, o);
2385 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2386 CHECK(calls->register_tx_meth != NULL);
2387 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2388 CHECK(calls->register_output_meth != NULL);
2391 .this_arg = (void*) calls,
2392 .register_tx = register_tx_jcall,
2393 .register_output = register_output_jcall,
2394 .free = LDKFilter_JCalls_free,
2398 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2399 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2400 *res_ptr = LDKFilter_init(env, _a, o);
2401 return (long)res_ptr;
2403 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2404 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2409 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2410 unsigned char txid_arr[32];
2411 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2412 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2413 unsigned char (*txid_ref)[32] = &txid_arr;
2414 LDKu8slice script_pubkey_ref;
2415 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2416 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2417 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2418 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2422 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2423 LDKOutPoint outpoint_conv;
2424 outpoint_conv.inner = (void*)(outpoint & (~1));
2425 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2426 LDKu8slice script_pubkey_ref;
2427 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2428 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2429 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2430 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2433 typedef struct LDKBroadcasterInterface_JCalls {
2434 atomic_size_t refcnt;
2437 jmethodID broadcast_transaction_meth;
2438 } LDKBroadcasterInterface_JCalls;
2439 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2440 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2442 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2443 LDKTransaction *tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
2445 long tx_ref = (long)tx_copy;
2446 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2448 return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2450 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2451 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2452 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2454 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2455 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2459 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2460 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2461 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2462 return (void*) this_arg;
2464 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2465 jclass c = (*env)->GetObjectClass(env, o);
2467 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2468 atomic_init(&calls->refcnt, 1);
2469 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2470 calls->o = (*env)->NewWeakGlobalRef(env, o);
2471 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2472 CHECK(calls->broadcast_transaction_meth != NULL);
2474 LDKBroadcasterInterface ret = {
2475 .this_arg = (void*) calls,
2476 .broadcast_transaction = broadcast_transaction_jcall,
2477 .free = LDKBroadcasterInterface_JCalls_free,
2481 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2482 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2483 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2484 return (long)res_ptr;
2486 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2487 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2492 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2493 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2494 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv);
2497 typedef struct LDKFeeEstimator_JCalls {
2498 atomic_size_t refcnt;
2501 jmethodID get_est_sat_per_1000_weight_meth;
2502 } LDKFeeEstimator_JCalls;
2503 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2504 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2506 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2507 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target);
2508 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2510 return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2512 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2513 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2514 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2516 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2517 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2521 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2522 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2523 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2524 return (void*) this_arg;
2526 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2527 jclass c = (*env)->GetObjectClass(env, o);
2529 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2530 atomic_init(&calls->refcnt, 1);
2531 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2532 calls->o = (*env)->NewWeakGlobalRef(env, o);
2533 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2534 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2536 LDKFeeEstimator ret = {
2537 .this_arg = (void*) calls,
2538 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2539 .free = LDKFeeEstimator_JCalls_free,
2543 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2544 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2545 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2546 return (long)res_ptr;
2548 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2549 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2553 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) {
2554 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2555 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2556 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2560 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2561 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2562 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2564 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2565 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2566 ret->datalen = (*env)->GetArrayLength(env, elems);
2567 if (ret->datalen == 0) {
2570 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2571 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2572 for (size_t i = 0; i < ret->datalen; i++) {
2573 jlong arr_elem = java_elems[i];
2574 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2575 FREE((void*)arr_elem);
2576 ret->data[i] = arr_elem_conv;
2578 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2582 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2583 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2584 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2586 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2587 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2588 ret->datalen = (*env)->GetArrayLength(env, elems);
2589 if (ret->datalen == 0) {
2592 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2593 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2594 for (size_t i = 0; i < ret->datalen; i++) {
2595 jlong arr_elem = java_elems[i];
2596 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2597 ret->data[i] = arr_elem_conv;
2599 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2603 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2604 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2605 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2607 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2608 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2609 ret->datalen = (*env)->GetArrayLength(env, elems);
2610 if (ret->datalen == 0) {
2613 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2614 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2615 for (size_t i = 0; i < ret->datalen; i++) {
2616 jlong arr_elem = java_elems[i];
2617 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2618 FREE((void*)arr_elem);
2619 ret->data[i] = arr_elem_conv;
2621 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2625 typedef struct LDKKeysInterface_JCalls {
2626 atomic_size_t refcnt;
2629 jmethodID get_node_secret_meth;
2630 jmethodID get_destination_script_meth;
2631 jmethodID get_shutdown_pubkey_meth;
2632 jmethodID get_channel_keys_meth;
2633 jmethodID get_secure_random_bytes_meth;
2634 } LDKKeysInterface_JCalls;
2635 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2636 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2638 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2639 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2641 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth);
2642 LDKSecretKey arg_ref;
2643 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2644 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
2647 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2648 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2650 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2651 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2653 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_destination_script_meth);
2654 LDKCVec_u8Z arg_ref;
2655 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
2656 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
2659 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2660 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2662 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2663 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2665 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_shutdown_pubkey_meth);
2666 LDKPublicKey arg_ref;
2667 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
2668 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
2671 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2672 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2674 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2675 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2677 LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2678 LDKChannelKeys ret_conv = *(LDKChannelKeys*)ret;
2679 if (ret_conv.free == LDKChannelKeys_JCalls_free) {
2680 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2681 LDKChannelKeys_JCalls_clone(ret_conv.this_arg);
2685 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2686 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2688 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2689 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2691 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth);
2692 LDKThirtyTwoBytes arg_ref;
2693 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2694 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
2697 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2698 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2699 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2701 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2702 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2706 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2707 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2708 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2709 return (void*) this_arg;
2711 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2712 jclass c = (*env)->GetObjectClass(env, o);
2714 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2715 atomic_init(&calls->refcnt, 1);
2716 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2717 calls->o = (*env)->NewWeakGlobalRef(env, o);
2718 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2719 CHECK(calls->get_node_secret_meth != NULL);
2720 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2721 CHECK(calls->get_destination_script_meth != NULL);
2722 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2723 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2724 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2725 CHECK(calls->get_channel_keys_meth != NULL);
2726 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2727 CHECK(calls->get_secure_random_bytes_meth != NULL);
2729 LDKKeysInterface ret = {
2730 .this_arg = (void*) calls,
2731 .get_node_secret = get_node_secret_jcall,
2732 .get_destination_script = get_destination_script_jcall,
2733 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2734 .get_channel_keys = get_channel_keys_jcall,
2735 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2736 .free = LDKKeysInterface_JCalls_free,
2740 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2741 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2742 *res_ptr = LDKKeysInterface_init(env, _a, o);
2743 return (long)res_ptr;
2745 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2746 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2750 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2751 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2752 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2753 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2757 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2758 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2759 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2760 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2761 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2762 CVec_u8Z_free(arg_var);
2766 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2767 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2768 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2769 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2773 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) {
2774 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2775 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2776 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2780 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2781 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2782 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2783 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2787 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2788 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2789 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2790 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2791 for (size_t i = 0; i < vec->datalen; i++) {
2792 CHECK((((long)vec->data[i].inner) & 1) == 0);
2793 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2795 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2798 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2799 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2800 ret->datalen = (*env)->GetArrayLength(env, elems);
2801 if (ret->datalen == 0) {
2804 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2805 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2806 for (size_t i = 0; i < ret->datalen; i++) {
2807 jlong arr_elem = java_elems[i];
2808 LDKChannelDetails arr_elem_conv;
2809 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2810 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2811 if (arr_elem_conv.inner != NULL)
2812 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2813 ret->data[i] = arr_elem_conv;
2815 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2819 static jclass LDKNetAddress_IPv4_class = NULL;
2820 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2821 static jclass LDKNetAddress_IPv6_class = NULL;
2822 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2823 static jclass LDKNetAddress_OnionV2_class = NULL;
2824 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2825 static jclass LDKNetAddress_OnionV3_class = NULL;
2826 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2828 LDKNetAddress_IPv4_class =
2829 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2830 CHECK(LDKNetAddress_IPv4_class != NULL);
2831 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2832 CHECK(LDKNetAddress_IPv4_meth != NULL);
2833 LDKNetAddress_IPv6_class =
2834 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2835 CHECK(LDKNetAddress_IPv6_class != NULL);
2836 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2837 CHECK(LDKNetAddress_IPv6_meth != NULL);
2838 LDKNetAddress_OnionV2_class =
2839 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2840 CHECK(LDKNetAddress_OnionV2_class != NULL);
2841 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2842 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2843 LDKNetAddress_OnionV3_class =
2844 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2845 CHECK(LDKNetAddress_OnionV3_class != NULL);
2846 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2847 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2849 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
2850 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2852 case LDKNetAddress_IPv4: {
2853 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 4);
2854 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 4, obj->i_pv4.addr.data);
2855 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
2857 case LDKNetAddress_IPv6: {
2858 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 16);
2859 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 16, obj->i_pv6.addr.data);
2860 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
2862 case LDKNetAddress_OnionV2: {
2863 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 10);
2864 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 10, obj->onion_v2.addr.data);
2865 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
2867 case LDKNetAddress_OnionV3: {
2868 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
2869 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2870 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);
2875 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2876 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2877 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2880 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2881 ret->datalen = (*env)->GetArrayLength(env, elems);
2882 if (ret->datalen == 0) {
2885 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2886 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2887 for (size_t i = 0; i < ret->datalen; i++) {
2888 jlong arr_elem = java_elems[i];
2889 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2890 FREE((void*)arr_elem);
2891 ret->data[i] = arr_elem_conv;
2893 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2897 typedef struct LDKChannelMessageHandler_JCalls {
2898 atomic_size_t refcnt;
2901 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2902 jmethodID handle_open_channel_meth;
2903 jmethodID handle_accept_channel_meth;
2904 jmethodID handle_funding_created_meth;
2905 jmethodID handle_funding_signed_meth;
2906 jmethodID handle_funding_locked_meth;
2907 jmethodID handle_shutdown_meth;
2908 jmethodID handle_closing_signed_meth;
2909 jmethodID handle_update_add_htlc_meth;
2910 jmethodID handle_update_fulfill_htlc_meth;
2911 jmethodID handle_update_fail_htlc_meth;
2912 jmethodID handle_update_fail_malformed_htlc_meth;
2913 jmethodID handle_commitment_signed_meth;
2914 jmethodID handle_revoke_and_ack_meth;
2915 jmethodID handle_update_fee_meth;
2916 jmethodID handle_announcement_signatures_meth;
2917 jmethodID peer_disconnected_meth;
2918 jmethodID peer_connected_meth;
2919 jmethodID handle_channel_reestablish_meth;
2920 jmethodID handle_error_meth;
2921 } LDKChannelMessageHandler_JCalls;
2922 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
2923 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2925 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2926 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2927 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2928 LDKInitFeatures their_features_var = their_features;
2929 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2930 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2931 long their_features_ref = (long)their_features_var.inner;
2932 if (their_features_var.is_owned) {
2933 their_features_ref |= 1;
2935 long ret_msg = (long)msg;
2936 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2938 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, ret_msg);
2940 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
2941 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2943 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2944 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2945 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2946 LDKInitFeatures their_features_var = their_features;
2947 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2948 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2949 long their_features_ref = (long)their_features_var.inner;
2950 if (their_features_var.is_owned) {
2951 their_features_ref |= 1;
2953 long ret_msg = (long)msg;
2954 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2956 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, ret_msg);
2958 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
2959 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2961 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2962 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2963 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2964 long ret_msg = (long)msg;
2965 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2967 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, ret_msg);
2969 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
2970 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2972 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2973 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2974 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2975 long ret_msg = (long)msg;
2976 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2978 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, ret_msg);
2980 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
2981 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2983 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2984 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2985 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2986 long ret_msg = (long)msg;
2987 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2989 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, ret_msg);
2991 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
2992 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2994 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2995 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2996 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2997 long ret_msg = (long)msg;
2998 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3000 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, ret_msg);
3002 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
3003 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3005 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3006 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3007 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3008 long ret_msg = (long)msg;
3009 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3011 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, ret_msg);
3013 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
3014 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3016 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3017 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3018 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3019 long ret_msg = (long)msg;
3020 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3022 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, ret_msg);
3024 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
3025 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3027 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3028 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3029 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3030 long ret_msg = (long)msg;
3031 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3033 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, ret_msg);
3035 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
3036 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3038 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3039 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3040 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3041 long ret_msg = (long)msg;
3042 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3044 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, ret_msg);
3046 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
3047 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3049 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3050 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3051 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3052 long ret_msg = (long)msg;
3053 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3055 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, ret_msg);
3057 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
3058 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3060 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3061 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3062 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3063 long ret_msg = (long)msg;
3064 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3066 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, ret_msg);
3068 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
3069 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3071 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3072 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3073 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3074 long ret_msg = (long)msg;
3075 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3077 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, ret_msg);
3079 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
3080 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3082 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3083 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3084 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3085 long ret_msg = (long)msg;
3086 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3088 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, ret_msg);
3090 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
3091 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3093 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3094 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3095 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3096 long ret_msg = (long)msg;
3097 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3099 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, ret_msg);
3101 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3102 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3104 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3105 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3106 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3107 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3109 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
3111 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
3112 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3114 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3115 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3116 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3117 long ret_msg = (long)msg;
3118 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3120 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, ret_msg);
3122 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3123 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3125 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3126 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3127 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3128 long ret_msg = (long)msg;
3129 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3131 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, ret_msg);
3133 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
3134 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3136 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3137 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3138 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3139 long ret_msg = (long)msg;
3140 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3142 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, ret_msg);
3144 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3145 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3146 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3148 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3149 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3153 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3154 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3155 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3156 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3157 return (void*) this_arg;
3159 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3160 jclass c = (*env)->GetObjectClass(env, o);
3162 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3163 atomic_init(&calls->refcnt, 1);
3164 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3165 calls->o = (*env)->NewWeakGlobalRef(env, o);
3166 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3167 CHECK(calls->handle_open_channel_meth != NULL);
3168 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3169 CHECK(calls->handle_accept_channel_meth != NULL);
3170 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3171 CHECK(calls->handle_funding_created_meth != NULL);
3172 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3173 CHECK(calls->handle_funding_signed_meth != NULL);
3174 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3175 CHECK(calls->handle_funding_locked_meth != NULL);
3176 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3177 CHECK(calls->handle_shutdown_meth != NULL);
3178 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3179 CHECK(calls->handle_closing_signed_meth != NULL);
3180 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3181 CHECK(calls->handle_update_add_htlc_meth != NULL);
3182 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3183 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3184 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3185 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3186 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3187 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3188 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3189 CHECK(calls->handle_commitment_signed_meth != NULL);
3190 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3191 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3192 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3193 CHECK(calls->handle_update_fee_meth != NULL);
3194 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3195 CHECK(calls->handle_announcement_signatures_meth != NULL);
3196 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3197 CHECK(calls->peer_disconnected_meth != NULL);
3198 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3199 CHECK(calls->peer_connected_meth != NULL);
3200 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3201 CHECK(calls->handle_channel_reestablish_meth != NULL);
3202 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3203 CHECK(calls->handle_error_meth != NULL);
3205 LDKChannelMessageHandler ret = {
3206 .this_arg = (void*) calls,
3207 .handle_open_channel = handle_open_channel_jcall,
3208 .handle_accept_channel = handle_accept_channel_jcall,
3209 .handle_funding_created = handle_funding_created_jcall,
3210 .handle_funding_signed = handle_funding_signed_jcall,
3211 .handle_funding_locked = handle_funding_locked_jcall,
3212 .handle_shutdown = handle_shutdown_jcall,
3213 .handle_closing_signed = handle_closing_signed_jcall,
3214 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3215 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3216 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3217 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3218 .handle_commitment_signed = handle_commitment_signed_jcall,
3219 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3220 .handle_update_fee = handle_update_fee_jcall,
3221 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3222 .peer_disconnected = peer_disconnected_jcall,
3223 .peer_connected = peer_connected_jcall,
3224 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3225 .handle_error = handle_error_jcall,
3226 .free = LDKChannelMessageHandler_JCalls_free,
3227 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3229 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3232 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3233 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3234 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3235 return (long)res_ptr;
3237 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3238 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3242 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) {
3243 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3244 LDKPublicKey their_node_id_ref;
3245 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3246 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3247 LDKInitFeatures their_features_conv;
3248 their_features_conv.inner = (void*)(their_features & (~1));
3249 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3250 // Warning: we may need a move here but can't clone!
3251 LDKOpenChannel msg_conv;
3252 msg_conv.inner = (void*)(msg & (~1));
3253 msg_conv.is_owned = (msg & 1) || (msg == 0);
3254 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3257 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) {
3258 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3259 LDKPublicKey their_node_id_ref;
3260 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3261 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3262 LDKInitFeatures their_features_conv;
3263 their_features_conv.inner = (void*)(their_features & (~1));
3264 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3265 // Warning: we may need a move here but can't clone!
3266 LDKAcceptChannel msg_conv;
3267 msg_conv.inner = (void*)(msg & (~1));
3268 msg_conv.is_owned = (msg & 1) || (msg == 0);
3269 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3272 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) {
3273 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3274 LDKPublicKey their_node_id_ref;
3275 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3276 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3277 LDKFundingCreated msg_conv;
3278 msg_conv.inner = (void*)(msg & (~1));
3279 msg_conv.is_owned = (msg & 1) || (msg == 0);
3280 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3283 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) {
3284 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3285 LDKPublicKey their_node_id_ref;
3286 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3287 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3288 LDKFundingSigned msg_conv;
3289 msg_conv.inner = (void*)(msg & (~1));
3290 msg_conv.is_owned = (msg & 1) || (msg == 0);
3291 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3294 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) {
3295 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3296 LDKPublicKey their_node_id_ref;
3297 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3298 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3299 LDKFundingLocked msg_conv;
3300 msg_conv.inner = (void*)(msg & (~1));
3301 msg_conv.is_owned = (msg & 1) || (msg == 0);
3302 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3306 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3307 LDKPublicKey their_node_id_ref;
3308 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3309 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3310 LDKShutdown msg_conv;
3311 msg_conv.inner = (void*)(msg & (~1));
3312 msg_conv.is_owned = (msg & 1) || (msg == 0);
3313 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3316 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) {
3317 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3318 LDKPublicKey their_node_id_ref;
3319 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3320 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3321 LDKClosingSigned msg_conv;
3322 msg_conv.inner = (void*)(msg & (~1));
3323 msg_conv.is_owned = (msg & 1) || (msg == 0);
3324 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3327 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) {
3328 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3329 LDKPublicKey their_node_id_ref;
3330 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3331 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3332 LDKUpdateAddHTLC msg_conv;
3333 msg_conv.inner = (void*)(msg & (~1));
3334 msg_conv.is_owned = (msg & 1) || (msg == 0);
3335 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3338 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) {
3339 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3340 LDKPublicKey their_node_id_ref;
3341 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3342 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3343 LDKUpdateFulfillHTLC msg_conv;
3344 msg_conv.inner = (void*)(msg & (~1));
3345 msg_conv.is_owned = (msg & 1) || (msg == 0);
3346 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3349 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) {
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 LDKUpdateFailHTLC msg_conv;
3355 msg_conv.inner = (void*)(msg & (~1));
3356 msg_conv.is_owned = (msg & 1) || (msg == 0);
3357 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3360 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) {
3361 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3362 LDKPublicKey their_node_id_ref;
3363 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3364 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3365 LDKUpdateFailMalformedHTLC msg_conv;
3366 msg_conv.inner = (void*)(msg & (~1));
3367 msg_conv.is_owned = (msg & 1) || (msg == 0);
3368 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3371 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) {
3372 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3373 LDKPublicKey their_node_id_ref;
3374 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3375 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3376 LDKCommitmentSigned msg_conv;
3377 msg_conv.inner = (void*)(msg & (~1));
3378 msg_conv.is_owned = (msg & 1) || (msg == 0);
3379 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3382 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) {
3383 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3384 LDKPublicKey their_node_id_ref;
3385 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3386 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3387 LDKRevokeAndACK msg_conv;
3388 msg_conv.inner = (void*)(msg & (~1));
3389 msg_conv.is_owned = (msg & 1) || (msg == 0);
3390 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3393 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) {
3394 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3395 LDKPublicKey their_node_id_ref;
3396 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3397 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3398 LDKUpdateFee msg_conv;
3399 msg_conv.inner = (void*)(msg & (~1));
3400 msg_conv.is_owned = (msg & 1) || (msg == 0);
3401 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3404 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) {
3405 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3406 LDKPublicKey their_node_id_ref;
3407 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3408 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3409 LDKAnnouncementSignatures msg_conv;
3410 msg_conv.inner = (void*)(msg & (~1));
3411 msg_conv.is_owned = (msg & 1) || (msg == 0);
3412 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3415 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) {
3416 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3417 LDKPublicKey their_node_id_ref;
3418 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3419 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3420 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(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);
3429 msg_conv.inner = (void*)(msg & (~1));
3430 msg_conv.is_owned = (msg & 1) || (msg == 0);
3431 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3434 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) {
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 LDKChannelReestablish msg_conv;
3440 msg_conv.inner = (void*)(msg & (~1));
3441 msg_conv.is_owned = (msg & 1) || (msg == 0);
3442 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(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 LDKErrorMessage msg_conv;
3451 msg_conv.inner = (void*)(msg & (~1));
3452 msg_conv.is_owned = (msg & 1) || (msg == 0);
3453 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3456 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3457 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3458 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3459 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3460 for (size_t i = 0; i < vec->datalen; i++) {
3461 CHECK((((long)vec->data[i].inner) & 1) == 0);
3462 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3464 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3467 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3468 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3469 ret->datalen = (*env)->GetArrayLength(env, elems);
3470 if (ret->datalen == 0) {
3473 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3474 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3475 for (size_t i = 0; i < ret->datalen; i++) {
3476 jlong arr_elem = java_elems[i];
3477 LDKChannelMonitor arr_elem_conv;
3478 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3479 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3480 // Warning: we may need a move here but can't clone!
3481 ret->data[i] = arr_elem_conv;
3483 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3487 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3488 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3489 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3491 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3492 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3493 ret->datalen = (*env)->GetArrayLength(env, elems);
3494 if (ret->datalen == 0) {
3497 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3498 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3499 for (size_t i = 0; i < ret->datalen; i++) {
3500 ret->data[i] = java_elems[i];
3502 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3506 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3507 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3508 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3509 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3510 for (size_t i = 0; i < vec->datalen; i++) {
3511 CHECK((((long)vec->data[i].inner) & 1) == 0);
3512 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3514 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3517 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3518 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3519 ret->datalen = (*env)->GetArrayLength(env, elems);
3520 if (ret->datalen == 0) {
3523 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3524 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3525 for (size_t i = 0; i < ret->datalen; i++) {
3526 jlong arr_elem = java_elems[i];
3527 LDKUpdateAddHTLC arr_elem_conv;
3528 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3529 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3530 if (arr_elem_conv.inner != NULL)
3531 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3532 ret->data[i] = arr_elem_conv;
3534 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3538 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3539 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3540 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3541 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3542 for (size_t i = 0; i < vec->datalen; i++) {
3543 CHECK((((long)vec->data[i].inner) & 1) == 0);
3544 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3546 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3549 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3550 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3551 ret->datalen = (*env)->GetArrayLength(env, elems);
3552 if (ret->datalen == 0) {
3555 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3556 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3557 for (size_t i = 0; i < ret->datalen; i++) {
3558 jlong arr_elem = java_elems[i];
3559 LDKUpdateFulfillHTLC arr_elem_conv;
3560 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3561 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3562 if (arr_elem_conv.inner != NULL)
3563 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3564 ret->data[i] = arr_elem_conv;
3566 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3570 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3571 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3572 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3573 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3574 for (size_t i = 0; i < vec->datalen; i++) {
3575 CHECK((((long)vec->data[i].inner) & 1) == 0);
3576 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3578 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3581 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3582 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3583 ret->datalen = (*env)->GetArrayLength(env, elems);
3584 if (ret->datalen == 0) {
3587 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3588 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3589 for (size_t i = 0; i < ret->datalen; i++) {
3590 jlong arr_elem = java_elems[i];
3591 LDKUpdateFailHTLC arr_elem_conv;
3592 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3593 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3594 if (arr_elem_conv.inner != NULL)
3595 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3596 ret->data[i] = arr_elem_conv;
3598 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3602 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3603 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3604 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3605 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3606 for (size_t i = 0; i < vec->datalen; i++) {
3607 CHECK((((long)vec->data[i].inner) & 1) == 0);
3608 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3610 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3613 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3614 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3615 ret->datalen = (*env)->GetArrayLength(env, elems);
3616 if (ret->datalen == 0) {
3619 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3620 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3621 for (size_t i = 0; i < ret->datalen; i++) {
3622 jlong arr_elem = java_elems[i];
3623 LDKUpdateFailMalformedHTLC arr_elem_conv;
3624 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3625 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3626 if (arr_elem_conv.inner != NULL)
3627 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3628 ret->data[i] = arr_elem_conv;
3630 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3635 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3638 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3639 CHECK(val->result_ok);
3640 return *val->contents.result;
3642 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3643 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3644 CHECK(!val->result_ok);
3645 LDKLightningError err_var = (*val->contents.err);
3646 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3647 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3648 long err_ref = (long)err_var.inner & ~1;
3651 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3652 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3653 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3655 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3656 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3657 ret->datalen = (*env)->GetArrayLength(env, elems);
3658 if (ret->datalen == 0) {
3661 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3662 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3663 for (size_t i = 0; i < ret->datalen; i++) {
3664 jlong arr_elem = java_elems[i];
3665 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3666 FREE((void*)arr_elem);
3667 ret->data[i] = arr_elem_conv;
3669 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3673 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3674 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3675 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3676 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3677 for (size_t i = 0; i < vec->datalen; i++) {
3678 CHECK((((long)vec->data[i].inner) & 1) == 0);
3679 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3681 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3684 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3685 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3686 ret->datalen = (*env)->GetArrayLength(env, elems);
3687 if (ret->datalen == 0) {
3690 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3691 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3692 for (size_t i = 0; i < ret->datalen; i++) {
3693 jlong arr_elem = java_elems[i];
3694 LDKNodeAnnouncement arr_elem_conv;
3695 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3696 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3697 if (arr_elem_conv.inner != NULL)
3698 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3699 ret->data[i] = arr_elem_conv;
3701 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3705 typedef struct LDKRoutingMessageHandler_JCalls {
3706 atomic_size_t refcnt;
3709 jmethodID handle_node_announcement_meth;
3710 jmethodID handle_channel_announcement_meth;
3711 jmethodID handle_channel_update_meth;
3712 jmethodID handle_htlc_fail_channel_update_meth;
3713 jmethodID get_next_channel_announcements_meth;
3714 jmethodID get_next_node_announcements_meth;
3715 jmethodID should_request_full_sync_meth;
3716 } LDKRoutingMessageHandler_JCalls;
3717 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3718 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3720 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3721 long ret_msg = (long)msg;
3722 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3724 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, ret_msg);
3725 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
3729 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3730 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3732 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3733 long ret_msg = (long)msg;
3734 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3736 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, ret_msg);
3737 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
3741 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3742 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3744 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3745 long ret_msg = (long)msg;
3746 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3748 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, ret_msg);
3749 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
3753 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3754 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3756 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3757 long ret_update = (long)update;
3758 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3760 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
3762 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3763 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3765 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3766 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3768 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3769 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
3770 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
3771 if (arg_constr.datalen > 0)
3772 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
3774 arg_constr.data = NULL;
3775 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
3776 for (size_t l = 0; l < arg_constr.datalen; l++) {
3777 long arr_conv_63 = arg_vals[l];
3778 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
3779 FREE((void*)arr_conv_63);
3780 arg_constr.data[l] = arr_conv_63_conv;
3782 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
3785 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3786 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3788 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3789 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
3790 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
3791 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3793 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3794 LDKCVec_NodeAnnouncementZ arg_constr;
3795 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
3796 if (arg_constr.datalen > 0)
3797 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
3799 arg_constr.data = NULL;
3800 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
3801 for (size_t s = 0; s < arg_constr.datalen; s++) {
3802 long arr_conv_18 = arg_vals[s];
3803 LDKNodeAnnouncement arr_conv_18_conv;
3804 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
3805 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
3806 if (arr_conv_18_conv.inner != NULL)
3807 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
3808 arg_constr.data[s] = arr_conv_18_conv;
3810 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
3813 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3814 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3816 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3817 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
3818 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form);
3819 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3821 return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3823 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3824 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3825 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3827 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3828 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3832 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3833 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3834 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3835 return (void*) this_arg;
3837 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3838 jclass c = (*env)->GetObjectClass(env, o);
3840 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3841 atomic_init(&calls->refcnt, 1);
3842 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3843 calls->o = (*env)->NewWeakGlobalRef(env, o);
3844 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3845 CHECK(calls->handle_node_announcement_meth != NULL);
3846 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3847 CHECK(calls->handle_channel_announcement_meth != NULL);
3848 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3849 CHECK(calls->handle_channel_update_meth != NULL);
3850 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3851 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
3852 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
3853 CHECK(calls->get_next_channel_announcements_meth != NULL);
3854 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
3855 CHECK(calls->get_next_node_announcements_meth != NULL);
3856 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3857 CHECK(calls->should_request_full_sync_meth != NULL);
3859 LDKRoutingMessageHandler ret = {
3860 .this_arg = (void*) calls,
3861 .handle_node_announcement = handle_node_announcement_jcall,
3862 .handle_channel_announcement = handle_channel_announcement_jcall,
3863 .handle_channel_update = handle_channel_update_jcall,
3864 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3865 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3866 .get_next_node_announcements = get_next_node_announcements_jcall,
3867 .should_request_full_sync = should_request_full_sync_jcall,
3868 .free = LDKRoutingMessageHandler_JCalls_free,
3872 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3873 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3874 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3875 return (long)res_ptr;
3877 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3878 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3882 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3883 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3884 LDKNodeAnnouncement msg_conv;
3885 msg_conv.inner = (void*)(msg & (~1));
3886 msg_conv.is_owned = (msg & 1) || (msg == 0);
3887 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3888 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
3889 return (long)ret_conv;
3892 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3893 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3894 LDKChannelAnnouncement msg_conv;
3895 msg_conv.inner = (void*)(msg & (~1));
3896 msg_conv.is_owned = (msg & 1) || (msg == 0);
3897 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3898 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3899 return (long)ret_conv;
3902 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3903 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3904 LDKChannelUpdate msg_conv;
3905 msg_conv.inner = (void*)(msg & (~1));
3906 msg_conv.is_owned = (msg & 1) || (msg == 0);
3907 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3908 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
3909 return (long)ret_conv;
3912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
3913 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3914 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3915 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
3918 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) {
3919 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3920 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
3921 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
3922 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
3923 for (size_t l = 0; l < ret_var.datalen; l++) {
3924 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3925 *arr_conv_63_ref = ret_var.data[l];
3926 ret_arr_ptr[l] = (long)arr_conv_63_ref;
3928 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
3929 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(ret_var);
3933 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) {
3934 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3935 LDKPublicKey starting_point_ref;
3936 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
3937 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
3938 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
3939 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
3940 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
3941 for (size_t s = 0; s < ret_var.datalen; s++) {
3942 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
3943 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3944 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3945 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
3946 if (arr_conv_18_var.is_owned) {
3947 arr_conv_18_ref |= 1;
3949 ret_arr_ptr[s] = arr_conv_18_ref;
3951 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
3956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
3957 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3958 LDKPublicKey node_id_ref;
3959 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
3960 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
3961 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
3965 typedef struct LDKSocketDescriptor_JCalls {
3966 atomic_size_t refcnt;
3969 jmethodID send_data_meth;
3970 jmethodID disconnect_socket_meth;
3972 jmethodID hash_meth;
3973 } LDKSocketDescriptor_JCalls;
3974 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
3975 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3977 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3978 LDKu8slice data_var = data;
3979 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
3980 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
3981 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3983 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
3985 void disconnect_socket_jcall(void* this_arg) {
3986 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3988 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3989 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3991 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
3993 bool eq_jcall(const void* this_arg, const void *other_arg) {
3994 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3996 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3997 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3999 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, other_arg);
4001 uint64_t hash_jcall(const void* this_arg) {
4002 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4004 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4005 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4007 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
4009 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
4010 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4011 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4013 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4014 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4018 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
4019 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4020 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4021 return (void*) this_arg;
4023 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
4024 jclass c = (*env)->GetObjectClass(env, o);
4026 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
4027 atomic_init(&calls->refcnt, 1);
4028 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4029 calls->o = (*env)->NewWeakGlobalRef(env, o);
4030 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
4031 CHECK(calls->send_data_meth != NULL);
4032 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
4033 CHECK(calls->disconnect_socket_meth != NULL);
4034 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
4035 CHECK(calls->eq_meth != NULL);
4036 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
4037 CHECK(calls->hash_meth != NULL);
4039 LDKSocketDescriptor ret = {
4040 .this_arg = (void*) calls,
4041 .send_data = send_data_jcall,
4042 .disconnect_socket = disconnect_socket_jcall,
4045 .clone = LDKSocketDescriptor_JCalls_clone,
4046 .free = LDKSocketDescriptor_JCalls_free,
4050 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
4051 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4052 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
4053 return (long)res_ptr;
4055 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4056 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
4060 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
4061 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4062 LDKu8slice data_ref;
4063 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
4064 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
4065 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4066 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
4070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
4071 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4072 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4075 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
4076 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4077 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4081 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4082 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
4083 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
4085 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4086 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4088 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4089 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4090 CHECK(val->result_ok);
4091 LDKCVecTempl_u8 res_var = (*val->contents.result);
4092 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
4093 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
4096 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4097 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4098 CHECK(!val->result_ok);
4099 LDKPeerHandleError err_var = (*val->contents.err);
4100 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4101 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4102 long err_ref = (long)err_var.inner & ~1;
4105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4106 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4108 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4109 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4110 CHECK(val->result_ok);
4111 return *val->contents.result;
4113 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4114 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4115 CHECK(!val->result_ok);
4116 LDKPeerHandleError err_var = (*val->contents.err);
4117 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4118 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4119 long err_ref = (long)err_var.inner & ~1;
4122 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4123 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
4125 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4126 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4127 CHECK(val->result_ok);
4128 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
4129 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
4132 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4133 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4134 CHECK(!val->result_ok);
4135 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4138 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4139 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
4141 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4142 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4143 CHECK(val->result_ok);
4144 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
4145 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
4148 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4149 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4150 CHECK(!val->result_ok);
4151 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4155 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
4157 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4158 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4159 CHECK(val->result_ok);
4160 LDKTxCreationKeys res_var = (*val->contents.result);
4161 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4162 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4163 long res_ref = (long)res_var.inner & ~1;
4166 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4167 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4168 CHECK(!val->result_ok);
4169 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4172 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4173 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4174 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4176 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4177 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4178 ret->datalen = (*env)->GetArrayLength(env, elems);
4179 if (ret->datalen == 0) {
4182 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4183 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4184 for (size_t i = 0; i < ret->datalen; i++) {
4185 jlong arr_elem = java_elems[i];
4186 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4187 FREE((void*)arr_elem);
4188 ret->data[i] = arr_elem_conv;
4190 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4194 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4195 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4196 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4197 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4198 for (size_t i = 0; i < vec->datalen; i++) {
4199 CHECK((((long)vec->data[i].inner) & 1) == 0);
4200 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4202 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4205 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4206 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4207 ret->datalen = (*env)->GetArrayLength(env, elems);
4208 if (ret->datalen == 0) {
4211 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4212 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4213 for (size_t i = 0; i < ret->datalen; i++) {
4214 jlong arr_elem = java_elems[i];
4215 LDKRouteHop arr_elem_conv;
4216 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4217 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4218 if (arr_elem_conv.inner != NULL)
4219 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4220 ret->data[i] = arr_elem_conv;
4222 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4226 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4227 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4228 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4231 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4233 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4234 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4235 CHECK(val->result_ok);
4236 LDKRoute res_var = (*val->contents.result);
4237 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4238 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4239 long res_ref = (long)res_var.inner & ~1;
4242 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4243 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4244 CHECK(!val->result_ok);
4245 LDKLightningError err_var = (*val->contents.err);
4246 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4247 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4248 long err_ref = (long)err_var.inner & ~1;
4251 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4252 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4253 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4254 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4255 for (size_t i = 0; i < vec->datalen; i++) {
4256 CHECK((((long)vec->data[i].inner) & 1) == 0);
4257 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4259 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4262 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4263 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4264 ret->datalen = (*env)->GetArrayLength(env, elems);
4265 if (ret->datalen == 0) {
4268 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4269 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4270 for (size_t i = 0; i < ret->datalen; i++) {
4271 jlong arr_elem = java_elems[i];
4272 LDKRouteHint arr_elem_conv;
4273 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4274 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4275 if (arr_elem_conv.inner != NULL)
4276 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4277 ret->data[i] = arr_elem_conv;
4279 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4284 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4286 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4290 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4292 C2Tuple_OutPointScriptZ_free(arg_conv);
4295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4296 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4298 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4302 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4304 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4308 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4310 C2Tuple_u64u64Z_free(arg_conv);
4313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4314 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4316 C2Tuple_usizeTransactionZ_free(arg_conv);
4319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4320 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4322 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4326 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4328 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4331 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4332 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4334 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4335 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4336 return (long)ret_conv;
4339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4340 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4342 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4345 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray arg) {
4346 LDKCVec_SignatureZ arg_constr;
4347 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4348 if (arg_constr.datalen > 0)
4349 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4351 arg_constr.data = NULL;
4352 for (size_t i = 0; i < arg_constr.datalen; i++) {
4353 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4354 LDKSignature arr_conv_8_ref;
4355 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4356 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4357 arg_constr.data[i] = arr_conv_8_ref;
4359 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4360 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(arg_constr);
4361 return (long)ret_conv;
4364 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4365 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4367 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4368 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4369 return (long)ret_conv;
4372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4373 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4375 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4378 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4379 LDKCVec_u8Z arg_ref;
4380 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
4381 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4382 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4383 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4384 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
4385 return (long)ret_conv;
4388 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4389 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4391 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4392 *ret_conv = CResult_NoneAPIErrorZ_err(arg_conv);
4393 return (long)ret_conv;
4396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4397 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4399 CResult_NoneAPIErrorZ_free(arg_conv);
4402 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4403 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4405 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4406 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4407 return (long)ret_conv;
4410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4411 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4413 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4416 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4417 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4419 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4420 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4421 return (long)ret_conv;
4424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4425 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4427 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4430 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4431 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4433 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4434 *ret_conv = CResult_NonePaymentSendFailureZ_err(arg_conv);
4435 return (long)ret_conv;
4438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4439 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4441 CResult_NonePaymentSendFailureZ_free(arg_conv);
4444 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4445 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4447 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4448 *ret_conv = CResult_NonePeerHandleErrorZ_err(arg_conv);
4449 return (long)ret_conv;
4452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4453 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4455 CResult_NonePeerHandleErrorZ_free(arg_conv);
4458 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4459 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4461 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4462 *ret_conv = CResult_PublicKeySecpErrorZ_err(arg_conv);
4463 return (long)ret_conv;
4466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4467 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4469 CResult_PublicKeySecpErrorZ_free(arg_conv);
4472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4473 LDKPublicKey arg_ref;
4474 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4475 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4476 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4477 *ret_conv = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4478 return (long)ret_conv;
4481 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4482 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4484 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4485 *ret_conv = CResult_RouteLightningErrorZ_err(arg_conv);
4486 return (long)ret_conv;
4489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4490 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4492 CResult_RouteLightningErrorZ_free(arg_conv);
4495 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4496 LDKRoute arg_conv = *(LDKRoute*)arg;
4498 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4499 *ret_conv = CResult_RouteLightningErrorZ_ok(arg_conv);
4500 return (long)ret_conv;
4503 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4504 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4506 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4507 *ret_conv = CResult_SecretKeySecpErrorZ_err(arg_conv);
4508 return (long)ret_conv;
4511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4512 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4514 CResult_SecretKeySecpErrorZ_free(arg_conv);
4517 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4518 LDKSecretKey arg_ref;
4519 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4520 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4521 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4522 *ret_conv = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4523 return (long)ret_conv;
4526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4527 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4529 CResult_SignatureNoneZ_free(arg_conv);
4532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4533 LDKSignature arg_ref;
4534 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4535 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4536 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4537 *ret_conv = CResult_SignatureNoneZ_ok(arg_ref);
4538 return (long)ret_conv;
4541 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4542 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4544 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4545 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4546 return (long)ret_conv;
4549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4550 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4552 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4555 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4556 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4558 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4559 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4560 return (long)ret_conv;
4563 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4564 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4566 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4567 *ret_conv = CResult_TxOutAccessErrorZ_err(arg_conv);
4568 return (long)ret_conv;
4571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4572 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4574 CResult_TxOutAccessErrorZ_free(arg_conv);
4577 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4578 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4580 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4581 *ret_conv = CResult_TxOutAccessErrorZ_ok(arg_conv);
4582 return (long)ret_conv;
4585 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4586 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4588 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4589 *ret_conv = CResult_boolLightningErrorZ_err(arg_conv);
4590 return (long)ret_conv;
4593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4594 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4596 CResult_boolLightningErrorZ_free(arg_conv);
4599 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4600 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4601 *ret_conv = CResult_boolLightningErrorZ_ok(arg);
4602 return (long)ret_conv;
4605 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4606 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4608 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4609 *ret_conv = CResult_boolPeerHandleErrorZ_err(arg_conv);
4610 return (long)ret_conv;
4613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4614 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4616 CResult_boolPeerHandleErrorZ_free(arg_conv);
4619 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4620 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4621 *ret_conv = CResult_boolPeerHandleErrorZ_ok(arg);
4622 return (long)ret_conv;
4625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4626 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_constr;
4627 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4628 if (arg_constr.datalen > 0)
4629 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
4631 arg_constr.data = NULL;
4632 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4633 for (size_t q = 0; q < arg_constr.datalen; q++) {
4634 long arr_conv_42 = arg_vals[q];
4635 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
4636 FREE((void*)arr_conv_42);
4637 arg_constr.data[q] = arr_conv_42_conv;
4639 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4640 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_constr);
4643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4644 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_constr;
4645 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4646 if (arg_constr.datalen > 0)
4647 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ Elements");
4649 arg_constr.data = NULL;
4650 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4651 for (size_t b = 0; b < arg_constr.datalen; b++) {
4652 long arr_conv_27 = arg_vals[b];
4653 LDKC2Tuple_TxidCVec_TxOutZZ arr_conv_27_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arr_conv_27;
4654 FREE((void*)arr_conv_27);
4655 arg_constr.data[b] = arr_conv_27_conv;
4657 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4658 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_constr);
4661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4662 LDKCVec_C2Tuple_usizeTransactionZZ arg_constr;
4663 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4664 if (arg_constr.datalen > 0)
4665 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
4667 arg_constr.data = NULL;
4668 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4669 for (size_t d = 0; d < arg_constr.datalen; d++) {
4670 long arr_conv_29 = arg_vals[d];
4671 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
4672 FREE((void*)arr_conv_29);
4673 arg_constr.data[d] = arr_conv_29_conv;
4675 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4676 CVec_C2Tuple_usizeTransactionZZ_free(arg_constr);
4679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4680 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4681 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4682 if (arg_constr.datalen > 0)
4683 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4685 arg_constr.data = NULL;
4686 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4687 for (size_t l = 0; l < arg_constr.datalen; l++) {
4688 long arr_conv_63 = arg_vals[l];
4689 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4690 FREE((void*)arr_conv_63);
4691 arg_constr.data[l] = arr_conv_63_conv;
4693 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4694 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_constr);
4697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4698 LDKCVec_CVec_RouteHopZZ arg_constr;
4699 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4700 if (arg_constr.datalen > 0)
4701 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
4703 arg_constr.data = NULL;
4704 for (size_t m = 0; m < arg_constr.datalen; m++) {
4705 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, arg, m);
4706 LDKCVec_RouteHopZ arr_conv_12_constr;
4707 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
4708 if (arr_conv_12_constr.datalen > 0)
4709 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4711 arr_conv_12_constr.data = NULL;
4712 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
4713 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
4714 long arr_conv_10 = arr_conv_12_vals[k];
4715 LDKRouteHop arr_conv_10_conv;
4716 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4717 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4718 arr_conv_12_constr.data[k] = arr_conv_10_conv;
4720 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
4721 arg_constr.data[m] = arr_conv_12_constr;
4723 CVec_CVec_RouteHopZZ_free(arg_constr);
4726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4727 LDKCVec_ChannelDetailsZ arg_constr;
4728 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4729 if (arg_constr.datalen > 0)
4730 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
4732 arg_constr.data = NULL;
4733 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4734 for (size_t q = 0; q < arg_constr.datalen; q++) {
4735 long arr_conv_16 = arg_vals[q];
4736 LDKChannelDetails arr_conv_16_conv;
4737 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4738 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4739 arg_constr.data[q] = arr_conv_16_conv;
4741 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4742 CVec_ChannelDetailsZ_free(arg_constr);
4745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4746 LDKCVec_ChannelMonitorZ arg_constr;
4747 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4748 if (arg_constr.datalen > 0)
4749 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
4751 arg_constr.data = NULL;
4752 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4753 for (size_t q = 0; q < arg_constr.datalen; q++) {
4754 long arr_conv_16 = arg_vals[q];
4755 LDKChannelMonitor arr_conv_16_conv;
4756 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4757 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4758 arg_constr.data[q] = arr_conv_16_conv;
4760 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4761 CVec_ChannelMonitorZ_free(arg_constr);
4764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4765 LDKCVec_EventZ arg_constr;
4766 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4767 if (arg_constr.datalen > 0)
4768 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4770 arg_constr.data = NULL;
4771 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4772 for (size_t h = 0; h < arg_constr.datalen; h++) {
4773 long arr_conv_7 = arg_vals[h];
4774 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
4775 FREE((void*)arr_conv_7);
4776 arg_constr.data[h] = arr_conv_7_conv;
4778 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4779 CVec_EventZ_free(arg_constr);
4782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4783 LDKCVec_HTLCOutputInCommitmentZ arg_constr;
4784 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4785 if (arg_constr.datalen > 0)
4786 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
4788 arg_constr.data = NULL;
4789 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4790 for (size_t y = 0; y < arg_constr.datalen; y++) {
4791 long arr_conv_24 = arg_vals[y];
4792 LDKHTLCOutputInCommitment arr_conv_24_conv;
4793 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
4794 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
4795 arg_constr.data[y] = arr_conv_24_conv;
4797 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4798 CVec_HTLCOutputInCommitmentZ_free(arg_constr);
4801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4802 LDKCVec_MessageSendEventZ arg_constr;
4803 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4804 if (arg_constr.datalen > 0)
4805 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4807 arg_constr.data = NULL;
4808 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4809 for (size_t s = 0; s < arg_constr.datalen; s++) {
4810 long arr_conv_18 = arg_vals[s];
4811 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
4812 FREE((void*)arr_conv_18);
4813 arg_constr.data[s] = arr_conv_18_conv;
4815 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4816 CVec_MessageSendEventZ_free(arg_constr);
4819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4820 LDKCVec_MonitorEventZ arg_constr;
4821 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4822 if (arg_constr.datalen > 0)
4823 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
4825 arg_constr.data = NULL;
4826 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4827 for (size_t o = 0; o < arg_constr.datalen; o++) {
4828 long arr_conv_14 = arg_vals[o];
4829 LDKMonitorEvent arr_conv_14_conv;
4830 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
4831 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
4832 arg_constr.data[o] = arr_conv_14_conv;
4834 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4835 CVec_MonitorEventZ_free(arg_constr);
4838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4839 LDKCVec_NetAddressZ arg_constr;
4840 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4841 if (arg_constr.datalen > 0)
4842 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
4844 arg_constr.data = NULL;
4845 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4846 for (size_t m = 0; m < arg_constr.datalen; m++) {
4847 long arr_conv_12 = arg_vals[m];
4848 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
4849 FREE((void*)arr_conv_12);
4850 arg_constr.data[m] = arr_conv_12_conv;
4852 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4853 CVec_NetAddressZ_free(arg_constr);
4856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4857 LDKCVec_NodeAnnouncementZ arg_constr;
4858 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4859 if (arg_constr.datalen > 0)
4860 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4862 arg_constr.data = NULL;
4863 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4864 for (size_t s = 0; s < arg_constr.datalen; s++) {
4865 long arr_conv_18 = arg_vals[s];
4866 LDKNodeAnnouncement arr_conv_18_conv;
4867 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4868 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4869 arg_constr.data[s] = arr_conv_18_conv;
4871 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4872 CVec_NodeAnnouncementZ_free(arg_constr);
4875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4876 LDKCVec_PublicKeyZ arg_constr;
4877 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4878 if (arg_constr.datalen > 0)
4879 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
4881 arg_constr.data = NULL;
4882 for (size_t i = 0; i < arg_constr.datalen; i++) {
4883 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4884 LDKPublicKey arr_conv_8_ref;
4885 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
4886 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
4887 arg_constr.data[i] = arr_conv_8_ref;
4889 CVec_PublicKeyZ_free(arg_constr);
4892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4893 LDKCVec_RouteHintZ arg_constr;
4894 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4895 if (arg_constr.datalen > 0)
4896 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
4898 arg_constr.data = NULL;
4899 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4900 for (size_t l = 0; l < arg_constr.datalen; l++) {
4901 long arr_conv_11 = arg_vals[l];
4902 LDKRouteHint arr_conv_11_conv;
4903 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
4904 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
4905 arg_constr.data[l] = arr_conv_11_conv;
4907 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4908 CVec_RouteHintZ_free(arg_constr);
4911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4912 LDKCVec_RouteHopZ arg_constr;
4913 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4914 if (arg_constr.datalen > 0)
4915 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4917 arg_constr.data = NULL;
4918 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4919 for (size_t k = 0; k < arg_constr.datalen; k++) {
4920 long arr_conv_10 = arg_vals[k];
4921 LDKRouteHop arr_conv_10_conv;
4922 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4923 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4924 arg_constr.data[k] = arr_conv_10_conv;
4926 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4927 CVec_RouteHopZ_free(arg_constr);
4930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4931 LDKCVec_SignatureZ arg_constr;
4932 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4933 if (arg_constr.datalen > 0)
4934 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4936 arg_constr.data = NULL;
4937 for (size_t i = 0; i < arg_constr.datalen; i++) {
4938 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4939 LDKSignature arr_conv_8_ref;
4940 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4941 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4942 arg_constr.data[i] = arr_conv_8_ref;
4944 CVec_SignatureZ_free(arg_constr);
4947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4948 LDKCVec_SpendableOutputDescriptorZ arg_constr;
4949 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4950 if (arg_constr.datalen > 0)
4951 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
4953 arg_constr.data = NULL;
4954 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4955 for (size_t b = 0; b < arg_constr.datalen; b++) {
4956 long arr_conv_27 = arg_vals[b];
4957 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
4958 FREE((void*)arr_conv_27);
4959 arg_constr.data[b] = arr_conv_27_conv;
4961 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4962 CVec_SpendableOutputDescriptorZ_free(arg_constr);
4965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4966 LDKCVec_TransactionZ arg_constr;
4967 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4968 if (arg_constr.datalen > 0)
4969 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
4971 arg_constr.data = NULL;
4972 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4973 for (size_t n = 0; n < arg_constr.datalen; n++) {
4974 long arr_conv_13 = arg_vals[n];
4975 LDKTransaction arr_conv_13_conv = *(LDKTransaction*)arr_conv_13;
4976 arg_constr.data[n] = arr_conv_13_conv;
4978 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4979 CVec_TransactionZ_free(arg_constr);
4982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4983 LDKCVec_TxOutZ 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(LDKTxOut), "LDKCVec_TxOutZ Elements");
4988 arg_constr.data = NULL;
4989 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4990 for (size_t h = 0; h < arg_constr.datalen; h++) {
4991 long arr_conv_7 = arg_vals[h];
4992 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
4993 FREE((void*)arr_conv_7);
4994 arg_constr.data[h] = arr_conv_7_conv;
4996 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4997 CVec_TxOutZ_free(arg_constr);
5000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5001 LDKCVec_UpdateAddHTLCZ arg_constr;
5002 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5003 if (arg_constr.datalen > 0)
5004 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
5006 arg_constr.data = NULL;
5007 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5008 for (size_t p = 0; p < arg_constr.datalen; p++) {
5009 long arr_conv_15 = arg_vals[p];
5010 LDKUpdateAddHTLC arr_conv_15_conv;
5011 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
5012 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
5013 arg_constr.data[p] = arr_conv_15_conv;
5015 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5016 CVec_UpdateAddHTLCZ_free(arg_constr);
5019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5020 LDKCVec_UpdateFailHTLCZ arg_constr;
5021 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5022 if (arg_constr.datalen > 0)
5023 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
5025 arg_constr.data = NULL;
5026 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5027 for (size_t q = 0; q < arg_constr.datalen; q++) {
5028 long arr_conv_16 = arg_vals[q];
5029 LDKUpdateFailHTLC arr_conv_16_conv;
5030 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5031 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5032 arg_constr.data[q] = arr_conv_16_conv;
5034 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5035 CVec_UpdateFailHTLCZ_free(arg_constr);
5038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5039 LDKCVec_UpdateFailMalformedHTLCZ arg_constr;
5040 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5041 if (arg_constr.datalen > 0)
5042 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
5044 arg_constr.data = NULL;
5045 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5046 for (size_t z = 0; z < arg_constr.datalen; z++) {
5047 long arr_conv_25 = arg_vals[z];
5048 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
5049 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
5050 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
5051 arg_constr.data[z] = arr_conv_25_conv;
5053 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5054 CVec_UpdateFailMalformedHTLCZ_free(arg_constr);
5057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5058 LDKCVec_UpdateFulfillHTLCZ arg_constr;
5059 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5060 if (arg_constr.datalen > 0)
5061 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
5063 arg_constr.data = NULL;
5064 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5065 for (size_t t = 0; t < arg_constr.datalen; t++) {
5066 long arr_conv_19 = arg_vals[t];
5067 LDKUpdateFulfillHTLC arr_conv_19_conv;
5068 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5069 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5070 arg_constr.data[t] = arr_conv_19_conv;
5072 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5073 CVec_UpdateFulfillHTLCZ_free(arg_constr);
5076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5077 LDKCVec_u64Z arg_constr;
5078 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5079 if (arg_constr.datalen > 0)
5080 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
5082 arg_constr.data = NULL;
5083 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5084 for (size_t g = 0; g < arg_constr.datalen; g++) {
5085 long arr_conv_6 = arg_vals[g];
5086 arg_constr.data[g] = arr_conv_6;
5088 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5089 CVec_u64Z_free(arg_constr);
5092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
5093 LDKCVec_u8Z arg_ref;
5094 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
5095 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
5096 CVec_u8Z_free(arg_ref);
5097 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
5100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
5101 LDKTransaction _res_conv = *(LDKTransaction*)_res;
5102 Transaction_free(_res_conv);
5105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5106 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5108 TxOut_free(_res_conv);
5111 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5112 LDKTransaction b_conv = *(LDKTransaction*)b;
5113 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5114 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_conv);
5115 return (long)ret_ref;
5118 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5119 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5120 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
5121 return (long)ret_conv;
5124 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5125 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5126 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
5127 return (long)ret_conv;
5130 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5132 a_conv.inner = (void*)(a & (~1));
5133 a_conv.is_owned = (a & 1) || (a == 0);
5134 if (a_conv.inner != NULL)
5135 a_conv = OutPoint_clone(&a_conv);
5137 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
5138 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5139 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5140 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5141 (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0);
5142 return (long)ret_ref;
5145 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5146 LDKThirtyTwoBytes a_ref;
5147 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5148 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5149 LDKCVec_TxOutZ b_constr;
5150 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5151 if (b_constr.datalen > 0)
5152 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5154 b_constr.data = NULL;
5155 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5156 for (size_t h = 0; h < b_constr.datalen; h++) {
5157 long arr_conv_7 = b_vals[h];
5158 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5159 FREE((void*)arr_conv_7);
5160 b_constr.data[h] = arr_conv_7_conv;
5162 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5163 LDKC2Tuple_TxidCVec_TxOutZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
5164 *ret_ref = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_constr);
5165 return (long)ret_ref;
5168 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5169 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5170 *ret_ref = C2Tuple_u64u64Z_new(a, b);
5171 return (long)ret_ref;
5174 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5176 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5177 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5178 LDKCVec_SignatureZ b_constr;
5179 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5180 if (b_constr.datalen > 0)
5181 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5183 b_constr.data = NULL;
5184 for (size_t i = 0; i < b_constr.datalen; i++) {
5185 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5186 LDKSignature arr_conv_8_ref;
5187 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5188 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5189 b_constr.data[i] = arr_conv_8_ref;
5191 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5192 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5193 return (long)ret_ref;
5196 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
5197 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5198 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5199 return (long)ret_conv;
5202 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
5203 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5204 *ret_conv = CResult_SignatureNoneZ_err();
5205 return (long)ret_conv;
5208 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
5209 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5210 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5211 return (long)ret_conv;
5214 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
5215 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5216 *ret_conv = CResult_NoneAPIErrorZ_ok();
5217 return (long)ret_conv;
5220 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
5221 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5222 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
5223 return (long)ret_conv;
5226 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
5227 LDKChannelAnnouncement a_conv;
5228 a_conv.inner = (void*)(a & (~1));
5229 a_conv.is_owned = (a & 1) || (a == 0);
5230 if (a_conv.inner != NULL)
5231 a_conv = ChannelAnnouncement_clone(&a_conv);
5232 LDKChannelUpdate b_conv;
5233 b_conv.inner = (void*)(b & (~1));
5234 b_conv.is_owned = (b & 1) || (b == 0);
5235 if (b_conv.inner != NULL)
5236 b_conv = ChannelUpdate_clone(&b_conv);
5237 LDKChannelUpdate c_conv;
5238 c_conv.inner = (void*)(c & (~1));
5239 c_conv.is_owned = (c & 1) || (c == 0);
5240 if (c_conv.inner != NULL)
5241 c_conv = ChannelUpdate_clone(&c_conv);
5242 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5243 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5244 return (long)ret_ref;
5247 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
5248 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5249 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5250 return (long)ret_conv;
5253 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5254 LDKHTLCOutputInCommitment a_conv;
5255 a_conv.inner = (void*)(a & (~1));
5256 a_conv.is_owned = (a & 1) || (a == 0);
5257 if (a_conv.inner != NULL)
5258 a_conv = HTLCOutputInCommitment_clone(&a_conv);
5260 CHECK((*_env)->GetArrayLength (_env, b) == 64);
5261 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
5262 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
5263 *ret_ref = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
5264 return (long)ret_ref;
5267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5268 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
5269 FREE((void*)this_ptr);
5270 Event_free(this_ptr_conv);
5273 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5274 LDKEvent* orig_conv = (LDKEvent*)orig;
5275 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
5276 *ret_copy = Event_clone(orig_conv);
5277 long ret_ref = (long)ret_copy;
5281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5282 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
5283 FREE((void*)this_ptr);
5284 MessageSendEvent_free(this_ptr_conv);
5287 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5288 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
5289 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5290 *ret_copy = MessageSendEvent_clone(orig_conv);
5291 long ret_ref = (long)ret_copy;
5295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5296 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
5297 FREE((void*)this_ptr);
5298 MessageSendEventsProvider_free(this_ptr_conv);
5301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5302 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
5303 FREE((void*)this_ptr);
5304 EventsProvider_free(this_ptr_conv);
5307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5308 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
5309 FREE((void*)this_ptr);
5310 APIError_free(this_ptr_conv);
5313 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5314 LDKAPIError* orig_conv = (LDKAPIError*)orig;
5315 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5316 *ret_copy = APIError_clone(orig_conv);
5317 long ret_ref = (long)ret_copy;
5321 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5322 LDKLevel* orig_conv = (LDKLevel*)orig;
5323 jclass ret_conv = LDKLevel_to_java(_env, Level_clone(orig_conv));
5327 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
5328 jclass ret_conv = LDKLevel_to_java(_env, Level_max());
5332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5333 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
5334 FREE((void*)this_ptr);
5335 Logger_free(this_ptr_conv);
5338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5339 LDKChannelHandshakeConfig this_ptr_conv;
5340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5341 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5342 ChannelHandshakeConfig_free(this_ptr_conv);
5345 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5346 LDKChannelHandshakeConfig orig_conv;
5347 orig_conv.inner = (void*)(orig & (~1));
5348 orig_conv.is_owned = (orig & 1) || (orig == 0);
5349 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
5350 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5351 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5352 long ret_ref = (long)ret_var.inner;
5353 if (ret_var.is_owned) {
5359 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5360 LDKChannelHandshakeConfig this_ptr_conv;
5361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5362 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5363 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
5367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5368 LDKChannelHandshakeConfig this_ptr_conv;
5369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5370 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5371 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
5374 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5375 LDKChannelHandshakeConfig this_ptr_conv;
5376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5377 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5378 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
5382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5383 LDKChannelHandshakeConfig this_ptr_conv;
5384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5385 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5386 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
5389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5390 LDKChannelHandshakeConfig this_ptr_conv;
5391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5392 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5393 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
5397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5398 LDKChannelHandshakeConfig this_ptr_conv;
5399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5401 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
5404 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) {
5405 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
5406 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5407 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5408 long ret_ref = (long)ret_var.inner;
5409 if (ret_var.is_owned) {
5415 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
5416 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
5417 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5418 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5419 long ret_ref = (long)ret_var.inner;
5420 if (ret_var.is_owned) {
5426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5427 LDKChannelHandshakeLimits this_ptr_conv;
5428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5429 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5430 ChannelHandshakeLimits_free(this_ptr_conv);
5433 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5434 LDKChannelHandshakeLimits orig_conv;
5435 orig_conv.inner = (void*)(orig & (~1));
5436 orig_conv.is_owned = (orig & 1) || (orig == 0);
5437 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
5438 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5439 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5440 long ret_ref = (long)ret_var.inner;
5441 if (ret_var.is_owned) {
5447 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5448 LDKChannelHandshakeLimits this_ptr_conv;
5449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5450 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5451 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
5455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5456 LDKChannelHandshakeLimits this_ptr_conv;
5457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5458 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5459 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
5462 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5463 LDKChannelHandshakeLimits this_ptr_conv;
5464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5465 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5466 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
5470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5471 LDKChannelHandshakeLimits this_ptr_conv;
5472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5473 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5474 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
5477 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5478 LDKChannelHandshakeLimits this_ptr_conv;
5479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5480 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5481 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
5485 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) {
5486 LDKChannelHandshakeLimits this_ptr_conv;
5487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5488 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5489 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
5492 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5493 LDKChannelHandshakeLimits this_ptr_conv;
5494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5495 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5496 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
5500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5501 LDKChannelHandshakeLimits this_ptr_conv;
5502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5503 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5504 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
5507 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
5508 LDKChannelHandshakeLimits this_ptr_conv;
5509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5510 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5511 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
5515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5516 LDKChannelHandshakeLimits this_ptr_conv;
5517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5518 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5519 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
5522 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5523 LDKChannelHandshakeLimits this_ptr_conv;
5524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5525 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5526 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
5530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5531 LDKChannelHandshakeLimits this_ptr_conv;
5532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5533 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5534 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
5537 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5538 LDKChannelHandshakeLimits this_ptr_conv;
5539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5541 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
5545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5546 LDKChannelHandshakeLimits this_ptr_conv;
5547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5548 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5549 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
5552 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5553 LDKChannelHandshakeLimits this_ptr_conv;
5554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5555 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5556 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
5560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5561 LDKChannelHandshakeLimits this_ptr_conv;
5562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5563 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5564 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5567 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
5568 LDKChannelHandshakeLimits this_ptr_conv;
5569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5570 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5571 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5576 LDKChannelHandshakeLimits this_ptr_conv;
5577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5579 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5582 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5583 LDKChannelHandshakeLimits this_ptr_conv;
5584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5585 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5586 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5591 LDKChannelHandshakeLimits this_ptr_conv;
5592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5593 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5594 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5597 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) {
5598 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);
5599 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5600 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5601 long ret_ref = (long)ret_var.inner;
5602 if (ret_var.is_owned) {
5608 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5609 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
5610 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5611 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5612 long ret_ref = (long)ret_var.inner;
5613 if (ret_var.is_owned) {
5619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5620 LDKChannelConfig this_ptr_conv;
5621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5623 ChannelConfig_free(this_ptr_conv);
5626 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5627 LDKChannelConfig orig_conv;
5628 orig_conv.inner = (void*)(orig & (~1));
5629 orig_conv.is_owned = (orig & 1) || (orig == 0);
5630 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
5631 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5632 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5633 long ret_ref = (long)ret_var.inner;
5634 if (ret_var.is_owned) {
5640 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
5641 LDKChannelConfig this_ptr_conv;
5642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5643 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5644 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
5648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5649 LDKChannelConfig this_ptr_conv;
5650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5651 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5652 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
5655 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
5656 LDKChannelConfig this_ptr_conv;
5657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5658 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5659 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
5663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5664 LDKChannelConfig this_ptr_conv;
5665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5666 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5667 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5670 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5671 LDKChannelConfig this_ptr_conv;
5672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5673 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5674 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5679 LDKChannelConfig this_ptr_conv;
5680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5681 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5682 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5685 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) {
5686 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5687 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5688 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5689 long ret_ref = (long)ret_var.inner;
5690 if (ret_var.is_owned) {
5696 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
5697 LDKChannelConfig ret_var = ChannelConfig_default();
5698 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5699 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5700 long ret_ref = (long)ret_var.inner;
5701 if (ret_var.is_owned) {
5707 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
5708 LDKChannelConfig obj_conv;
5709 obj_conv.inner = (void*)(obj & (~1));
5710 obj_conv.is_owned = (obj & 1) || (obj == 0);
5711 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
5712 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5713 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5714 CVec_u8Z_free(arg_var);
5718 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5720 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5721 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5722 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
5723 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5724 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5725 long ret_ref = (long)ret_var.inner;
5726 if (ret_var.is_owned) {
5729 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5734 LDKUserConfig this_ptr_conv;
5735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5736 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5737 UserConfig_free(this_ptr_conv);
5740 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5741 LDKUserConfig orig_conv;
5742 orig_conv.inner = (void*)(orig & (~1));
5743 orig_conv.is_owned = (orig & 1) || (orig == 0);
5744 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
5745 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5746 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5747 long ret_ref = (long)ret_var.inner;
5748 if (ret_var.is_owned) {
5754 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
5755 LDKUserConfig this_ptr_conv;
5756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5757 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5758 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
5759 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5760 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5761 long ret_ref = (long)ret_var.inner;
5762 if (ret_var.is_owned) {
5768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5769 LDKUserConfig this_ptr_conv;
5770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5771 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5772 LDKChannelHandshakeConfig val_conv;
5773 val_conv.inner = (void*)(val & (~1));
5774 val_conv.is_owned = (val & 1) || (val == 0);
5775 if (val_conv.inner != NULL)
5776 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5777 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5780 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
5781 LDKUserConfig this_ptr_conv;
5782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5783 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5784 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5785 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5786 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5787 long ret_ref = (long)ret_var.inner;
5788 if (ret_var.is_owned) {
5794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5795 LDKUserConfig this_ptr_conv;
5796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5798 LDKChannelHandshakeLimits val_conv;
5799 val_conv.inner = (void*)(val & (~1));
5800 val_conv.is_owned = (val & 1) || (val == 0);
5801 if (val_conv.inner != NULL)
5802 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5803 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5806 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
5807 LDKUserConfig this_ptr_conv;
5808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5809 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5810 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
5811 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5812 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5813 long ret_ref = (long)ret_var.inner;
5814 if (ret_var.is_owned) {
5820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5821 LDKUserConfig this_ptr_conv;
5822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5823 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5824 LDKChannelConfig val_conv;
5825 val_conv.inner = (void*)(val & (~1));
5826 val_conv.is_owned = (val & 1) || (val == 0);
5827 if (val_conv.inner != NULL)
5828 val_conv = ChannelConfig_clone(&val_conv);
5829 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5832 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) {
5833 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5834 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5835 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5836 if (own_channel_config_arg_conv.inner != NULL)
5837 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5838 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5839 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5840 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5841 if (peer_channel_config_limits_arg_conv.inner != NULL)
5842 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5843 LDKChannelConfig channel_options_arg_conv;
5844 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5845 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5846 if (channel_options_arg_conv.inner != NULL)
5847 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5848 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5849 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5850 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5851 long ret_ref = (long)ret_var.inner;
5852 if (ret_var.is_owned) {
5858 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5859 LDKUserConfig ret_var = UserConfig_default();
5860 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5861 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5862 long ret_ref = (long)ret_var.inner;
5863 if (ret_var.is_owned) {
5869 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5870 LDKAccessError* orig_conv = (LDKAccessError*)orig;
5871 jclass ret_conv = LDKAccessError_to_java(_env, AccessError_clone(orig_conv));
5875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5876 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5877 FREE((void*)this_ptr);
5878 Access_free(this_ptr_conv);
5881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5882 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5883 FREE((void*)this_ptr);
5884 Watch_free(this_ptr_conv);
5887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5888 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5889 FREE((void*)this_ptr);
5890 Filter_free(this_ptr_conv);
5893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5894 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
5895 FREE((void*)this_ptr);
5896 BroadcasterInterface_free(this_ptr_conv);
5899 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5900 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
5901 jclass ret_conv = LDKConfirmationTarget_to_java(_env, ConfirmationTarget_clone(orig_conv));
5905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5906 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
5907 FREE((void*)this_ptr);
5908 FeeEstimator_free(this_ptr_conv);
5911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5912 LDKChainMonitor this_ptr_conv;
5913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5914 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5915 ChainMonitor_free(this_ptr_conv);
5918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
5919 LDKChainMonitor this_arg_conv;
5920 this_arg_conv.inner = (void*)(this_arg & (~1));
5921 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5922 unsigned char header_arr[80];
5923 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5924 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5925 unsigned char (*header_ref)[80] = &header_arr;
5926 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5927 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
5928 if (txdata_constr.datalen > 0)
5929 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5931 txdata_constr.data = NULL;
5932 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
5933 for (size_t d = 0; d < txdata_constr.datalen; d++) {
5934 long arr_conv_29 = txdata_vals[d];
5935 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
5936 FREE((void*)arr_conv_29);
5937 txdata_constr.data[d] = arr_conv_29_conv;
5939 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
5940 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
5943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
5944 LDKChainMonitor this_arg_conv;
5945 this_arg_conv.inner = (void*)(this_arg & (~1));
5946 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5947 unsigned char header_arr[80];
5948 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5949 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5950 unsigned char (*header_ref)[80] = &header_arr;
5951 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
5954 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
5955 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
5956 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5957 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5958 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5959 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5961 LDKLogger logger_conv = *(LDKLogger*)logger;
5962 if (logger_conv.free == LDKLogger_JCalls_free) {
5963 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5964 LDKLogger_JCalls_clone(logger_conv.this_arg);
5966 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
5967 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
5968 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5969 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
5971 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
5972 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5973 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5974 long ret_ref = (long)ret_var.inner;
5975 if (ret_var.is_owned) {
5981 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
5982 LDKChainMonitor this_arg_conv;
5983 this_arg_conv.inner = (void*)(this_arg & (~1));
5984 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5985 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
5986 *ret = ChainMonitor_as_Watch(&this_arg_conv);
5990 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5991 LDKChainMonitor this_arg_conv;
5992 this_arg_conv.inner = (void*)(this_arg & (~1));
5993 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5994 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5995 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
5999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6000 LDKChannelMonitorUpdate this_ptr_conv;
6001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6002 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6003 ChannelMonitorUpdate_free(this_ptr_conv);
6006 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6007 LDKChannelMonitorUpdate orig_conv;
6008 orig_conv.inner = (void*)(orig & (~1));
6009 orig_conv.is_owned = (orig & 1) || (orig == 0);
6010 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
6011 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6012 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6013 long ret_ref = (long)ret_var.inner;
6014 if (ret_var.is_owned) {
6020 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6021 LDKChannelMonitorUpdate this_ptr_conv;
6022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6023 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6024 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
6028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6029 LDKChannelMonitorUpdate this_ptr_conv;
6030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6031 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6032 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
6035 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6036 LDKChannelMonitorUpdate obj_conv;
6037 obj_conv.inner = (void*)(obj & (~1));
6038 obj_conv.is_owned = (obj & 1) || (obj == 0);
6039 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
6040 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6041 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6042 CVec_u8Z_free(arg_var);
6046 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6048 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6049 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6050 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_read(ser_ref);
6051 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6052 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6053 long ret_ref = (long)ret_var.inner;
6054 if (ret_var.is_owned) {
6057 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6061 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6062 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
6063 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(_env, ChannelMonitorUpdateErr_clone(orig_conv));
6067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6068 LDKMonitorUpdateError this_ptr_conv;
6069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6070 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6071 MonitorUpdateError_free(this_ptr_conv);
6074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6075 LDKMonitorEvent this_ptr_conv;
6076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6077 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6078 MonitorEvent_free(this_ptr_conv);
6081 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6082 LDKMonitorEvent orig_conv;
6083 orig_conv.inner = (void*)(orig & (~1));
6084 orig_conv.is_owned = (orig & 1) || (orig == 0);
6085 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
6086 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6087 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6088 long ret_ref = (long)ret_var.inner;
6089 if (ret_var.is_owned) {
6095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6096 LDKHTLCUpdate this_ptr_conv;
6097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6098 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6099 HTLCUpdate_free(this_ptr_conv);
6102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6103 LDKHTLCUpdate orig_conv;
6104 orig_conv.inner = (void*)(orig & (~1));
6105 orig_conv.is_owned = (orig & 1) || (orig == 0);
6106 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
6107 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6108 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6109 long ret_ref = (long)ret_var.inner;
6110 if (ret_var.is_owned) {
6116 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6117 LDKHTLCUpdate obj_conv;
6118 obj_conv.inner = (void*)(obj & (~1));
6119 obj_conv.is_owned = (obj & 1) || (obj == 0);
6120 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
6121 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6122 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6123 CVec_u8Z_free(arg_var);
6127 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6129 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6130 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6131 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
6132 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6133 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6134 long ret_ref = (long)ret_var.inner;
6135 if (ret_var.is_owned) {
6138 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6143 LDKChannelMonitor this_ptr_conv;
6144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6145 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6146 ChannelMonitor_free(this_ptr_conv);
6149 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
6150 LDKChannelMonitor this_arg_conv;
6151 this_arg_conv.inner = (void*)(this_arg & (~1));
6152 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6153 LDKChannelMonitorUpdate updates_conv;
6154 updates_conv.inner = (void*)(updates & (~1));
6155 updates_conv.is_owned = (updates & 1) || (updates == 0);
6156 if (updates_conv.inner != NULL)
6157 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
6158 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
6159 LDKLogger* logger_conv = (LDKLogger*)logger;
6160 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6161 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
6162 return (long)ret_conv;
6165 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6166 LDKChannelMonitor this_arg_conv;
6167 this_arg_conv.inner = (void*)(this_arg & (~1));
6168 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6169 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
6173 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
6174 LDKChannelMonitor this_arg_conv;
6175 this_arg_conv.inner = (void*)(this_arg & (~1));
6176 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6177 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6178 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
6179 return (long)ret_ref;
6182 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6183 LDKChannelMonitor this_arg_conv;
6184 this_arg_conv.inner = (void*)(this_arg & (~1));
6185 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6186 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
6187 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6188 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6189 for (size_t o = 0; o < ret_var.datalen; o++) {
6190 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
6191 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6192 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6193 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
6194 if (arr_conv_14_var.is_owned) {
6195 arr_conv_14_ref |= 1;
6197 ret_arr_ptr[o] = arr_conv_14_ref;
6199 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6204 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6205 LDKChannelMonitor this_arg_conv;
6206 this_arg_conv.inner = (void*)(this_arg & (~1));
6207 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6208 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
6209 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6210 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6211 for (size_t h = 0; h < ret_var.datalen; h++) {
6212 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6213 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
6214 long arr_conv_7_ref = (long)arr_conv_7_copy;
6215 ret_arr_ptr[h] = arr_conv_7_ref;
6217 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6218 CVec_EventZ_free(ret_var);
6222 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
6223 LDKChannelMonitor this_arg_conv;
6224 this_arg_conv.inner = (void*)(this_arg & (~1));
6225 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6226 LDKLogger* logger_conv = (LDKLogger*)logger;
6227 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
6228 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6229 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6230 for (size_t n = 0; n < ret_var.datalen; n++) {
6231 LDKTransaction *arr_conv_13_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
6232 *arr_conv_13_copy = ret_var.data[n];
6233 long arr_conv_13_ref = (long)arr_conv_13_copy;
6234 ret_arr_ptr[n] = arr_conv_13_ref;
6236 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6237 CVec_TransactionZ_free(ret_var);
6241 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) {
6242 LDKChannelMonitor this_arg_conv;
6243 this_arg_conv.inner = (void*)(this_arg & (~1));
6244 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6245 unsigned char header_arr[80];
6246 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6247 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6248 unsigned char (*header_ref)[80] = &header_arr;
6249 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6250 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6251 if (txdata_constr.datalen > 0)
6252 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6254 txdata_constr.data = NULL;
6255 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6256 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6257 long arr_conv_29 = txdata_vals[d];
6258 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6259 FREE((void*)arr_conv_29);
6260 txdata_constr.data[d] = arr_conv_29_conv;
6262 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6263 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6264 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6265 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6266 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6268 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6269 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6270 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6271 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6273 LDKLogger logger_conv = *(LDKLogger*)logger;
6274 if (logger_conv.free == LDKLogger_JCalls_free) {
6275 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6276 LDKLogger_JCalls_clone(logger_conv.this_arg);
6278 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6279 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6280 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6281 for (size_t b = 0; b < ret_var.datalen; b++) {
6282 LDKC2Tuple_TxidCVec_TxOutZZ* arr_conv_27_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
6283 *arr_conv_27_ref = ret_var.data[b];
6284 ret_arr_ptr[b] = (long)arr_conv_27_ref;
6286 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6287 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(ret_var);
6291 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) {
6292 LDKChannelMonitor this_arg_conv;
6293 this_arg_conv.inner = (void*)(this_arg & (~1));
6294 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6295 unsigned char header_arr[80];
6296 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6297 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6298 unsigned char (*header_ref)[80] = &header_arr;
6299 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6300 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6301 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6302 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6304 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6305 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6306 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6307 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6309 LDKLogger logger_conv = *(LDKLogger*)logger;
6310 if (logger_conv.free == LDKLogger_JCalls_free) {
6311 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6312 LDKLogger_JCalls_clone(logger_conv.this_arg);
6314 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6318 LDKOutPoint this_ptr_conv;
6319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6320 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6321 OutPoint_free(this_ptr_conv);
6324 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6325 LDKOutPoint orig_conv;
6326 orig_conv.inner = (void*)(orig & (~1));
6327 orig_conv.is_owned = (orig & 1) || (orig == 0);
6328 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
6329 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6330 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6331 long ret_ref = (long)ret_var.inner;
6332 if (ret_var.is_owned) {
6338 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6339 LDKOutPoint this_ptr_conv;
6340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6341 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6342 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6343 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
6347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6348 LDKOutPoint this_ptr_conv;
6349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6351 LDKThirtyTwoBytes val_ref;
6352 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6353 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6354 OutPoint_set_txid(&this_ptr_conv, val_ref);
6357 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6358 LDKOutPoint this_ptr_conv;
6359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6360 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6361 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
6365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6366 LDKOutPoint this_ptr_conv;
6367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6368 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6369 OutPoint_set_index(&this_ptr_conv, val);
6372 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
6373 LDKThirtyTwoBytes txid_arg_ref;
6374 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
6375 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
6376 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
6377 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6378 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6379 long ret_ref = (long)ret_var.inner;
6380 if (ret_var.is_owned) {
6386 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6387 LDKOutPoint this_arg_conv;
6388 this_arg_conv.inner = (void*)(this_arg & (~1));
6389 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6390 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
6391 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
6395 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
6396 LDKOutPoint obj_conv;
6397 obj_conv.inner = (void*)(obj & (~1));
6398 obj_conv.is_owned = (obj & 1) || (obj == 0);
6399 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
6400 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6401 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6402 CVec_u8Z_free(arg_var);
6406 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6408 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6409 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6410 LDKOutPoint ret_var = OutPoint_read(ser_ref);
6411 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6412 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6413 long ret_ref = (long)ret_var.inner;
6414 if (ret_var.is_owned) {
6417 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6422 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
6423 FREE((void*)this_ptr);
6424 SpendableOutputDescriptor_free(this_ptr_conv);
6427 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6428 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
6429 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
6430 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
6431 long ret_ref = (long)ret_copy;
6435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6436 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
6437 FREE((void*)this_ptr);
6438 ChannelKeys_free(this_ptr_conv);
6441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6442 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
6443 FREE((void*)this_ptr);
6444 KeysInterface_free(this_ptr_conv);
6447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6448 LDKInMemoryChannelKeys this_ptr_conv;
6449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6450 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6451 InMemoryChannelKeys_free(this_ptr_conv);
6454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6455 LDKInMemoryChannelKeys orig_conv;
6456 orig_conv.inner = (void*)(orig & (~1));
6457 orig_conv.is_owned = (orig & 1) || (orig == 0);
6458 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
6459 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6460 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6461 long ret_ref = (long)ret_var.inner;
6462 if (ret_var.is_owned) {
6468 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6469 LDKInMemoryChannelKeys this_ptr_conv;
6470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6471 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6472 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6473 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
6477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6478 LDKInMemoryChannelKeys this_ptr_conv;
6479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6480 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6481 LDKSecretKey val_ref;
6482 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6483 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6484 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
6487 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6488 LDKInMemoryChannelKeys this_ptr_conv;
6489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6491 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6492 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
6496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6497 LDKInMemoryChannelKeys this_ptr_conv;
6498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6499 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6500 LDKSecretKey val_ref;
6501 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6502 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6503 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
6506 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6507 LDKInMemoryChannelKeys this_ptr_conv;
6508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6509 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6510 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6511 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
6515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6516 LDKInMemoryChannelKeys this_ptr_conv;
6517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6518 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6519 LDKSecretKey val_ref;
6520 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6521 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6522 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
6525 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6526 LDKInMemoryChannelKeys this_ptr_conv;
6527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6528 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6529 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6530 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
6534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6535 LDKInMemoryChannelKeys this_ptr_conv;
6536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6537 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6538 LDKSecretKey val_ref;
6539 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6540 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6541 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
6544 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6545 LDKInMemoryChannelKeys this_ptr_conv;
6546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6547 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6548 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6549 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
6553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6554 LDKInMemoryChannelKeys this_ptr_conv;
6555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6556 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6557 LDKSecretKey val_ref;
6558 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6559 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6560 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6563 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
6564 LDKInMemoryChannelKeys this_ptr_conv;
6565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6566 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6567 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6568 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
6572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6573 LDKInMemoryChannelKeys this_ptr_conv;
6574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6576 LDKThirtyTwoBytes val_ref;
6577 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6578 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6579 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6582 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) {
6583 LDKSecretKey funding_key_ref;
6584 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
6585 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
6586 LDKSecretKey revocation_base_key_ref;
6587 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
6588 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
6589 LDKSecretKey payment_key_ref;
6590 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
6591 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
6592 LDKSecretKey delayed_payment_base_key_ref;
6593 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
6594 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
6595 LDKSecretKey htlc_base_key_ref;
6596 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
6597 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
6598 LDKThirtyTwoBytes commitment_seed_ref;
6599 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
6600 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
6601 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
6602 FREE((void*)key_derivation_params);
6603 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);
6604 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6605 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6606 long ret_ref = (long)ret_var.inner;
6607 if (ret_var.is_owned) {
6613 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6614 LDKInMemoryChannelKeys this_arg_conv;
6615 this_arg_conv.inner = (void*)(this_arg & (~1));
6616 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6617 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
6618 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6619 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6620 long ret_ref = (long)ret_var.inner;
6621 if (ret_var.is_owned) {
6627 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6628 LDKInMemoryChannelKeys this_arg_conv;
6629 this_arg_conv.inner = (void*)(this_arg & (~1));
6630 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6631 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
6635 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6636 LDKInMemoryChannelKeys this_arg_conv;
6637 this_arg_conv.inner = (void*)(this_arg & (~1));
6638 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6639 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
6643 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6644 LDKInMemoryChannelKeys this_arg_conv;
6645 this_arg_conv.inner = (void*)(this_arg & (~1));
6646 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6647 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6648 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
6652 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
6653 LDKInMemoryChannelKeys obj_conv;
6654 obj_conv.inner = (void*)(obj & (~1));
6655 obj_conv.is_owned = (obj & 1) || (obj == 0);
6656 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
6657 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6658 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6659 CVec_u8Z_free(arg_var);
6663 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6665 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6666 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6667 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_read(ser_ref);
6668 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6669 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6670 long ret_ref = (long)ret_var.inner;
6671 if (ret_var.is_owned) {
6674 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6679 LDKKeysManager this_ptr_conv;
6680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6681 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6682 KeysManager_free(this_ptr_conv);
6685 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) {
6686 unsigned char seed_arr[32];
6687 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
6688 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
6689 unsigned char (*seed_ref)[32] = &seed_arr;
6690 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6691 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
6692 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6693 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6694 long ret_ref = (long)ret_var.inner;
6695 if (ret_var.is_owned) {
6701 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) {
6702 LDKKeysManager this_arg_conv;
6703 this_arg_conv.inner = (void*)(this_arg & (~1));
6704 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6705 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
6706 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6707 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6708 long ret_ref = (long)ret_var.inner;
6709 if (ret_var.is_owned) {
6715 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
6716 LDKKeysManager this_arg_conv;
6717 this_arg_conv.inner = (void*)(this_arg & (~1));
6718 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6719 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6720 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
6724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6725 LDKChannelManager this_ptr_conv;
6726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6728 ChannelManager_free(this_ptr_conv);
6731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6732 LDKChannelDetails this_ptr_conv;
6733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6734 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6735 ChannelDetails_free(this_ptr_conv);
6738 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6739 LDKChannelDetails orig_conv;
6740 orig_conv.inner = (void*)(orig & (~1));
6741 orig_conv.is_owned = (orig & 1) || (orig == 0);
6742 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
6743 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6744 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6745 long ret_ref = (long)ret_var.inner;
6746 if (ret_var.is_owned) {
6752 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6753 LDKChannelDetails this_ptr_conv;
6754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6755 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6756 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6757 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
6761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6762 LDKChannelDetails this_ptr_conv;
6763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6764 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6765 LDKThirtyTwoBytes val_ref;
6766 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6767 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6768 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
6771 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6772 LDKChannelDetails this_ptr_conv;
6773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6774 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6775 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6776 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
6780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6781 LDKChannelDetails this_ptr_conv;
6782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6783 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6784 LDKPublicKey val_ref;
6785 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6786 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6787 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
6790 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
6791 LDKChannelDetails this_ptr_conv;
6792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6793 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6794 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
6795 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6796 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6797 long ret_ref = (long)ret_var.inner;
6798 if (ret_var.is_owned) {
6804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6805 LDKChannelDetails this_ptr_conv;
6806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6808 LDKInitFeatures val_conv;
6809 val_conv.inner = (void*)(val & (~1));
6810 val_conv.is_owned = (val & 1) || (val == 0);
6811 // Warning: we may need a move here but can't clone!
6812 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
6815 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6816 LDKChannelDetails this_ptr_conv;
6817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6818 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6819 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
6823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6824 LDKChannelDetails this_ptr_conv;
6825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6826 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6827 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
6830 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6831 LDKChannelDetails this_ptr_conv;
6832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6834 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
6838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
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_set_user_id(&this_ptr_conv, val);
6845 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6846 LDKChannelDetails this_ptr_conv;
6847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6848 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6849 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
6853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6854 LDKChannelDetails this_ptr_conv;
6855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6856 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6857 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
6860 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6861 LDKChannelDetails this_ptr_conv;
6862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6863 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6864 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
6868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong 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 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
6875 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
6876 LDKChannelDetails this_ptr_conv;
6877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6879 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
6883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6884 LDKChannelDetails this_ptr_conv;
6885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6886 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6887 ChannelDetails_set_is_live(&this_ptr_conv, val);
6890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6891 LDKPaymentSendFailure this_ptr_conv;
6892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6893 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6894 PaymentSendFailure_free(this_ptr_conv);
6897 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) {
6898 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6899 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
6900 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
6901 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6902 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
6904 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6905 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6906 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6907 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6909 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6910 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6911 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6912 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6914 LDKLogger logger_conv = *(LDKLogger*)logger;
6915 if (logger_conv.free == LDKLogger_JCalls_free) {
6916 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6917 LDKLogger_JCalls_clone(logger_conv.this_arg);
6919 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6920 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6921 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6922 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6924 LDKUserConfig config_conv;
6925 config_conv.inner = (void*)(config & (~1));
6926 config_conv.is_owned = (config & 1) || (config == 0);
6927 if (config_conv.inner != NULL)
6928 config_conv = UserConfig_clone(&config_conv);
6929 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);
6930 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6931 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6932 long ret_ref = (long)ret_var.inner;
6933 if (ret_var.is_owned) {
6939 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) {
6940 LDKChannelManager this_arg_conv;
6941 this_arg_conv.inner = (void*)(this_arg & (~1));
6942 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6943 LDKPublicKey their_network_key_ref;
6944 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
6945 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
6946 LDKUserConfig override_config_conv;
6947 override_config_conv.inner = (void*)(override_config & (~1));
6948 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
6949 if (override_config_conv.inner != NULL)
6950 override_config_conv = UserConfig_clone(&override_config_conv);
6951 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6952 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
6953 return (long)ret_conv;
6956 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6957 LDKChannelManager this_arg_conv;
6958 this_arg_conv.inner = (void*)(this_arg & (~1));
6959 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6960 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
6961 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6962 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6963 for (size_t q = 0; q < ret_var.datalen; q++) {
6964 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
6965 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6966 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6967 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
6968 if (arr_conv_16_var.is_owned) {
6969 arr_conv_16_ref |= 1;
6971 ret_arr_ptr[q] = arr_conv_16_ref;
6973 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6978 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6979 LDKChannelManager this_arg_conv;
6980 this_arg_conv.inner = (void*)(this_arg & (~1));
6981 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6982 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
6983 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6984 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6985 for (size_t q = 0; q < ret_var.datalen; q++) {
6986 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
6987 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6988 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6989 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
6990 if (arr_conv_16_var.is_owned) {
6991 arr_conv_16_ref |= 1;
6993 ret_arr_ptr[q] = arr_conv_16_ref;
6995 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7000 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7001 LDKChannelManager this_arg_conv;
7002 this_arg_conv.inner = (void*)(this_arg & (~1));
7003 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7004 unsigned char channel_id_arr[32];
7005 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7006 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7007 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7008 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7009 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
7010 return (long)ret_conv;
7013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7014 LDKChannelManager this_arg_conv;
7015 this_arg_conv.inner = (void*)(this_arg & (~1));
7016 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7017 unsigned char channel_id_arr[32];
7018 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7019 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7020 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7021 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
7024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7025 LDKChannelManager this_arg_conv;
7026 this_arg_conv.inner = (void*)(this_arg & (~1));
7027 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7028 ChannelManager_force_close_all_channels(&this_arg_conv);
7031 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) {
7032 LDKChannelManager this_arg_conv;
7033 this_arg_conv.inner = (void*)(this_arg & (~1));
7034 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7035 LDKRoute route_conv;
7036 route_conv.inner = (void*)(route & (~1));
7037 route_conv.is_owned = (route & 1) || (route == 0);
7038 LDKThirtyTwoBytes payment_hash_ref;
7039 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7040 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
7041 LDKThirtyTwoBytes payment_secret_ref;
7042 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7043 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7044 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7045 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
7046 return (long)ret_conv;
7049 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) {
7050 LDKChannelManager this_arg_conv;
7051 this_arg_conv.inner = (void*)(this_arg & (~1));
7052 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7053 unsigned char temporary_channel_id_arr[32];
7054 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
7055 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
7056 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
7057 LDKOutPoint funding_txo_conv;
7058 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7059 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
7060 if (funding_txo_conv.inner != NULL)
7061 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7062 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
7065 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) {
7066 LDKChannelManager this_arg_conv;
7067 this_arg_conv.inner = (void*)(this_arg & (~1));
7068 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7069 LDKThreeBytes rgb_ref;
7070 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
7071 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
7072 LDKThirtyTwoBytes alias_ref;
7073 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
7074 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
7075 LDKCVec_NetAddressZ addresses_constr;
7076 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
7077 if (addresses_constr.datalen > 0)
7078 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7080 addresses_constr.data = NULL;
7081 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
7082 for (size_t m = 0; m < addresses_constr.datalen; m++) {
7083 long arr_conv_12 = addresses_vals[m];
7084 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
7085 FREE((void*)arr_conv_12);
7086 addresses_constr.data[m] = arr_conv_12_conv;
7088 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
7089 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
7092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
7093 LDKChannelManager this_arg_conv;
7094 this_arg_conv.inner = (void*)(this_arg & (~1));
7095 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7096 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
7099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
7100 LDKChannelManager this_arg_conv;
7101 this_arg_conv.inner = (void*)(this_arg & (~1));
7102 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7103 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
7106 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) {
7107 LDKChannelManager this_arg_conv;
7108 this_arg_conv.inner = (void*)(this_arg & (~1));
7109 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7110 unsigned char payment_hash_arr[32];
7111 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7112 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
7113 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
7114 LDKThirtyTwoBytes payment_secret_ref;
7115 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7116 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7117 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
7121 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) {
7122 LDKChannelManager this_arg_conv;
7123 this_arg_conv.inner = (void*)(this_arg & (~1));
7124 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7125 LDKThirtyTwoBytes payment_preimage_ref;
7126 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
7127 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
7128 LDKThirtyTwoBytes payment_secret_ref;
7129 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7130 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7131 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
7135 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
7136 LDKChannelManager this_arg_conv;
7137 this_arg_conv.inner = (void*)(this_arg & (~1));
7138 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7139 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7140 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
7144 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) {
7145 LDKChannelManager this_arg_conv;
7146 this_arg_conv.inner = (void*)(this_arg & (~1));
7147 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7148 LDKOutPoint funding_txo_conv;
7149 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7150 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
7151 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
7154 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7155 LDKChannelManager this_arg_conv;
7156 this_arg_conv.inner = (void*)(this_arg & (~1));
7157 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7158 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7159 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
7163 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7164 LDKChannelManager this_arg_conv;
7165 this_arg_conv.inner = (void*)(this_arg & (~1));
7166 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7167 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7168 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
7172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
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 unsigned char header_arr[80];
7177 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7178 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7179 unsigned char (*header_ref)[80] = &header_arr;
7180 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7181 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
7182 if (txdata_constr.datalen > 0)
7183 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7185 txdata_constr.data = NULL;
7186 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
7187 for (size_t d = 0; d < txdata_constr.datalen; d++) {
7188 long arr_conv_29 = txdata_vals[d];
7189 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
7190 FREE((void*)arr_conv_29);
7191 txdata_constr.data[d] = arr_conv_29_conv;
7193 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
7194 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
7197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
7198 LDKChannelManager this_arg_conv;
7199 this_arg_conv.inner = (void*)(this_arg & (~1));
7200 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7201 unsigned char header_arr[80];
7202 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7203 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7204 unsigned char (*header_ref)[80] = &header_arr;
7205 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
7208 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
7209 LDKChannelManager this_arg_conv;
7210 this_arg_conv.inner = (void*)(this_arg & (~1));
7211 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7212 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7213 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
7217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7218 LDKChannelManagerReadArgs this_ptr_conv;
7219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7220 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7221 ChannelManagerReadArgs_free(this_ptr_conv);
7224 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
7225 LDKChannelManagerReadArgs this_ptr_conv;
7226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7227 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7228 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
7232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7233 LDKChannelManagerReadArgs this_ptr_conv;
7234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7235 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7236 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
7237 if (val_conv.free == LDKKeysInterface_JCalls_free) {
7238 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7239 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
7241 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
7244 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
7245 LDKChannelManagerReadArgs this_ptr_conv;
7246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7247 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7248 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
7252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7253 LDKChannelManagerReadArgs this_ptr_conv;
7254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7255 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7256 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
7257 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
7258 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7259 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
7261 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
7264 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
7265 LDKChannelManagerReadArgs this_ptr_conv;
7266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7268 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
7272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7273 LDKChannelManagerReadArgs this_ptr_conv;
7274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7275 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7276 LDKWatch val_conv = *(LDKWatch*)val;
7277 if (val_conv.free == LDKWatch_JCalls_free) {
7278 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7279 LDKWatch_JCalls_clone(val_conv.this_arg);
7281 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
7284 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
7285 LDKChannelManagerReadArgs this_ptr_conv;
7286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7288 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
7292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7293 LDKChannelManagerReadArgs this_ptr_conv;
7294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7295 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7296 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
7297 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
7298 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7299 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
7301 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
7304 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
7305 LDKChannelManagerReadArgs this_ptr_conv;
7306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7308 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
7312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7313 LDKChannelManagerReadArgs this_ptr_conv;
7314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7316 LDKLogger val_conv = *(LDKLogger*)val;
7317 if (val_conv.free == LDKLogger_JCalls_free) {
7318 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7319 LDKLogger_JCalls_clone(val_conv.this_arg);
7321 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
7324 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(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 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
7329 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7330 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7331 long ret_ref = (long)ret_var.inner;
7332 if (ret_var.is_owned) {
7338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7339 LDKChannelManagerReadArgs this_ptr_conv;
7340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7341 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7342 LDKUserConfig val_conv;
7343 val_conv.inner = (void*)(val & (~1));
7344 val_conv.is_owned = (val & 1) || (val == 0);
7345 if (val_conv.inner != NULL)
7346 val_conv = UserConfig_clone(&val_conv);
7347 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
7350 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) {
7351 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7352 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7353 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7354 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7356 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7357 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
7358 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7359 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
7361 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7362 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7363 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7364 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7366 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7367 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7368 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7369 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7371 LDKLogger logger_conv = *(LDKLogger*)logger;
7372 if (logger_conv.free == LDKLogger_JCalls_free) {
7373 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7374 LDKLogger_JCalls_clone(logger_conv.this_arg);
7376 LDKUserConfig default_config_conv;
7377 default_config_conv.inner = (void*)(default_config & (~1));
7378 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
7379 if (default_config_conv.inner != NULL)
7380 default_config_conv = UserConfig_clone(&default_config_conv);
7381 LDKCVec_ChannelMonitorZ channel_monitors_constr;
7382 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
7383 if (channel_monitors_constr.datalen > 0)
7384 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7386 channel_monitors_constr.data = NULL;
7387 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
7388 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
7389 long arr_conv_16 = channel_monitors_vals[q];
7390 LDKChannelMonitor arr_conv_16_conv;
7391 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7392 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7393 channel_monitors_constr.data[q] = arr_conv_16_conv;
7395 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
7396 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);
7397 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7398 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7399 long ret_ref = (long)ret_var.inner;
7400 if (ret_var.is_owned) {
7406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7407 LDKDecodeError this_ptr_conv;
7408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7409 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7410 DecodeError_free(this_ptr_conv);
7413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7414 LDKInit this_ptr_conv;
7415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7416 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7417 Init_free(this_ptr_conv);
7420 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7422 orig_conv.inner = (void*)(orig & (~1));
7423 orig_conv.is_owned = (orig & 1) || (orig == 0);
7424 LDKInit ret_var = Init_clone(&orig_conv);
7425 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7426 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7427 long ret_ref = (long)ret_var.inner;
7428 if (ret_var.is_owned) {
7434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7435 LDKErrorMessage this_ptr_conv;
7436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7437 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7438 ErrorMessage_free(this_ptr_conv);
7441 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7442 LDKErrorMessage orig_conv;
7443 orig_conv.inner = (void*)(orig & (~1));
7444 orig_conv.is_owned = (orig & 1) || (orig == 0);
7445 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
7446 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7447 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7448 long ret_ref = (long)ret_var.inner;
7449 if (ret_var.is_owned) {
7455 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7456 LDKErrorMessage this_ptr_conv;
7457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7458 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7459 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7460 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
7464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7465 LDKErrorMessage this_ptr_conv;
7466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7467 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7468 LDKThirtyTwoBytes val_ref;
7469 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7470 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7471 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
7474 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
7475 LDKErrorMessage this_ptr_conv;
7476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7477 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7478 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
7479 char* _buf = MALLOC(_str.len + 1, "str conv buf");
7480 memcpy(_buf, _str.chars, _str.len);
7482 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
7487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7488 LDKErrorMessage this_ptr_conv;
7489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7491 LDKCVec_u8Z val_ref;
7492 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
7493 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7494 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7495 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
7498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
7499 LDKThirtyTwoBytes channel_id_arg_ref;
7500 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7501 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7502 LDKCVec_u8Z data_arg_ref;
7503 data_arg_ref.data = (*_env)->GetByteArrayElements (_env, data_arg, NULL);
7504 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
7505 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7506 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7507 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7508 long ret_ref = (long)ret_var.inner;
7509 if (ret_var.is_owned) {
7512 (*_env)->ReleaseByteArrayElements(_env, data_arg, (int8_t*)data_arg_ref.data, 0);
7516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7517 LDKPing this_ptr_conv;
7518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7519 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7520 Ping_free(this_ptr_conv);
7523 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7525 orig_conv.inner = (void*)(orig & (~1));
7526 orig_conv.is_owned = (orig & 1) || (orig == 0);
7527 LDKPing ret_var = Ping_clone(&orig_conv);
7528 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7529 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7530 long ret_ref = (long)ret_var.inner;
7531 if (ret_var.is_owned) {
7537 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7538 LDKPing this_ptr_conv;
7539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7541 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7546 LDKPing this_ptr_conv;
7547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7548 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7549 Ping_set_ponglen(&this_ptr_conv, val);
7552 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7553 LDKPing this_ptr_conv;
7554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7555 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7556 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7561 LDKPing this_ptr_conv;
7562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7563 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7564 Ping_set_byteslen(&this_ptr_conv, val);
7567 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
7568 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
7569 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7570 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7571 long ret_ref = (long)ret_var.inner;
7572 if (ret_var.is_owned) {
7578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7579 LDKPong this_ptr_conv;
7580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7582 Pong_free(this_ptr_conv);
7585 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7587 orig_conv.inner = (void*)(orig & (~1));
7588 orig_conv.is_owned = (orig & 1) || (orig == 0);
7589 LDKPong ret_var = Pong_clone(&orig_conv);
7590 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7591 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7592 long ret_ref = (long)ret_var.inner;
7593 if (ret_var.is_owned) {
7599 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7600 LDKPong this_ptr_conv;
7601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7603 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
7607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7608 LDKPong this_ptr_conv;
7609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7610 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7611 Pong_set_byteslen(&this_ptr_conv, val);
7614 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
7615 LDKPong ret_var = Pong_new(byteslen_arg);
7616 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7617 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7618 long ret_ref = (long)ret_var.inner;
7619 if (ret_var.is_owned) {
7625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7626 LDKOpenChannel this_ptr_conv;
7627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7628 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7629 OpenChannel_free(this_ptr_conv);
7632 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7633 LDKOpenChannel orig_conv;
7634 orig_conv.inner = (void*)(orig & (~1));
7635 orig_conv.is_owned = (orig & 1) || (orig == 0);
7636 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
7637 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7638 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7639 long ret_ref = (long)ret_var.inner;
7640 if (ret_var.is_owned) {
7646 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7647 LDKOpenChannel this_ptr_conv;
7648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7650 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7651 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
7655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7656 LDKOpenChannel this_ptr_conv;
7657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7658 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7659 LDKThirtyTwoBytes val_ref;
7660 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7661 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7662 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
7665 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7666 LDKOpenChannel this_ptr_conv;
7667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7668 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7669 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7670 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
7674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7675 LDKOpenChannel this_ptr_conv;
7676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7677 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7678 LDKThirtyTwoBytes val_ref;
7679 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7680 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7681 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7684 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7685 LDKOpenChannel this_ptr_conv;
7686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7687 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7688 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
7692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7693 LDKOpenChannel this_ptr_conv;
7694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7695 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7696 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
7699 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7700 LDKOpenChannel this_ptr_conv;
7701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7702 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7703 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
7707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7708 LDKOpenChannel this_ptr_conv;
7709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7710 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7711 OpenChannel_set_push_msat(&this_ptr_conv, val);
7714 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7715 LDKOpenChannel 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 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
7722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7723 LDKOpenChannel this_ptr_conv;
7724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7725 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7726 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7729 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7730 LDKOpenChannel this_ptr_conv;
7731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7732 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7733 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7737 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) {
7738 LDKOpenChannel this_ptr_conv;
7739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7740 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7741 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7744 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7745 LDKOpenChannel this_ptr_conv;
7746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7747 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7748 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7753 LDKOpenChannel this_ptr_conv;
7754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7755 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7756 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7759 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7760 LDKOpenChannel this_ptr_conv;
7761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7762 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7763 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
7767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7768 LDKOpenChannel this_ptr_conv;
7769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7770 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7771 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7774 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7775 LDKOpenChannel this_ptr_conv;
7776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7777 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7778 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
7782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7783 LDKOpenChannel this_ptr_conv;
7784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7785 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7786 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
7789 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7790 LDKOpenChannel this_ptr_conv;
7791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7792 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7793 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
7797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7798 LDKOpenChannel this_ptr_conv;
7799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7800 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7801 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
7804 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7805 LDKOpenChannel this_ptr_conv;
7806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7808 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
7812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7813 LDKOpenChannel this_ptr_conv;
7814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7816 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7819 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7820 LDKOpenChannel this_ptr_conv;
7821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7822 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7823 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7824 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7829 LDKOpenChannel this_ptr_conv;
7830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7831 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7832 LDKPublicKey val_ref;
7833 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7834 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7835 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7838 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7839 LDKOpenChannel this_ptr_conv;
7840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7841 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7842 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7843 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7848 LDKOpenChannel this_ptr_conv;
7849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7850 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7851 LDKPublicKey val_ref;
7852 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7853 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7854 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7857 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7858 LDKOpenChannel this_ptr_conv;
7859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7860 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7861 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7862 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
7866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7867 LDKOpenChannel this_ptr_conv;
7868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7869 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7870 LDKPublicKey val_ref;
7871 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7872 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7873 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
7876 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7877 LDKOpenChannel this_ptr_conv;
7878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7879 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7880 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7881 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7886 LDKOpenChannel this_ptr_conv;
7887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7888 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7889 LDKPublicKey val_ref;
7890 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7891 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7892 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7895 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7896 LDKOpenChannel this_ptr_conv;
7897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7898 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7899 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7900 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
7904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray 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 LDKPublicKey val_ref;
7909 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7910 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7911 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7914 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7915 LDKOpenChannel this_ptr_conv;
7916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7917 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7918 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7919 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
7923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7924 LDKOpenChannel this_ptr_conv;
7925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7926 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7927 LDKPublicKey val_ref;
7928 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7929 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7930 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7933 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
7934 LDKOpenChannel this_ptr_conv;
7935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7936 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7937 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
7941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
7942 LDKOpenChannel this_ptr_conv;
7943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7944 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7945 OpenChannel_set_channel_flags(&this_ptr_conv, val);
7948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7949 LDKAcceptChannel this_ptr_conv;
7950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7951 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7952 AcceptChannel_free(this_ptr_conv);
7955 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7956 LDKAcceptChannel orig_conv;
7957 orig_conv.inner = (void*)(orig & (~1));
7958 orig_conv.is_owned = (orig & 1) || (orig == 0);
7959 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
7960 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7961 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7962 long ret_ref = (long)ret_var.inner;
7963 if (ret_var.is_owned) {
7969 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7970 LDKAcceptChannel this_ptr_conv;
7971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7972 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7973 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7974 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
7978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7979 LDKAcceptChannel this_ptr_conv;
7980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7981 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7982 LDKThirtyTwoBytes val_ref;
7983 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7984 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7985 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7988 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7989 LDKAcceptChannel this_ptr_conv;
7990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7991 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7992 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
7996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7997 LDKAcceptChannel this_ptr_conv;
7998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7999 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8000 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8003 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8004 LDKAcceptChannel this_ptr_conv;
8005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8006 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8007 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8011 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) {
8012 LDKAcceptChannel 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 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8018 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8019 LDKAcceptChannel this_ptr_conv;
8020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8021 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8022 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8027 LDKAcceptChannel this_ptr_conv;
8028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8029 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8030 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8033 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8034 LDKAcceptChannel this_ptr_conv;
8035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8036 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8037 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
8041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8042 LDKAcceptChannel this_ptr_conv;
8043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8044 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8045 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8048 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
8049 LDKAcceptChannel 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 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
8056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8057 LDKAcceptChannel this_ptr_conv;
8058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8059 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8060 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
8063 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
8064 LDKAcceptChannel this_ptr_conv;
8065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8066 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8067 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
8071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8072 LDKAcceptChannel this_ptr_conv;
8073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8074 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8075 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
8078 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
8079 LDKAcceptChannel this_ptr_conv;
8080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8081 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8082 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
8086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8087 LDKAcceptChannel this_ptr_conv;
8088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8089 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8090 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8093 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8094 LDKAcceptChannel this_ptr_conv;
8095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8096 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8097 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8098 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8103 LDKAcceptChannel this_ptr_conv;
8104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8105 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8106 LDKPublicKey val_ref;
8107 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8108 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8109 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8112 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8113 LDKAcceptChannel this_ptr_conv;
8114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8115 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8116 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8117 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8122 LDKAcceptChannel this_ptr_conv;
8123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8124 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8125 LDKPublicKey val_ref;
8126 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8127 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8128 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8131 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8132 LDKAcceptChannel this_ptr_conv;
8133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8134 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8135 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8136 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
8140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8141 LDKAcceptChannel this_ptr_conv;
8142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8143 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8144 LDKPublicKey val_ref;
8145 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8146 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8147 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
8150 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8151 LDKAcceptChannel this_ptr_conv;
8152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8153 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8154 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8155 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8160 LDKAcceptChannel this_ptr_conv;
8161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8162 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8163 LDKPublicKey val_ref;
8164 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8165 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8166 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8169 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8170 LDKAcceptChannel this_ptr_conv;
8171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8172 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8173 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8174 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray 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 LDKPublicKey val_ref;
8183 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8184 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8185 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8188 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8189 LDKAcceptChannel this_ptr_conv;
8190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8191 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8192 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8193 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8198 LDKAcceptChannel this_ptr_conv;
8199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8200 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8201 LDKPublicKey val_ref;
8202 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8203 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8204 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8208 LDKFundingCreated this_ptr_conv;
8209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8210 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8211 FundingCreated_free(this_ptr_conv);
8214 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8215 LDKFundingCreated orig_conv;
8216 orig_conv.inner = (void*)(orig & (~1));
8217 orig_conv.is_owned = (orig & 1) || (orig == 0);
8218 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
8219 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8220 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8221 long ret_ref = (long)ret_var.inner;
8222 if (ret_var.is_owned) {
8228 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8229 LDKFundingCreated 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8233 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
8237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8238 LDKFundingCreated this_ptr_conv;
8239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8240 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8241 LDKThirtyTwoBytes val_ref;
8242 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8243 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8244 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
8247 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
8248 LDKFundingCreated 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8252 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
8256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8257 LDKFundingCreated this_ptr_conv;
8258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8259 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8260 LDKThirtyTwoBytes val_ref;
8261 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8262 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8263 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
8266 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
8267 LDKFundingCreated 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 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
8274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8275 LDKFundingCreated this_ptr_conv;
8276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8277 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8278 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
8281 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8282 LDKFundingCreated this_ptr_conv;
8283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8284 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8285 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8286 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
8290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8291 LDKFundingCreated this_ptr_conv;
8292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8293 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8294 LDKSignature val_ref;
8295 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8296 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8297 FundingCreated_set_signature(&this_ptr_conv, val_ref);
8300 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) {
8301 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
8302 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
8303 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
8304 LDKThirtyTwoBytes funding_txid_arg_ref;
8305 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
8306 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
8307 LDKSignature signature_arg_ref;
8308 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8309 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8310 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
8311 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8312 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8313 long ret_ref = (long)ret_var.inner;
8314 if (ret_var.is_owned) {
8320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8321 LDKFundingSigned this_ptr_conv;
8322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8323 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8324 FundingSigned_free(this_ptr_conv);
8327 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8328 LDKFundingSigned orig_conv;
8329 orig_conv.inner = (void*)(orig & (~1));
8330 orig_conv.is_owned = (orig & 1) || (orig == 0);
8331 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
8332 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8333 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8334 long ret_ref = (long)ret_var.inner;
8335 if (ret_var.is_owned) {
8341 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8342 LDKFundingSigned this_ptr_conv;
8343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8344 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8345 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8346 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
8350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8351 LDKFundingSigned this_ptr_conv;
8352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8353 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8354 LDKThirtyTwoBytes val_ref;
8355 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8356 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8357 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
8360 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8361 LDKFundingSigned this_ptr_conv;
8362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8363 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8364 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8365 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
8369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8370 LDKFundingSigned this_ptr_conv;
8371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8372 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8373 LDKSignature val_ref;
8374 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8375 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8376 FundingSigned_set_signature(&this_ptr_conv, val_ref);
8379 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
8380 LDKThirtyTwoBytes channel_id_arg_ref;
8381 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8382 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8383 LDKSignature signature_arg_ref;
8384 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8385 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8386 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
8387 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8388 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8389 long ret_ref = (long)ret_var.inner;
8390 if (ret_var.is_owned) {
8396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8397 LDKFundingLocked this_ptr_conv;
8398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8399 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8400 FundingLocked_free(this_ptr_conv);
8403 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8404 LDKFundingLocked orig_conv;
8405 orig_conv.inner = (void*)(orig & (~1));
8406 orig_conv.is_owned = (orig & 1) || (orig == 0);
8407 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
8408 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8409 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8410 long ret_ref = (long)ret_var.inner;
8411 if (ret_var.is_owned) {
8417 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8418 LDKFundingLocked this_ptr_conv;
8419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8420 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8421 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8422 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
8426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8427 LDKFundingLocked this_ptr_conv;
8428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8429 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8430 LDKThirtyTwoBytes val_ref;
8431 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8432 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8433 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
8436 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8437 LDKFundingLocked this_ptr_conv;
8438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8439 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8440 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8441 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8446 LDKFundingLocked this_ptr_conv;
8447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8448 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8449 LDKPublicKey val_ref;
8450 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8451 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8452 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8455 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
8456 LDKThirtyTwoBytes channel_id_arg_ref;
8457 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8458 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8459 LDKPublicKey next_per_commitment_point_arg_ref;
8460 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8461 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8462 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
8463 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8464 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8465 long ret_ref = (long)ret_var.inner;
8466 if (ret_var.is_owned) {
8472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8473 LDKShutdown this_ptr_conv;
8474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8475 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8476 Shutdown_free(this_ptr_conv);
8479 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8480 LDKShutdown orig_conv;
8481 orig_conv.inner = (void*)(orig & (~1));
8482 orig_conv.is_owned = (orig & 1) || (orig == 0);
8483 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
8484 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8485 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8486 long ret_ref = (long)ret_var.inner;
8487 if (ret_var.is_owned) {
8493 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8494 LDKShutdown this_ptr_conv;
8495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8496 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8497 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8498 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
8502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8503 LDKShutdown this_ptr_conv;
8504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8505 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8506 LDKThirtyTwoBytes val_ref;
8507 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8508 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8509 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8512 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8513 LDKShutdown this_ptr_conv;
8514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8515 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8516 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8517 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8518 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8523 LDKShutdown this_ptr_conv;
8524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8525 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8526 LDKCVec_u8Z val_ref;
8527 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
8528 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
8529 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8530 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
8533 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
8534 LDKThirtyTwoBytes channel_id_arg_ref;
8535 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8536 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8537 LDKCVec_u8Z scriptpubkey_arg_ref;
8538 scriptpubkey_arg_ref.data = (*_env)->GetByteArrayElements (_env, scriptpubkey_arg, NULL);
8539 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
8540 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8541 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8542 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8543 long ret_ref = (long)ret_var.inner;
8544 if (ret_var.is_owned) {
8547 (*_env)->ReleaseByteArrayElements(_env, scriptpubkey_arg, (int8_t*)scriptpubkey_arg_ref.data, 0);
8551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8552 LDKClosingSigned this_ptr_conv;
8553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8554 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8555 ClosingSigned_free(this_ptr_conv);
8558 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8559 LDKClosingSigned orig_conv;
8560 orig_conv.inner = (void*)(orig & (~1));
8561 orig_conv.is_owned = (orig & 1) || (orig == 0);
8562 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
8563 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8564 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8565 long ret_ref = (long)ret_var.inner;
8566 if (ret_var.is_owned) {
8572 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8573 LDKClosingSigned this_ptr_conv;
8574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8576 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8577 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
8581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8582 LDKClosingSigned this_ptr_conv;
8583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8585 LDKThirtyTwoBytes val_ref;
8586 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8587 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8588 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
8591 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8592 LDKClosingSigned this_ptr_conv;
8593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8595 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
8599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8600 LDKClosingSigned this_ptr_conv;
8601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8603 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
8606 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8607 LDKClosingSigned this_ptr_conv;
8608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8609 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8610 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8611 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
8615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8616 LDKClosingSigned this_ptr_conv;
8617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8618 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8619 LDKSignature val_ref;
8620 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8621 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8622 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
8625 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) {
8626 LDKThirtyTwoBytes channel_id_arg_ref;
8627 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8628 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8629 LDKSignature signature_arg_ref;
8630 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8631 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8632 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
8633 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8634 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8635 long ret_ref = (long)ret_var.inner;
8636 if (ret_var.is_owned) {
8642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8643 LDKUpdateAddHTLC this_ptr_conv;
8644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8645 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8646 UpdateAddHTLC_free(this_ptr_conv);
8649 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8650 LDKUpdateAddHTLC orig_conv;
8651 orig_conv.inner = (void*)(orig & (~1));
8652 orig_conv.is_owned = (orig & 1) || (orig == 0);
8653 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
8654 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8655 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8656 long ret_ref = (long)ret_var.inner;
8657 if (ret_var.is_owned) {
8663 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8664 LDKUpdateAddHTLC this_ptr_conv;
8665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8666 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8667 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8668 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
8672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8673 LDKUpdateAddHTLC this_ptr_conv;
8674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8675 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8676 LDKThirtyTwoBytes val_ref;
8677 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8678 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8679 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
8682 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8683 LDKUpdateAddHTLC this_ptr_conv;
8684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8685 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8686 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
8690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8691 LDKUpdateAddHTLC this_ptr_conv;
8692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8693 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8694 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
8697 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8698 LDKUpdateAddHTLC this_ptr_conv;
8699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8700 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8701 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
8705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8706 LDKUpdateAddHTLC this_ptr_conv;
8707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8709 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
8712 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8713 LDKUpdateAddHTLC this_ptr_conv;
8714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8715 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8716 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8717 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
8721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8722 LDKUpdateAddHTLC this_ptr_conv;
8723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8724 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8725 LDKThirtyTwoBytes val_ref;
8726 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8727 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8728 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
8731 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
8732 LDKUpdateAddHTLC this_ptr_conv;
8733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8734 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8735 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
8739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8740 LDKUpdateAddHTLC this_ptr_conv;
8741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8742 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8743 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
8746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8747 LDKUpdateFulfillHTLC this_ptr_conv;
8748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8749 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8750 UpdateFulfillHTLC_free(this_ptr_conv);
8753 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8754 LDKUpdateFulfillHTLC orig_conv;
8755 orig_conv.inner = (void*)(orig & (~1));
8756 orig_conv.is_owned = (orig & 1) || (orig == 0);
8757 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
8758 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8759 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8760 long ret_ref = (long)ret_var.inner;
8761 if (ret_var.is_owned) {
8767 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8768 LDKUpdateFulfillHTLC this_ptr_conv;
8769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8770 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8771 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8772 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
8776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8777 LDKUpdateFulfillHTLC this_ptr_conv;
8778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8779 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8780 LDKThirtyTwoBytes val_ref;
8781 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8782 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8783 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
8786 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8787 LDKUpdateFulfillHTLC this_ptr_conv;
8788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8789 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8790 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
8794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8795 LDKUpdateFulfillHTLC this_ptr_conv;
8796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8798 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
8801 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
8802 LDKUpdateFulfillHTLC this_ptr_conv;
8803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8804 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8805 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8806 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
8810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8811 LDKUpdateFulfillHTLC this_ptr_conv;
8812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8813 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8814 LDKThirtyTwoBytes val_ref;
8815 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8816 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8817 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
8820 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) {
8821 LDKThirtyTwoBytes channel_id_arg_ref;
8822 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8823 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8824 LDKThirtyTwoBytes payment_preimage_arg_ref;
8825 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
8826 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
8827 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
8828 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8829 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8830 long ret_ref = (long)ret_var.inner;
8831 if (ret_var.is_owned) {
8837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8838 LDKUpdateFailHTLC this_ptr_conv;
8839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8840 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8841 UpdateFailHTLC_free(this_ptr_conv);
8844 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8845 LDKUpdateFailHTLC orig_conv;
8846 orig_conv.inner = (void*)(orig & (~1));
8847 orig_conv.is_owned = (orig & 1) || (orig == 0);
8848 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
8849 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8850 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8851 long ret_ref = (long)ret_var.inner;
8852 if (ret_var.is_owned) {
8858 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8859 LDKUpdateFailHTLC this_ptr_conv;
8860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8861 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8862 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8863 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
8867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8868 LDKUpdateFailHTLC this_ptr_conv;
8869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8870 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8871 LDKThirtyTwoBytes val_ref;
8872 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8873 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8874 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
8877 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8878 LDKUpdateFailHTLC this_ptr_conv;
8879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8881 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
8885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8886 LDKUpdateFailHTLC this_ptr_conv;
8887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8888 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8889 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
8892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8893 LDKUpdateFailMalformedHTLC this_ptr_conv;
8894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8895 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8896 UpdateFailMalformedHTLC_free(this_ptr_conv);
8899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8900 LDKUpdateFailMalformedHTLC orig_conv;
8901 orig_conv.inner = (void*)(orig & (~1));
8902 orig_conv.is_owned = (orig & 1) || (orig == 0);
8903 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
8904 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8905 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8906 long ret_ref = (long)ret_var.inner;
8907 if (ret_var.is_owned) {
8913 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8914 LDKUpdateFailMalformedHTLC this_ptr_conv;
8915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8916 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8917 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8918 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
8922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8923 LDKUpdateFailMalformedHTLC this_ptr_conv;
8924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8925 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8926 LDKThirtyTwoBytes val_ref;
8927 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8928 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8929 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
8932 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8933 LDKUpdateFailMalformedHTLC this_ptr_conv;
8934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8935 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8936 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
8940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8941 LDKUpdateFailMalformedHTLC this_ptr_conv;
8942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8943 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8944 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
8947 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
8948 LDKUpdateFailMalformedHTLC this_ptr_conv;
8949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8950 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8951 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
8955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8956 LDKUpdateFailMalformedHTLC this_ptr_conv;
8957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8958 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8959 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
8962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8963 LDKCommitmentSigned this_ptr_conv;
8964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8965 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8966 CommitmentSigned_free(this_ptr_conv);
8969 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8970 LDKCommitmentSigned orig_conv;
8971 orig_conv.inner = (void*)(orig & (~1));
8972 orig_conv.is_owned = (orig & 1) || (orig == 0);
8973 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
8974 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8975 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8976 long ret_ref = (long)ret_var.inner;
8977 if (ret_var.is_owned) {
8983 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8984 LDKCommitmentSigned this_ptr_conv;
8985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8986 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8987 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8988 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
8992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8993 LDKCommitmentSigned 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 LDKThirtyTwoBytes val_ref;
8997 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8998 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8999 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
9002 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9003 LDKCommitmentSigned this_ptr_conv;
9004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9005 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9006 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9007 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
9011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9012 LDKCommitmentSigned this_ptr_conv;
9013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9014 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9015 LDKSignature val_ref;
9016 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9017 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9018 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
9021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
9022 LDKCommitmentSigned this_ptr_conv;
9023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9024 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9025 LDKCVec_SignatureZ val_constr;
9026 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9027 if (val_constr.datalen > 0)
9028 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9030 val_constr.data = NULL;
9031 for (size_t i = 0; i < val_constr.datalen; i++) {
9032 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
9033 LDKSignature arr_conv_8_ref;
9034 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9035 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9036 val_constr.data[i] = arr_conv_8_ref;
9038 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
9041 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) {
9042 LDKThirtyTwoBytes channel_id_arg_ref;
9043 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9044 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9045 LDKSignature signature_arg_ref;
9046 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9047 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9048 LDKCVec_SignatureZ htlc_signatures_arg_constr;
9049 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
9050 if (htlc_signatures_arg_constr.datalen > 0)
9051 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9053 htlc_signatures_arg_constr.data = NULL;
9054 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
9055 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
9056 LDKSignature arr_conv_8_ref;
9057 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9058 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9059 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
9061 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
9062 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9063 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9064 long ret_ref = (long)ret_var.inner;
9065 if (ret_var.is_owned) {
9071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9072 LDKRevokeAndACK this_ptr_conv;
9073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9074 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9075 RevokeAndACK_free(this_ptr_conv);
9078 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9079 LDKRevokeAndACK orig_conv;
9080 orig_conv.inner = (void*)(orig & (~1));
9081 orig_conv.is_owned = (orig & 1) || (orig == 0);
9082 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
9083 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9084 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9085 long ret_ref = (long)ret_var.inner;
9086 if (ret_var.is_owned) {
9092 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9093 LDKRevokeAndACK this_ptr_conv;
9094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9095 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9096 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9097 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
9101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9102 LDKRevokeAndACK this_ptr_conv;
9103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9104 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9105 LDKThirtyTwoBytes val_ref;
9106 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9107 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9108 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
9111 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9112 LDKRevokeAndACK this_ptr_conv;
9113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9114 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9115 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9116 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
9120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9121 LDKRevokeAndACK this_ptr_conv;
9122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9123 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9124 LDKThirtyTwoBytes val_ref;
9125 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9126 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9127 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
9130 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9131 LDKRevokeAndACK this_ptr_conv;
9132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9133 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9134 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9135 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
9139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9140 LDKRevokeAndACK this_ptr_conv;
9141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9142 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9143 LDKPublicKey val_ref;
9144 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9145 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9146 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
9149 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) {
9150 LDKThirtyTwoBytes channel_id_arg_ref;
9151 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9152 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9153 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
9154 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
9155 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
9156 LDKPublicKey next_per_commitment_point_arg_ref;
9157 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
9158 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
9159 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
9160 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9161 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9162 long ret_ref = (long)ret_var.inner;
9163 if (ret_var.is_owned) {
9169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9170 LDKUpdateFee this_ptr_conv;
9171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9172 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9173 UpdateFee_free(this_ptr_conv);
9176 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9177 LDKUpdateFee orig_conv;
9178 orig_conv.inner = (void*)(orig & (~1));
9179 orig_conv.is_owned = (orig & 1) || (orig == 0);
9180 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
9181 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9182 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9183 long ret_ref = (long)ret_var.inner;
9184 if (ret_var.is_owned) {
9190 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9191 LDKUpdateFee this_ptr_conv;
9192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9193 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9194 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9195 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
9199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9200 LDKUpdateFee 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 LDKThirtyTwoBytes val_ref;
9204 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9205 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9206 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
9209 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
9210 LDKUpdateFee this_ptr_conv;
9211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9212 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9213 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
9217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9218 LDKUpdateFee this_ptr_conv;
9219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9220 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9221 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
9224 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
9225 LDKThirtyTwoBytes channel_id_arg_ref;
9226 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9227 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9228 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
9229 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9230 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9231 long ret_ref = (long)ret_var.inner;
9232 if (ret_var.is_owned) {
9238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9239 LDKDataLossProtect this_ptr_conv;
9240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9241 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9242 DataLossProtect_free(this_ptr_conv);
9245 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9246 LDKDataLossProtect orig_conv;
9247 orig_conv.inner = (void*)(orig & (~1));
9248 orig_conv.is_owned = (orig & 1) || (orig == 0);
9249 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
9250 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9251 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9252 long ret_ref = (long)ret_var.inner;
9253 if (ret_var.is_owned) {
9259 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9260 LDKDataLossProtect this_ptr_conv;
9261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9262 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9263 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9264 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
9268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9269 LDKDataLossProtect this_ptr_conv;
9270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9271 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9272 LDKThirtyTwoBytes val_ref;
9273 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9274 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9275 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
9278 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9279 LDKDataLossProtect this_ptr_conv;
9280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9281 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9282 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9283 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
9287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9288 LDKDataLossProtect this_ptr_conv;
9289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9290 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9291 LDKPublicKey val_ref;
9292 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9293 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9294 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
9297 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) {
9298 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
9299 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
9300 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
9301 LDKPublicKey my_current_per_commitment_point_arg_ref;
9302 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
9303 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
9304 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
9305 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9306 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9307 long ret_ref = (long)ret_var.inner;
9308 if (ret_var.is_owned) {
9314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9315 LDKChannelReestablish this_ptr_conv;
9316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9317 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9318 ChannelReestablish_free(this_ptr_conv);
9321 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9322 LDKChannelReestablish orig_conv;
9323 orig_conv.inner = (void*)(orig & (~1));
9324 orig_conv.is_owned = (orig & 1) || (orig == 0);
9325 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
9326 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9327 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9328 long ret_ref = (long)ret_var.inner;
9329 if (ret_var.is_owned) {
9335 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9336 LDKChannelReestablish this_ptr_conv;
9337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9339 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9340 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
9344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9345 LDKChannelReestablish this_ptr_conv;
9346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9348 LDKThirtyTwoBytes val_ref;
9349 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9350 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9351 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
9354 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9355 LDKChannelReestablish this_ptr_conv;
9356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9357 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9358 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
9362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9363 LDKChannelReestablish this_ptr_conv;
9364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9365 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9366 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
9369 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9370 LDKChannelReestablish this_ptr_conv;
9371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9372 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9373 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
9377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9378 LDKChannelReestablish this_ptr_conv;
9379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9380 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9381 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
9384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9385 LDKAnnouncementSignatures this_ptr_conv;
9386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9388 AnnouncementSignatures_free(this_ptr_conv);
9391 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9392 LDKAnnouncementSignatures orig_conv;
9393 orig_conv.inner = (void*)(orig & (~1));
9394 orig_conv.is_owned = (orig & 1) || (orig == 0);
9395 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
9396 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9397 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9398 long ret_ref = (long)ret_var.inner;
9399 if (ret_var.is_owned) {
9405 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9406 LDKAnnouncementSignatures this_ptr_conv;
9407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9408 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9409 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9410 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
9414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9415 LDKAnnouncementSignatures this_ptr_conv;
9416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9417 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9418 LDKThirtyTwoBytes val_ref;
9419 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9420 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9421 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
9424 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9425 LDKAnnouncementSignatures this_ptr_conv;
9426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9427 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9428 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
9432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9433 LDKAnnouncementSignatures this_ptr_conv;
9434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9435 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9436 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
9439 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9440 LDKAnnouncementSignatures this_ptr_conv;
9441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9442 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9443 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9444 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
9448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9449 LDKAnnouncementSignatures this_ptr_conv;
9450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9452 LDKSignature val_ref;
9453 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9454 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9455 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
9458 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9459 LDKAnnouncementSignatures this_ptr_conv;
9460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9462 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9463 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
9467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9468 LDKAnnouncementSignatures this_ptr_conv;
9469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9471 LDKSignature val_ref;
9472 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9473 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9474 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
9477 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) {
9478 LDKThirtyTwoBytes channel_id_arg_ref;
9479 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9480 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9481 LDKSignature node_signature_arg_ref;
9482 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
9483 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
9484 LDKSignature bitcoin_signature_arg_ref;
9485 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
9486 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
9487 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
9488 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9489 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9490 long ret_ref = (long)ret_var.inner;
9491 if (ret_var.is_owned) {
9497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9498 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
9499 FREE((void*)this_ptr);
9500 NetAddress_free(this_ptr_conv);
9503 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9504 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
9505 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9506 *ret_copy = NetAddress_clone(orig_conv);
9507 long ret_ref = (long)ret_copy;
9511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9512 LDKUnsignedNodeAnnouncement this_ptr_conv;
9513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9514 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9515 UnsignedNodeAnnouncement_free(this_ptr_conv);
9518 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9519 LDKUnsignedNodeAnnouncement orig_conv;
9520 orig_conv.inner = (void*)(orig & (~1));
9521 orig_conv.is_owned = (orig & 1) || (orig == 0);
9522 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
9523 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9524 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9525 long ret_ref = (long)ret_var.inner;
9526 if (ret_var.is_owned) {
9532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9533 LDKUnsignedNodeAnnouncement this_ptr_conv;
9534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9536 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9537 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9538 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9539 long ret_ref = (long)ret_var.inner;
9540 if (ret_var.is_owned) {
9546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9547 LDKUnsignedNodeAnnouncement 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 LDKNodeFeatures val_conv;
9551 val_conv.inner = (void*)(val & (~1));
9552 val_conv.is_owned = (val & 1) || (val == 0);
9553 // Warning: we may need a move here but can't clone!
9554 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9557 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9558 LDKUnsignedNodeAnnouncement this_ptr_conv;
9559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9560 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9561 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9566 LDKUnsignedNodeAnnouncement 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 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9572 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9573 LDKUnsignedNodeAnnouncement this_ptr_conv;
9574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9576 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9577 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
9581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9582 LDKUnsignedNodeAnnouncement this_ptr_conv;
9583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9585 LDKPublicKey val_ref;
9586 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9587 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9588 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
9591 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
9592 LDKUnsignedNodeAnnouncement this_ptr_conv;
9593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9595 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
9596 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
9600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9601 LDKUnsignedNodeAnnouncement this_ptr_conv;
9602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9603 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9604 LDKThreeBytes val_ref;
9605 CHECK((*_env)->GetArrayLength (_env, val) == 3);
9606 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
9607 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
9610 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
9611 LDKUnsignedNodeAnnouncement this_ptr_conv;
9612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9613 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9614 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9615 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
9619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9620 LDKUnsignedNodeAnnouncement this_ptr_conv;
9621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9623 LDKThirtyTwoBytes val_ref;
9624 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9625 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9626 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
9629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9630 LDKUnsignedNodeAnnouncement this_ptr_conv;
9631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9632 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9633 LDKCVec_NetAddressZ val_constr;
9634 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9635 if (val_constr.datalen > 0)
9636 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9638 val_constr.data = NULL;
9639 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9640 for (size_t m = 0; m < val_constr.datalen; m++) {
9641 long arr_conv_12 = val_vals[m];
9642 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9643 FREE((void*)arr_conv_12);
9644 val_constr.data[m] = arr_conv_12_conv;
9646 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9647 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
9650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9651 LDKNodeAnnouncement this_ptr_conv;
9652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9653 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9654 NodeAnnouncement_free(this_ptr_conv);
9657 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9658 LDKNodeAnnouncement orig_conv;
9659 orig_conv.inner = (void*)(orig & (~1));
9660 orig_conv.is_owned = (orig & 1) || (orig == 0);
9661 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
9662 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9663 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9664 long ret_ref = (long)ret_var.inner;
9665 if (ret_var.is_owned) {
9671 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9672 LDKNodeAnnouncement this_ptr_conv;
9673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9674 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9675 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9676 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
9680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9681 LDKNodeAnnouncement this_ptr_conv;
9682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9683 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9684 LDKSignature val_ref;
9685 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9686 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9687 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
9690 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9691 LDKNodeAnnouncement this_ptr_conv;
9692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9693 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9694 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
9695 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9696 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9697 long ret_ref = (long)ret_var.inner;
9698 if (ret_var.is_owned) {
9704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9705 LDKNodeAnnouncement this_ptr_conv;
9706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9707 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9708 LDKUnsignedNodeAnnouncement val_conv;
9709 val_conv.inner = (void*)(val & (~1));
9710 val_conv.is_owned = (val & 1) || (val == 0);
9711 if (val_conv.inner != NULL)
9712 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
9713 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
9716 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9717 LDKSignature signature_arg_ref;
9718 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9719 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9720 LDKUnsignedNodeAnnouncement contents_arg_conv;
9721 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9722 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9723 if (contents_arg_conv.inner != NULL)
9724 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
9725 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
9726 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9727 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9728 long ret_ref = (long)ret_var.inner;
9729 if (ret_var.is_owned) {
9735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9736 LDKUnsignedChannelAnnouncement this_ptr_conv;
9737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9739 UnsignedChannelAnnouncement_free(this_ptr_conv);
9742 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9743 LDKUnsignedChannelAnnouncement orig_conv;
9744 orig_conv.inner = (void*)(orig & (~1));
9745 orig_conv.is_owned = (orig & 1) || (orig == 0);
9746 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
9747 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9748 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9749 long ret_ref = (long)ret_var.inner;
9750 if (ret_var.is_owned) {
9756 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9757 LDKUnsignedChannelAnnouncement this_ptr_conv;
9758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9759 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9760 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
9761 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9762 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9763 long ret_ref = (long)ret_var.inner;
9764 if (ret_var.is_owned) {
9770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9771 LDKUnsignedChannelAnnouncement this_ptr_conv;
9772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9773 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9774 LDKChannelFeatures val_conv;
9775 val_conv.inner = (void*)(val & (~1));
9776 val_conv.is_owned = (val & 1) || (val == 0);
9777 // Warning: we may need a move here but can't clone!
9778 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
9781 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9782 LDKUnsignedChannelAnnouncement this_ptr_conv;
9783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9784 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9785 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9786 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
9790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9791 LDKUnsignedChannelAnnouncement this_ptr_conv;
9792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9793 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9794 LDKThirtyTwoBytes val_ref;
9795 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9796 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9797 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
9800 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9801 LDKUnsignedChannelAnnouncement this_ptr_conv;
9802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9803 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9804 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
9808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9809 LDKUnsignedChannelAnnouncement this_ptr_conv;
9810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9811 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9812 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
9815 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9816 LDKUnsignedChannelAnnouncement this_ptr_conv;
9817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9818 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9819 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9820 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
9824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9825 LDKUnsignedChannelAnnouncement this_ptr_conv;
9826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9827 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9828 LDKPublicKey val_ref;
9829 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9830 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9831 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
9834 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9835 LDKUnsignedChannelAnnouncement this_ptr_conv;
9836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9837 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9838 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9839 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
9843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9844 LDKUnsignedChannelAnnouncement this_ptr_conv;
9845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9846 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9847 LDKPublicKey val_ref;
9848 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9849 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9850 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
9853 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9854 LDKUnsignedChannelAnnouncement this_ptr_conv;
9855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9856 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9857 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9858 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
9862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9863 LDKUnsignedChannelAnnouncement this_ptr_conv;
9864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9865 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9866 LDKPublicKey val_ref;
9867 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9868 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9869 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
9872 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9873 LDKUnsignedChannelAnnouncement this_ptr_conv;
9874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9875 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9876 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9877 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
9881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9882 LDKUnsignedChannelAnnouncement this_ptr_conv;
9883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9884 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9885 LDKPublicKey val_ref;
9886 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9887 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9888 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
9891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9892 LDKChannelAnnouncement this_ptr_conv;
9893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9894 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9895 ChannelAnnouncement_free(this_ptr_conv);
9898 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9899 LDKChannelAnnouncement orig_conv;
9900 orig_conv.inner = (void*)(orig & (~1));
9901 orig_conv.is_owned = (orig & 1) || (orig == 0);
9902 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
9903 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9904 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9905 long ret_ref = (long)ret_var.inner;
9906 if (ret_var.is_owned) {
9912 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9913 LDKChannelAnnouncement this_ptr_conv;
9914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9915 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9916 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9917 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
9921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9922 LDKChannelAnnouncement this_ptr_conv;
9923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9924 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9925 LDKSignature val_ref;
9926 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9927 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9928 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
9931 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9932 LDKChannelAnnouncement 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9936 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
9940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9941 LDKChannelAnnouncement this_ptr_conv;
9942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9943 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9944 LDKSignature val_ref;
9945 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9946 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9947 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
9950 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9951 LDKChannelAnnouncement 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9955 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
9959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9960 LDKChannelAnnouncement this_ptr_conv;
9961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9962 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9963 LDKSignature val_ref;
9964 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9965 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9966 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
9969 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9970 LDKChannelAnnouncement 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9974 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
9978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9979 LDKChannelAnnouncement this_ptr_conv;
9980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9981 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9982 LDKSignature val_ref;
9983 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9984 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9985 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
9988 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9989 LDKChannelAnnouncement 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 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
9993 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9994 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9995 long ret_ref = (long)ret_var.inner;
9996 if (ret_var.is_owned) {
10002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10003 LDKChannelAnnouncement this_ptr_conv;
10004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10005 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10006 LDKUnsignedChannelAnnouncement val_conv;
10007 val_conv.inner = (void*)(val & (~1));
10008 val_conv.is_owned = (val & 1) || (val == 0);
10009 if (val_conv.inner != NULL)
10010 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
10011 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
10014 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) {
10015 LDKSignature node_signature_1_arg_ref;
10016 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
10017 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
10018 LDKSignature node_signature_2_arg_ref;
10019 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
10020 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
10021 LDKSignature bitcoin_signature_1_arg_ref;
10022 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
10023 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
10024 LDKSignature bitcoin_signature_2_arg_ref;
10025 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
10026 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
10027 LDKUnsignedChannelAnnouncement contents_arg_conv;
10028 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10029 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10030 if (contents_arg_conv.inner != NULL)
10031 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
10032 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);
10033 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10034 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10035 long ret_ref = (long)ret_var.inner;
10036 if (ret_var.is_owned) {
10042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10043 LDKUnsignedChannelUpdate this_ptr_conv;
10044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10045 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10046 UnsignedChannelUpdate_free(this_ptr_conv);
10049 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10050 LDKUnsignedChannelUpdate orig_conv;
10051 orig_conv.inner = (void*)(orig & (~1));
10052 orig_conv.is_owned = (orig & 1) || (orig == 0);
10053 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
10054 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10055 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10056 long ret_ref = (long)ret_var.inner;
10057 if (ret_var.is_owned) {
10063 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10064 LDKUnsignedChannelUpdate this_ptr_conv;
10065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10066 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10067 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10068 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
10072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10073 LDKUnsignedChannelUpdate this_ptr_conv;
10074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10075 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10076 LDKThirtyTwoBytes val_ref;
10077 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10078 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10079 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
10082 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10083 LDKUnsignedChannelUpdate this_ptr_conv;
10084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10085 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10086 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
10090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10091 LDKUnsignedChannelUpdate this_ptr_conv;
10092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10094 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
10097 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10098 LDKUnsignedChannelUpdate this_ptr_conv;
10099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10100 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10101 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
10105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10106 LDKUnsignedChannelUpdate this_ptr_conv;
10107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10109 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
10112 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
10113 LDKUnsignedChannelUpdate this_ptr_conv;
10114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10115 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10116 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
10120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
10121 LDKUnsignedChannelUpdate this_ptr_conv;
10122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10123 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10124 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
10127 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10128 LDKUnsignedChannelUpdate this_ptr_conv;
10129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10130 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10131 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
10135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10136 LDKUnsignedChannelUpdate this_ptr_conv;
10137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10138 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10139 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
10142 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10143 LDKUnsignedChannelUpdate this_ptr_conv;
10144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10145 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10146 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
10150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10151 LDKUnsignedChannelUpdate this_ptr_conv;
10152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10153 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10154 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
10157 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10158 LDKUnsignedChannelUpdate this_ptr_conv;
10159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10160 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10161 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
10165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10166 LDKUnsignedChannelUpdate this_ptr_conv;
10167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10168 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10169 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
10172 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
10173 LDKUnsignedChannelUpdate this_ptr_conv;
10174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10175 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10176 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
10180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10181 LDKUnsignedChannelUpdate this_ptr_conv;
10182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10183 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10184 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
10187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10188 LDKChannelUpdate this_ptr_conv;
10189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10190 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10191 ChannelUpdate_free(this_ptr_conv);
10194 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10195 LDKChannelUpdate orig_conv;
10196 orig_conv.inner = (void*)(orig & (~1));
10197 orig_conv.is_owned = (orig & 1) || (orig == 0);
10198 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
10199 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10200 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10201 long ret_ref = (long)ret_var.inner;
10202 if (ret_var.is_owned) {
10208 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10209 LDKChannelUpdate this_ptr_conv;
10210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10211 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10212 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10213 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
10217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10218 LDKChannelUpdate this_ptr_conv;
10219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10220 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10221 LDKSignature val_ref;
10222 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10223 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10224 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
10227 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10228 LDKChannelUpdate 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 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
10232 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10233 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10234 long ret_ref = (long)ret_var.inner;
10235 if (ret_var.is_owned) {
10241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10242 LDKChannelUpdate this_ptr_conv;
10243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10244 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10245 LDKUnsignedChannelUpdate val_conv;
10246 val_conv.inner = (void*)(val & (~1));
10247 val_conv.is_owned = (val & 1) || (val == 0);
10248 if (val_conv.inner != NULL)
10249 val_conv = UnsignedChannelUpdate_clone(&val_conv);
10250 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
10253 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
10254 LDKSignature signature_arg_ref;
10255 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10256 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10257 LDKUnsignedChannelUpdate contents_arg_conv;
10258 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10259 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10260 if (contents_arg_conv.inner != NULL)
10261 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
10262 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
10263 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10264 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10265 long ret_ref = (long)ret_var.inner;
10266 if (ret_var.is_owned) {
10272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10273 LDKQueryChannelRange 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 QueryChannelRange_free(this_ptr_conv);
10279 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10280 LDKQueryChannelRange orig_conv;
10281 orig_conv.inner = (void*)(orig & (~1));
10282 orig_conv.is_owned = (orig & 1) || (orig == 0);
10283 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
10284 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10285 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10286 long ret_ref = (long)ret_var.inner;
10287 if (ret_var.is_owned) {
10293 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10294 LDKQueryChannelRange this_ptr_conv;
10295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10296 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10297 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10298 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
10302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10303 LDKQueryChannelRange this_ptr_conv;
10304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10305 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10306 LDKThirtyTwoBytes val_ref;
10307 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10308 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10309 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10312 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10313 LDKQueryChannelRange this_ptr_conv;
10314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10316 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
10320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10321 LDKQueryChannelRange this_ptr_conv;
10322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10323 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10324 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
10327 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10328 LDKQueryChannelRange this_ptr_conv;
10329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10330 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10331 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
10335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10336 LDKQueryChannelRange this_ptr_conv;
10337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10339 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10342 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) {
10343 LDKThirtyTwoBytes chain_hash_arg_ref;
10344 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10345 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10346 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
10347 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10348 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10349 long ret_ref = (long)ret_var.inner;
10350 if (ret_var.is_owned) {
10356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10357 LDKReplyChannelRange this_ptr_conv;
10358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10359 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10360 ReplyChannelRange_free(this_ptr_conv);
10363 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10364 LDKReplyChannelRange orig_conv;
10365 orig_conv.inner = (void*)(orig & (~1));
10366 orig_conv.is_owned = (orig & 1) || (orig == 0);
10367 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
10368 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10369 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10370 long ret_ref = (long)ret_var.inner;
10371 if (ret_var.is_owned) {
10377 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10378 LDKReplyChannelRange this_ptr_conv;
10379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10380 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10381 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10382 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
10386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10387 LDKReplyChannelRange this_ptr_conv;
10388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10389 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10390 LDKThirtyTwoBytes val_ref;
10391 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10392 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10393 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10396 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10397 LDKReplyChannelRange this_ptr_conv;
10398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10399 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10400 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
10404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10405 LDKReplyChannelRange this_ptr_conv;
10406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10408 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
10411 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10412 LDKReplyChannelRange this_ptr_conv;
10413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10414 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10415 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
10419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10420 LDKReplyChannelRange 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 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10427 LDKReplyChannelRange this_ptr_conv;
10428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10429 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10430 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
10434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10435 LDKReplyChannelRange 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 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
10441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10442 LDKReplyChannelRange this_ptr_conv;
10443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10444 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10445 LDKCVec_u64Z val_constr;
10446 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10447 if (val_constr.datalen > 0)
10448 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10450 val_constr.data = NULL;
10451 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10452 for (size_t g = 0; g < val_constr.datalen; g++) {
10453 long arr_conv_6 = val_vals[g];
10454 val_constr.data[g] = arr_conv_6;
10456 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10457 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
10460 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) {
10461 LDKThirtyTwoBytes chain_hash_arg_ref;
10462 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10463 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10464 LDKCVec_u64Z short_channel_ids_arg_constr;
10465 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10466 if (short_channel_ids_arg_constr.datalen > 0)
10467 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10469 short_channel_ids_arg_constr.data = NULL;
10470 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10471 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10472 long arr_conv_6 = short_channel_ids_arg_vals[g];
10473 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10475 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10476 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
10477 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10478 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10479 long ret_ref = (long)ret_var.inner;
10480 if (ret_var.is_owned) {
10486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10487 LDKQueryShortChannelIds this_ptr_conv;
10488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10489 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10490 QueryShortChannelIds_free(this_ptr_conv);
10493 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10494 LDKQueryShortChannelIds orig_conv;
10495 orig_conv.inner = (void*)(orig & (~1));
10496 orig_conv.is_owned = (orig & 1) || (orig == 0);
10497 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
10498 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10499 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10500 long ret_ref = (long)ret_var.inner;
10501 if (ret_var.is_owned) {
10507 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10508 LDKQueryShortChannelIds this_ptr_conv;
10509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10510 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10511 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10512 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
10516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10517 LDKQueryShortChannelIds this_ptr_conv;
10518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10519 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10520 LDKThirtyTwoBytes val_ref;
10521 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10522 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10523 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
10526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10527 LDKQueryShortChannelIds 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 LDKCVec_u64Z val_constr;
10531 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10532 if (val_constr.datalen > 0)
10533 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10535 val_constr.data = NULL;
10536 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10537 for (size_t g = 0; g < val_constr.datalen; g++) {
10538 long arr_conv_6 = val_vals[g];
10539 val_constr.data[g] = arr_conv_6;
10541 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10542 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
10545 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
10546 LDKThirtyTwoBytes chain_hash_arg_ref;
10547 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10548 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10549 LDKCVec_u64Z short_channel_ids_arg_constr;
10550 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10551 if (short_channel_ids_arg_constr.datalen > 0)
10552 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10554 short_channel_ids_arg_constr.data = NULL;
10555 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10556 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10557 long arr_conv_6 = short_channel_ids_arg_vals[g];
10558 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10560 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10561 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
10562 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10563 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10564 long ret_ref = (long)ret_var.inner;
10565 if (ret_var.is_owned) {
10571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10572 LDKReplyShortChannelIdsEnd this_ptr_conv;
10573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10574 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10575 ReplyShortChannelIdsEnd_free(this_ptr_conv);
10578 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10579 LDKReplyShortChannelIdsEnd orig_conv;
10580 orig_conv.inner = (void*)(orig & (~1));
10581 orig_conv.is_owned = (orig & 1) || (orig == 0);
10582 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
10583 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10584 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10585 long ret_ref = (long)ret_var.inner;
10586 if (ret_var.is_owned) {
10592 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10593 LDKReplyShortChannelIdsEnd this_ptr_conv;
10594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10595 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10596 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10597 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
10601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10602 LDKReplyShortChannelIdsEnd this_ptr_conv;
10603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10604 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10605 LDKThirtyTwoBytes val_ref;
10606 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10607 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10608 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
10611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10612 LDKReplyShortChannelIdsEnd this_ptr_conv;
10613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10614 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10615 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
10619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10620 LDKReplyShortChannelIdsEnd this_ptr_conv;
10621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10623 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
10626 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
10627 LDKThirtyTwoBytes chain_hash_arg_ref;
10628 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10629 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10630 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
10631 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10632 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10633 long ret_ref = (long)ret_var.inner;
10634 if (ret_var.is_owned) {
10640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10641 LDKGossipTimestampFilter this_ptr_conv;
10642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10643 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10644 GossipTimestampFilter_free(this_ptr_conv);
10647 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10648 LDKGossipTimestampFilter orig_conv;
10649 orig_conv.inner = (void*)(orig & (~1));
10650 orig_conv.is_owned = (orig & 1) || (orig == 0);
10651 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
10652 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10653 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10654 long ret_ref = (long)ret_var.inner;
10655 if (ret_var.is_owned) {
10661 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10662 LDKGossipTimestampFilter this_ptr_conv;
10663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10664 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10665 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10666 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
10670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10671 LDKGossipTimestampFilter this_ptr_conv;
10672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10673 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10674 LDKThirtyTwoBytes val_ref;
10675 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10676 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10677 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
10680 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10681 LDKGossipTimestampFilter this_ptr_conv;
10682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10683 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10684 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
10688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10689 LDKGossipTimestampFilter this_ptr_conv;
10690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10691 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10692 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
10695 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
10696 LDKGossipTimestampFilter this_ptr_conv;
10697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10699 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
10703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10704 LDKGossipTimestampFilter this_ptr_conv;
10705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10706 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10707 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
10710 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) {
10711 LDKThirtyTwoBytes chain_hash_arg_ref;
10712 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10713 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10714 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
10715 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10716 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10717 long ret_ref = (long)ret_var.inner;
10718 if (ret_var.is_owned) {
10724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10725 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
10726 FREE((void*)this_ptr);
10727 ErrorAction_free(this_ptr_conv);
10730 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10731 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
10732 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10733 *ret_copy = ErrorAction_clone(orig_conv);
10734 long ret_ref = (long)ret_copy;
10738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10739 LDKLightningError this_ptr_conv;
10740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10741 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10742 LightningError_free(this_ptr_conv);
10745 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
10746 LDKLightningError this_ptr_conv;
10747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10748 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10749 LDKStr _str = LightningError_get_err(&this_ptr_conv);
10750 char* _buf = MALLOC(_str.len + 1, "str conv buf");
10751 memcpy(_buf, _str.chars, _str.len);
10752 _buf[_str.len] = 0;
10753 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
10758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10759 LDKLightningError this_ptr_conv;
10760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10761 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10762 LDKCVec_u8Z val_ref;
10763 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
10764 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
10765 LightningError_set_err(&this_ptr_conv, val_ref);
10766 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
10769 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
10770 LDKLightningError this_ptr_conv;
10771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10772 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10773 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10774 *ret_copy = LightningError_get_action(&this_ptr_conv);
10775 long ret_ref = (long)ret_copy;
10779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10780 LDKLightningError this_ptr_conv;
10781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10782 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10783 LDKErrorAction val_conv = *(LDKErrorAction*)val;
10785 LightningError_set_action(&this_ptr_conv, val_conv);
10788 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
10789 LDKCVec_u8Z err_arg_ref;
10790 err_arg_ref.data = (*_env)->GetByteArrayElements (_env, err_arg, NULL);
10791 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
10792 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
10793 FREE((void*)action_arg);
10794 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
10795 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10796 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10797 long ret_ref = (long)ret_var.inner;
10798 if (ret_var.is_owned) {
10801 (*_env)->ReleaseByteArrayElements(_env, err_arg, (int8_t*)err_arg_ref.data, 0);
10805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10806 LDKCommitmentUpdate this_ptr_conv;
10807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10808 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10809 CommitmentUpdate_free(this_ptr_conv);
10812 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10813 LDKCommitmentUpdate orig_conv;
10814 orig_conv.inner = (void*)(orig & (~1));
10815 orig_conv.is_owned = (orig & 1) || (orig == 0);
10816 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
10817 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10818 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10819 long ret_ref = (long)ret_var.inner;
10820 if (ret_var.is_owned) {
10826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10827 LDKCommitmentUpdate this_ptr_conv;
10828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10829 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10830 LDKCVec_UpdateAddHTLCZ val_constr;
10831 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10832 if (val_constr.datalen > 0)
10833 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10835 val_constr.data = NULL;
10836 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10837 for (size_t p = 0; p < val_constr.datalen; p++) {
10838 long arr_conv_15 = val_vals[p];
10839 LDKUpdateAddHTLC arr_conv_15_conv;
10840 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10841 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10842 if (arr_conv_15_conv.inner != NULL)
10843 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10844 val_constr.data[p] = arr_conv_15_conv;
10846 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10847 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
10850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10851 LDKCommitmentUpdate this_ptr_conv;
10852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10853 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10854 LDKCVec_UpdateFulfillHTLCZ val_constr;
10855 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10856 if (val_constr.datalen > 0)
10857 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10859 val_constr.data = NULL;
10860 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10861 for (size_t t = 0; t < val_constr.datalen; t++) {
10862 long arr_conv_19 = val_vals[t];
10863 LDKUpdateFulfillHTLC arr_conv_19_conv;
10864 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10865 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10866 if (arr_conv_19_conv.inner != NULL)
10867 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10868 val_constr.data[t] = arr_conv_19_conv;
10870 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10871 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
10874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10875 LDKCommitmentUpdate this_ptr_conv;
10876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10877 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10878 LDKCVec_UpdateFailHTLCZ val_constr;
10879 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10880 if (val_constr.datalen > 0)
10881 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10883 val_constr.data = NULL;
10884 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10885 for (size_t q = 0; q < val_constr.datalen; q++) {
10886 long arr_conv_16 = val_vals[q];
10887 LDKUpdateFailHTLC arr_conv_16_conv;
10888 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10889 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10890 if (arr_conv_16_conv.inner != NULL)
10891 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
10892 val_constr.data[q] = arr_conv_16_conv;
10894 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10895 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
10898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10899 LDKCommitmentUpdate this_ptr_conv;
10900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10901 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10902 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
10903 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10904 if (val_constr.datalen > 0)
10905 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10907 val_constr.data = NULL;
10908 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10909 for (size_t z = 0; z < val_constr.datalen; z++) {
10910 long arr_conv_25 = val_vals[z];
10911 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
10912 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
10913 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
10914 if (arr_conv_25_conv.inner != NULL)
10915 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
10916 val_constr.data[z] = arr_conv_25_conv;
10918 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10919 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
10922 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
10923 LDKCommitmentUpdate this_ptr_conv;
10924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10925 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10926 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
10927 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10928 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10929 long ret_ref = (long)ret_var.inner;
10930 if (ret_var.is_owned) {
10936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10937 LDKCommitmentUpdate this_ptr_conv;
10938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10939 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10940 LDKUpdateFee val_conv;
10941 val_conv.inner = (void*)(val & (~1));
10942 val_conv.is_owned = (val & 1) || (val == 0);
10943 if (val_conv.inner != NULL)
10944 val_conv = UpdateFee_clone(&val_conv);
10945 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
10948 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
10949 LDKCommitmentUpdate this_ptr_conv;
10950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10951 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10952 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
10953 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10954 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10955 long ret_ref = (long)ret_var.inner;
10956 if (ret_var.is_owned) {
10962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10963 LDKCommitmentUpdate this_ptr_conv;
10964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10965 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10966 LDKCommitmentSigned val_conv;
10967 val_conv.inner = (void*)(val & (~1));
10968 val_conv.is_owned = (val & 1) || (val == 0);
10969 if (val_conv.inner != NULL)
10970 val_conv = CommitmentSigned_clone(&val_conv);
10971 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
10974 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) {
10975 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
10976 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
10977 if (update_add_htlcs_arg_constr.datalen > 0)
10978 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10980 update_add_htlcs_arg_constr.data = NULL;
10981 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
10982 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
10983 long arr_conv_15 = update_add_htlcs_arg_vals[p];
10984 LDKUpdateAddHTLC arr_conv_15_conv;
10985 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10986 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10987 if (arr_conv_15_conv.inner != NULL)
10988 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10989 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
10991 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
10992 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
10993 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
10994 if (update_fulfill_htlcs_arg_constr.datalen > 0)
10995 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10997 update_fulfill_htlcs_arg_constr.data = NULL;
10998 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
10999 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
11000 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
11001 LDKUpdateFulfillHTLC arr_conv_19_conv;
11002 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11003 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11004 if (arr_conv_19_conv.inner != NULL)
11005 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11006 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
11008 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
11009 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
11010 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
11011 if (update_fail_htlcs_arg_constr.datalen > 0)
11012 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11014 update_fail_htlcs_arg_constr.data = NULL;
11015 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
11016 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
11017 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
11018 LDKUpdateFailHTLC arr_conv_16_conv;
11019 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11020 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11021 if (arr_conv_16_conv.inner != NULL)
11022 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11023 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
11025 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
11026 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
11027 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
11028 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
11029 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11031 update_fail_malformed_htlcs_arg_constr.data = NULL;
11032 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
11033 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
11034 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
11035 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11036 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11037 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11038 if (arr_conv_25_conv.inner != NULL)
11039 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11040 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
11042 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
11043 LDKUpdateFee update_fee_arg_conv;
11044 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
11045 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
11046 if (update_fee_arg_conv.inner != NULL)
11047 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
11048 LDKCommitmentSigned commitment_signed_arg_conv;
11049 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
11050 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
11051 if (commitment_signed_arg_conv.inner != NULL)
11052 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
11053 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);
11054 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11055 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11056 long ret_ref = (long)ret_var.inner;
11057 if (ret_var.is_owned) {
11063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11064 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
11065 FREE((void*)this_ptr);
11066 HTLCFailChannelUpdate_free(this_ptr_conv);
11069 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11070 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
11071 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
11072 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
11073 long ret_ref = (long)ret_copy;
11077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11078 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
11079 FREE((void*)this_ptr);
11080 ChannelMessageHandler_free(this_ptr_conv);
11083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11084 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
11085 FREE((void*)this_ptr);
11086 RoutingMessageHandler_free(this_ptr_conv);
11089 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11090 LDKAcceptChannel obj_conv;
11091 obj_conv.inner = (void*)(obj & (~1));
11092 obj_conv.is_owned = (obj & 1) || (obj == 0);
11093 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
11094 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11095 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11096 CVec_u8Z_free(arg_var);
11100 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11101 LDKu8slice ser_ref;
11102 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11103 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11104 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
11105 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11106 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11107 long ret_ref = (long)ret_var.inner;
11108 if (ret_var.is_owned) {
11111 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11115 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
11116 LDKAnnouncementSignatures obj_conv;
11117 obj_conv.inner = (void*)(obj & (~1));
11118 obj_conv.is_owned = (obj & 1) || (obj == 0);
11119 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
11120 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11121 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11122 CVec_u8Z_free(arg_var);
11126 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11127 LDKu8slice ser_ref;
11128 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11129 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11130 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
11131 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11132 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11133 long ret_ref = (long)ret_var.inner;
11134 if (ret_var.is_owned) {
11137 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11141 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
11142 LDKChannelReestablish obj_conv;
11143 obj_conv.inner = (void*)(obj & (~1));
11144 obj_conv.is_owned = (obj & 1) || (obj == 0);
11145 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
11146 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11147 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11148 CVec_u8Z_free(arg_var);
11152 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11153 LDKu8slice ser_ref;
11154 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11155 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11156 LDKChannelReestablish ret_var = ChannelReestablish_read(ser_ref);
11157 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11158 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11159 long ret_ref = (long)ret_var.inner;
11160 if (ret_var.is_owned) {
11163 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11167 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11168 LDKClosingSigned obj_conv;
11169 obj_conv.inner = (void*)(obj & (~1));
11170 obj_conv.is_owned = (obj & 1) || (obj == 0);
11171 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
11172 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11173 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11174 CVec_u8Z_free(arg_var);
11178 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11179 LDKu8slice ser_ref;
11180 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11181 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11182 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
11183 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11184 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11185 long ret_ref = (long)ret_var.inner;
11186 if (ret_var.is_owned) {
11189 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11193 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11194 LDKCommitmentSigned obj_conv;
11195 obj_conv.inner = (void*)(obj & (~1));
11196 obj_conv.is_owned = (obj & 1) || (obj == 0);
11197 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
11198 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11199 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11200 CVec_u8Z_free(arg_var);
11204 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11205 LDKu8slice ser_ref;
11206 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11207 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11208 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
11209 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11210 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11211 long ret_ref = (long)ret_var.inner;
11212 if (ret_var.is_owned) {
11215 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11219 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
11220 LDKFundingCreated obj_conv;
11221 obj_conv.inner = (void*)(obj & (~1));
11222 obj_conv.is_owned = (obj & 1) || (obj == 0);
11223 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
11224 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11225 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11226 CVec_u8Z_free(arg_var);
11230 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11231 LDKu8slice ser_ref;
11232 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11233 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11234 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
11235 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11236 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11237 long ret_ref = (long)ret_var.inner;
11238 if (ret_var.is_owned) {
11241 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11245 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11246 LDKFundingSigned obj_conv;
11247 obj_conv.inner = (void*)(obj & (~1));
11248 obj_conv.is_owned = (obj & 1) || (obj == 0);
11249 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
11250 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11251 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11252 CVec_u8Z_free(arg_var);
11256 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11257 LDKu8slice ser_ref;
11258 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11259 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11260 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
11261 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11262 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11263 long ret_ref = (long)ret_var.inner;
11264 if (ret_var.is_owned) {
11267 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11271 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
11272 LDKFundingLocked obj_conv;
11273 obj_conv.inner = (void*)(obj & (~1));
11274 obj_conv.is_owned = (obj & 1) || (obj == 0);
11275 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
11276 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11277 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11278 CVec_u8Z_free(arg_var);
11282 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11283 LDKu8slice ser_ref;
11284 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11285 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11286 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
11287 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11288 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11289 long ret_ref = (long)ret_var.inner;
11290 if (ret_var.is_owned) {
11293 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11297 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
11299 obj_conv.inner = (void*)(obj & (~1));
11300 obj_conv.is_owned = (obj & 1) || (obj == 0);
11301 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
11302 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11303 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11304 CVec_u8Z_free(arg_var);
11308 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11309 LDKu8slice ser_ref;
11310 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11311 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11312 LDKInit ret_var = Init_read(ser_ref);
11313 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11314 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11315 long ret_ref = (long)ret_var.inner;
11316 if (ret_var.is_owned) {
11319 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11323 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11324 LDKOpenChannel obj_conv;
11325 obj_conv.inner = (void*)(obj & (~1));
11326 obj_conv.is_owned = (obj & 1) || (obj == 0);
11327 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
11328 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11329 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11330 CVec_u8Z_free(arg_var);
11334 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11335 LDKu8slice ser_ref;
11336 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11337 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11338 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
11339 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11340 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11341 long ret_ref = (long)ret_var.inner;
11342 if (ret_var.is_owned) {
11345 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11349 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
11350 LDKRevokeAndACK obj_conv;
11351 obj_conv.inner = (void*)(obj & (~1));
11352 obj_conv.is_owned = (obj & 1) || (obj == 0);
11353 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
11354 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11355 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11356 CVec_u8Z_free(arg_var);
11360 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11361 LDKu8slice ser_ref;
11362 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11363 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11364 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
11365 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11366 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11367 long ret_ref = (long)ret_var.inner;
11368 if (ret_var.is_owned) {
11371 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11375 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
11376 LDKShutdown obj_conv;
11377 obj_conv.inner = (void*)(obj & (~1));
11378 obj_conv.is_owned = (obj & 1) || (obj == 0);
11379 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
11380 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11381 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11382 CVec_u8Z_free(arg_var);
11386 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11387 LDKu8slice ser_ref;
11388 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11389 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11390 LDKShutdown ret_var = Shutdown_read(ser_ref);
11391 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11392 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11393 long ret_ref = (long)ret_var.inner;
11394 if (ret_var.is_owned) {
11397 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11401 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11402 LDKUpdateFailHTLC obj_conv;
11403 obj_conv.inner = (void*)(obj & (~1));
11404 obj_conv.is_owned = (obj & 1) || (obj == 0);
11405 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
11406 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11407 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11408 CVec_u8Z_free(arg_var);
11412 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11413 LDKu8slice ser_ref;
11414 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11415 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11416 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
11417 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11418 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11419 long ret_ref = (long)ret_var.inner;
11420 if (ret_var.is_owned) {
11423 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11427 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11428 LDKUpdateFailMalformedHTLC obj_conv;
11429 obj_conv.inner = (void*)(obj & (~1));
11430 obj_conv.is_owned = (obj & 1) || (obj == 0);
11431 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
11432 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11433 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11434 CVec_u8Z_free(arg_var);
11438 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11439 LDKu8slice ser_ref;
11440 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11441 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11442 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
11443 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11444 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11445 long ret_ref = (long)ret_var.inner;
11446 if (ret_var.is_owned) {
11449 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11453 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
11454 LDKUpdateFee obj_conv;
11455 obj_conv.inner = (void*)(obj & (~1));
11456 obj_conv.is_owned = (obj & 1) || (obj == 0);
11457 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
11458 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11459 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11460 CVec_u8Z_free(arg_var);
11464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11465 LDKu8slice ser_ref;
11466 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11467 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11468 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
11469 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11470 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11471 long ret_ref = (long)ret_var.inner;
11472 if (ret_var.is_owned) {
11475 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11479 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11480 LDKUpdateFulfillHTLC obj_conv;
11481 obj_conv.inner = (void*)(obj & (~1));
11482 obj_conv.is_owned = (obj & 1) || (obj == 0);
11483 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
11484 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11485 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11486 CVec_u8Z_free(arg_var);
11490 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11491 LDKu8slice ser_ref;
11492 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11493 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11494 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
11495 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11496 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11497 long ret_ref = (long)ret_var.inner;
11498 if (ret_var.is_owned) {
11501 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11505 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11506 LDKUpdateAddHTLC obj_conv;
11507 obj_conv.inner = (void*)(obj & (~1));
11508 obj_conv.is_owned = (obj & 1) || (obj == 0);
11509 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
11510 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11511 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11512 CVec_u8Z_free(arg_var);
11516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11517 LDKu8slice ser_ref;
11518 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11519 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11520 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
11521 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11522 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11523 long ret_ref = (long)ret_var.inner;
11524 if (ret_var.is_owned) {
11527 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11531 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
11533 obj_conv.inner = (void*)(obj & (~1));
11534 obj_conv.is_owned = (obj & 1) || (obj == 0);
11535 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
11536 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11537 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11538 CVec_u8Z_free(arg_var);
11542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11543 LDKu8slice ser_ref;
11544 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11545 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11546 LDKPing ret_var = Ping_read(ser_ref);
11547 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11548 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11549 long ret_ref = (long)ret_var.inner;
11550 if (ret_var.is_owned) {
11553 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11557 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
11559 obj_conv.inner = (void*)(obj & (~1));
11560 obj_conv.is_owned = (obj & 1) || (obj == 0);
11561 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
11562 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11563 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11564 CVec_u8Z_free(arg_var);
11568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11569 LDKu8slice ser_ref;
11570 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11571 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11572 LDKPong ret_var = Pong_read(ser_ref);
11573 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11574 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11575 long ret_ref = (long)ret_var.inner;
11576 if (ret_var.is_owned) {
11579 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11583 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11584 LDKUnsignedChannelAnnouncement obj_conv;
11585 obj_conv.inner = (void*)(obj & (~1));
11586 obj_conv.is_owned = (obj & 1) || (obj == 0);
11587 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
11588 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11589 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11590 CVec_u8Z_free(arg_var);
11594 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11595 LDKu8slice ser_ref;
11596 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11597 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11598 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_read(ser_ref);
11599 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11600 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11601 long ret_ref = (long)ret_var.inner;
11602 if (ret_var.is_owned) {
11605 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11609 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11610 LDKChannelAnnouncement obj_conv;
11611 obj_conv.inner = (void*)(obj & (~1));
11612 obj_conv.is_owned = (obj & 1) || (obj == 0);
11613 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
11614 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11615 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11616 CVec_u8Z_free(arg_var);
11620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11621 LDKu8slice ser_ref;
11622 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11623 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11624 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
11625 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11626 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11627 long ret_ref = (long)ret_var.inner;
11628 if (ret_var.is_owned) {
11631 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11635 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
11636 LDKUnsignedChannelUpdate obj_conv;
11637 obj_conv.inner = (void*)(obj & (~1));
11638 obj_conv.is_owned = (obj & 1) || (obj == 0);
11639 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
11640 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11641 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11642 CVec_u8Z_free(arg_var);
11646 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11647 LDKu8slice ser_ref;
11648 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11649 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11650 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_read(ser_ref);
11651 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11652 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11653 long ret_ref = (long)ret_var.inner;
11654 if (ret_var.is_owned) {
11657 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11661 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
11662 LDKChannelUpdate obj_conv;
11663 obj_conv.inner = (void*)(obj & (~1));
11664 obj_conv.is_owned = (obj & 1) || (obj == 0);
11665 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
11666 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11667 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11668 CVec_u8Z_free(arg_var);
11672 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11673 LDKu8slice ser_ref;
11674 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11675 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11676 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
11677 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11678 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11679 long ret_ref = (long)ret_var.inner;
11680 if (ret_var.is_owned) {
11683 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11687 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
11688 LDKErrorMessage obj_conv;
11689 obj_conv.inner = (void*)(obj & (~1));
11690 obj_conv.is_owned = (obj & 1) || (obj == 0);
11691 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
11692 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11693 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11694 CVec_u8Z_free(arg_var);
11698 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11699 LDKu8slice ser_ref;
11700 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11701 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11702 LDKErrorMessage ret_var = ErrorMessage_read(ser_ref);
11703 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11704 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11705 long ret_ref = (long)ret_var.inner;
11706 if (ret_var.is_owned) {
11709 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11713 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11714 LDKUnsignedNodeAnnouncement obj_conv;
11715 obj_conv.inner = (void*)(obj & (~1));
11716 obj_conv.is_owned = (obj & 1) || (obj == 0);
11717 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
11718 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11719 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11720 CVec_u8Z_free(arg_var);
11724 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11725 LDKu8slice ser_ref;
11726 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11727 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11728 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_read(ser_ref);
11729 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11730 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11731 long ret_ref = (long)ret_var.inner;
11732 if (ret_var.is_owned) {
11735 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11739 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11740 LDKNodeAnnouncement obj_conv;
11741 obj_conv.inner = (void*)(obj & (~1));
11742 obj_conv.is_owned = (obj & 1) || (obj == 0);
11743 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
11744 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11745 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11746 CVec_u8Z_free(arg_var);
11750 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11751 LDKu8slice ser_ref;
11752 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11753 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11754 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
11755 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11756 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11757 long ret_ref = (long)ret_var.inner;
11758 if (ret_var.is_owned) {
11761 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11765 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11766 LDKu8slice ser_ref;
11767 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11768 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11769 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_read(ser_ref);
11770 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11771 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11772 long ret_ref = (long)ret_var.inner;
11773 if (ret_var.is_owned) {
11776 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11780 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
11781 LDKQueryShortChannelIds obj_conv;
11782 obj_conv.inner = (void*)(obj & (~1));
11783 obj_conv.is_owned = (obj & 1) || (obj == 0);
11784 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
11785 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11786 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11787 CVec_u8Z_free(arg_var);
11791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11792 LDKu8slice ser_ref;
11793 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11794 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11795 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_read(ser_ref);
11796 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11797 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11798 long ret_ref = (long)ret_var.inner;
11799 if (ret_var.is_owned) {
11802 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11806 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
11807 LDKReplyShortChannelIdsEnd obj_conv;
11808 obj_conv.inner = (void*)(obj & (~1));
11809 obj_conv.is_owned = (obj & 1) || (obj == 0);
11810 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
11811 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11812 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11813 CVec_u8Z_free(arg_var);
11817 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11818 LDKu8slice ser_ref;
11819 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11820 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11821 LDKQueryChannelRange ret_var = QueryChannelRange_read(ser_ref);
11822 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11823 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11824 long ret_ref = (long)ret_var.inner;
11825 if (ret_var.is_owned) {
11828 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11832 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
11833 LDKQueryChannelRange obj_conv;
11834 obj_conv.inner = (void*)(obj & (~1));
11835 obj_conv.is_owned = (obj & 1) || (obj == 0);
11836 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
11837 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11838 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11839 CVec_u8Z_free(arg_var);
11843 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11844 LDKu8slice ser_ref;
11845 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11846 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11847 LDKReplyChannelRange ret_var = ReplyChannelRange_read(ser_ref);
11848 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11849 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11850 long ret_ref = (long)ret_var.inner;
11851 if (ret_var.is_owned) {
11854 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11858 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
11859 LDKReplyChannelRange obj_conv;
11860 obj_conv.inner = (void*)(obj & (~1));
11861 obj_conv.is_owned = (obj & 1) || (obj == 0);
11862 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
11863 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11864 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11865 CVec_u8Z_free(arg_var);
11869 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11870 LDKu8slice ser_ref;
11871 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11872 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11873 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_read(ser_ref);
11874 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11875 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11876 long ret_ref = (long)ret_var.inner;
11877 if (ret_var.is_owned) {
11880 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11884 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
11885 LDKGossipTimestampFilter obj_conv;
11886 obj_conv.inner = (void*)(obj & (~1));
11887 obj_conv.is_owned = (obj & 1) || (obj == 0);
11888 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
11889 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11890 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11891 CVec_u8Z_free(arg_var);
11895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11896 LDKMessageHandler this_ptr_conv;
11897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11898 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11899 MessageHandler_free(this_ptr_conv);
11902 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
11903 LDKMessageHandler this_ptr_conv;
11904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11905 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11906 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
11910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11911 LDKMessageHandler this_ptr_conv;
11912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11913 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11914 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
11915 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
11916 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11917 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
11919 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
11922 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
11923 LDKMessageHandler this_ptr_conv;
11924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11925 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11926 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
11930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11931 LDKMessageHandler this_ptr_conv;
11932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11933 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11934 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
11935 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
11936 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11937 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
11939 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
11942 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
11943 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
11944 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
11945 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11946 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
11948 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
11949 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
11950 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11951 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
11953 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
11954 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11955 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11956 long ret_ref = (long)ret_var.inner;
11957 if (ret_var.is_owned) {
11963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11964 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
11965 FREE((void*)this_ptr);
11966 SocketDescriptor_free(this_ptr_conv);
11969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11970 LDKPeerHandleError this_ptr_conv;
11971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11972 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11973 PeerHandleError_free(this_ptr_conv);
11976 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
11977 LDKPeerHandleError this_ptr_conv;
11978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11979 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11980 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
11984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11985 LDKPeerHandleError this_ptr_conv;
11986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11987 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11988 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
11991 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
11992 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
11993 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11994 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11995 long ret_ref = (long)ret_var.inner;
11996 if (ret_var.is_owned) {
12002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12003 LDKPeerManager 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 PeerManager_free(this_ptr_conv);
12009 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) {
12010 LDKMessageHandler message_handler_conv;
12011 message_handler_conv.inner = (void*)(message_handler & (~1));
12012 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
12013 // Warning: we may need a move here but can't clone!
12014 LDKSecretKey our_node_secret_ref;
12015 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
12016 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
12017 unsigned char ephemeral_random_data_arr[32];
12018 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
12019 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
12020 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
12021 LDKLogger logger_conv = *(LDKLogger*)logger;
12022 if (logger_conv.free == LDKLogger_JCalls_free) {
12023 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12024 LDKLogger_JCalls_clone(logger_conv.this_arg);
12026 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
12027 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12028 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12029 long ret_ref = (long)ret_var.inner;
12030 if (ret_var.is_owned) {
12036 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
12037 LDKPeerManager this_arg_conv;
12038 this_arg_conv.inner = (void*)(this_arg & (~1));
12039 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12040 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
12041 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, NULL, NULL);
12042 for (size_t i = 0; i < ret_var.datalen; i++) {
12043 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
12044 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
12045 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
12047 CVec_PublicKeyZ_free(ret_var);
12051 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) {
12052 LDKPeerManager this_arg_conv;
12053 this_arg_conv.inner = (void*)(this_arg & (~1));
12054 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12055 LDKPublicKey their_node_id_ref;
12056 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
12057 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12058 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12059 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12060 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12061 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12063 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
12064 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
12065 return (long)ret_conv;
12068 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12069 LDKPeerManager this_arg_conv;
12070 this_arg_conv.inner = (void*)(this_arg & (~1));
12071 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12072 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12073 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12074 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12075 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12077 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12078 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
12079 return (long)ret_conv;
12082 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12083 LDKPeerManager this_arg_conv;
12084 this_arg_conv.inner = (void*)(this_arg & (~1));
12085 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12086 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12087 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12088 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
12089 return (long)ret_conv;
12092 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
12093 LDKPeerManager this_arg_conv;
12094 this_arg_conv.inner = (void*)(this_arg & (~1));
12095 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12096 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
12097 LDKu8slice data_ref;
12098 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
12099 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
12100 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12101 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
12102 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
12103 return (long)ret_conv;
12106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
12107 LDKPeerManager this_arg_conv;
12108 this_arg_conv.inner = (void*)(this_arg & (~1));
12109 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12110 PeerManager_process_events(&this_arg_conv);
12113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12114 LDKPeerManager this_arg_conv;
12115 this_arg_conv.inner = (void*)(this_arg & (~1));
12116 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12117 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12118 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
12121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
12122 LDKPeerManager this_arg_conv;
12123 this_arg_conv.inner = (void*)(this_arg & (~1));
12124 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12125 PeerManager_timer_tick_occured(&this_arg_conv);
12128 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
12129 unsigned char commitment_seed_arr[32];
12130 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
12131 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
12132 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
12133 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
12134 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
12138 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
12139 LDKPublicKey per_commitment_point_ref;
12140 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12141 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12142 unsigned char base_secret_arr[32];
12143 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
12144 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
12145 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
12146 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12147 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
12148 return (long)ret_conv;
12151 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
12152 LDKPublicKey per_commitment_point_ref;
12153 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12154 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12155 LDKPublicKey base_point_ref;
12156 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
12157 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
12158 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12159 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
12160 return (long)ret_conv;
12163 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) {
12164 unsigned char per_commitment_secret_arr[32];
12165 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
12166 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
12167 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
12168 unsigned char countersignatory_revocation_base_secret_arr[32];
12169 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
12170 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
12171 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
12172 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12173 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
12174 return (long)ret_conv;
12177 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) {
12178 LDKPublicKey per_commitment_point_ref;
12179 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12180 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12181 LDKPublicKey countersignatory_revocation_base_point_ref;
12182 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
12183 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
12184 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12185 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
12186 return (long)ret_conv;
12189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12190 LDKTxCreationKeys this_ptr_conv;
12191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12192 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12193 TxCreationKeys_free(this_ptr_conv);
12196 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12197 LDKTxCreationKeys orig_conv;
12198 orig_conv.inner = (void*)(orig & (~1));
12199 orig_conv.is_owned = (orig & 1) || (orig == 0);
12200 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
12201 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12202 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12203 long ret_ref = (long)ret_var.inner;
12204 if (ret_var.is_owned) {
12210 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12211 LDKTxCreationKeys this_ptr_conv;
12212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12213 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12214 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12215 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
12219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12220 LDKTxCreationKeys this_ptr_conv;
12221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12222 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12223 LDKPublicKey val_ref;
12224 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12225 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12226 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
12229 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12230 LDKTxCreationKeys this_ptr_conv;
12231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12232 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12233 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12234 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
12238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12239 LDKTxCreationKeys this_ptr_conv;
12240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12241 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12242 LDKPublicKey val_ref;
12243 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12244 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12245 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
12248 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12249 LDKTxCreationKeys this_ptr_conv;
12250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12251 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12252 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12253 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
12257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12258 LDKTxCreationKeys this_ptr_conv;
12259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12261 LDKPublicKey val_ref;
12262 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12263 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12264 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
12267 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12268 LDKTxCreationKeys this_ptr_conv;
12269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12270 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12271 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12272 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
12276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12277 LDKTxCreationKeys this_ptr_conv;
12278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12279 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12280 LDKPublicKey val_ref;
12281 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12282 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12283 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
12286 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12287 LDKTxCreationKeys this_ptr_conv;
12288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12289 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12290 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12291 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
12295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12296 LDKTxCreationKeys this_ptr_conv;
12297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12298 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12299 LDKPublicKey val_ref;
12300 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12301 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12302 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
12305 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) {
12306 LDKPublicKey per_commitment_point_arg_ref;
12307 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
12308 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
12309 LDKPublicKey revocation_key_arg_ref;
12310 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
12311 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
12312 LDKPublicKey broadcaster_htlc_key_arg_ref;
12313 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
12314 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
12315 LDKPublicKey countersignatory_htlc_key_arg_ref;
12316 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
12317 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
12318 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
12319 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
12320 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
12321 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);
12322 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12323 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12324 long ret_ref = (long)ret_var.inner;
12325 if (ret_var.is_owned) {
12331 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12332 LDKTxCreationKeys obj_conv;
12333 obj_conv.inner = (void*)(obj & (~1));
12334 obj_conv.is_owned = (obj & 1) || (obj == 0);
12335 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
12336 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12337 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12338 CVec_u8Z_free(arg_var);
12342 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12343 LDKu8slice ser_ref;
12344 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12345 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12346 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
12347 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12348 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12349 long ret_ref = (long)ret_var.inner;
12350 if (ret_var.is_owned) {
12353 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12358 LDKPreCalculatedTxCreationKeys this_ptr_conv;
12359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12360 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12361 PreCalculatedTxCreationKeys_free(this_ptr_conv);
12364 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
12365 LDKTxCreationKeys keys_conv;
12366 keys_conv.inner = (void*)(keys & (~1));
12367 keys_conv.is_owned = (keys & 1) || (keys == 0);
12368 if (keys_conv.inner != NULL)
12369 keys_conv = TxCreationKeys_clone(&keys_conv);
12370 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_new(keys_conv);
12371 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12372 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12373 long ret_ref = (long)ret_var.inner;
12374 if (ret_var.is_owned) {
12380 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
12381 LDKPreCalculatedTxCreationKeys this_arg_conv;
12382 this_arg_conv.inner = (void*)(this_arg & (~1));
12383 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12384 LDKTxCreationKeys ret_var = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
12385 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12386 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12387 long ret_ref = (long)ret_var.inner;
12388 if (ret_var.is_owned) {
12394 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
12395 LDKPreCalculatedTxCreationKeys this_arg_conv;
12396 this_arg_conv.inner = (void*)(this_arg & (~1));
12397 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12398 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12399 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
12403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12404 LDKChannelPublicKeys this_ptr_conv;
12405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12406 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12407 ChannelPublicKeys_free(this_ptr_conv);
12410 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12411 LDKChannelPublicKeys orig_conv;
12412 orig_conv.inner = (void*)(orig & (~1));
12413 orig_conv.is_owned = (orig & 1) || (orig == 0);
12414 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
12415 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12416 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12417 long ret_ref = (long)ret_var.inner;
12418 if (ret_var.is_owned) {
12424 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
12425 LDKChannelPublicKeys this_ptr_conv;
12426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12427 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12428 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12429 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
12433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12434 LDKChannelPublicKeys this_ptr_conv;
12435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12436 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12437 LDKPublicKey val_ref;
12438 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12439 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12440 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
12443 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12444 LDKChannelPublicKeys this_ptr_conv;
12445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12446 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12447 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12448 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
12452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12453 LDKChannelPublicKeys this_ptr_conv;
12454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12455 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12456 LDKPublicKey val_ref;
12457 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12458 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12459 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
12462 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12463 LDKChannelPublicKeys this_ptr_conv;
12464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12465 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12466 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12467 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
12471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12472 LDKChannelPublicKeys this_ptr_conv;
12473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12474 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12475 LDKPublicKey val_ref;
12476 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12477 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12478 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
12481 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12482 LDKChannelPublicKeys this_ptr_conv;
12483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12484 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12485 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12486 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
12490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12491 LDKChannelPublicKeys this_ptr_conv;
12492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12493 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12494 LDKPublicKey val_ref;
12495 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12496 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12497 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12500 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12501 LDKChannelPublicKeys this_ptr_conv;
12502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12503 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12504 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12505 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
12509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12510 LDKChannelPublicKeys this_ptr_conv;
12511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12512 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12513 LDKPublicKey val_ref;
12514 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12515 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12516 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
12519 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) {
12520 LDKPublicKey funding_pubkey_arg_ref;
12521 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
12522 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
12523 LDKPublicKey revocation_basepoint_arg_ref;
12524 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
12525 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
12526 LDKPublicKey payment_point_arg_ref;
12527 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
12528 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
12529 LDKPublicKey delayed_payment_basepoint_arg_ref;
12530 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
12531 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
12532 LDKPublicKey htlc_basepoint_arg_ref;
12533 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
12534 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
12535 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);
12536 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12537 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12538 long ret_ref = (long)ret_var.inner;
12539 if (ret_var.is_owned) {
12545 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12546 LDKChannelPublicKeys obj_conv;
12547 obj_conv.inner = (void*)(obj & (~1));
12548 obj_conv.is_owned = (obj & 1) || (obj == 0);
12549 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
12550 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12551 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12552 CVec_u8Z_free(arg_var);
12556 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12557 LDKu8slice ser_ref;
12558 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12559 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12560 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
12561 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12562 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12563 long ret_ref = (long)ret_var.inner;
12564 if (ret_var.is_owned) {
12567 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12571 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) {
12572 LDKPublicKey per_commitment_point_ref;
12573 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12574 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12575 LDKPublicKey broadcaster_delayed_payment_base_ref;
12576 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
12577 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
12578 LDKPublicKey broadcaster_htlc_base_ref;
12579 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
12580 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
12581 LDKPublicKey countersignatory_revocation_base_ref;
12582 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
12583 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
12584 LDKPublicKey countersignatory_htlc_base_ref;
12585 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
12586 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
12587 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
12588 *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);
12589 return (long)ret_conv;
12592 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) {
12593 LDKPublicKey revocation_key_ref;
12594 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
12595 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
12596 LDKPublicKey broadcaster_delayed_payment_key_ref;
12597 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
12598 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
12599 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
12600 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12601 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12602 CVec_u8Z_free(arg_var);
12606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12607 LDKHTLCOutputInCommitment this_ptr_conv;
12608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12609 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12610 HTLCOutputInCommitment_free(this_ptr_conv);
12613 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12614 LDKHTLCOutputInCommitment orig_conv;
12615 orig_conv.inner = (void*)(orig & (~1));
12616 orig_conv.is_owned = (orig & 1) || (orig == 0);
12617 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
12618 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12619 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12620 long ret_ref = (long)ret_var.inner;
12621 if (ret_var.is_owned) {
12627 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
12628 LDKHTLCOutputInCommitment this_ptr_conv;
12629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12630 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12631 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
12635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12636 LDKHTLCOutputInCommitment this_ptr_conv;
12637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12639 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
12642 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12643 LDKHTLCOutputInCommitment this_ptr_conv;
12644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12645 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12646 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
12650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12651 LDKHTLCOutputInCommitment this_ptr_conv;
12652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12653 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12654 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
12657 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
12658 LDKHTLCOutputInCommitment this_ptr_conv;
12659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12660 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12661 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
12665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12666 LDKHTLCOutputInCommitment this_ptr_conv;
12667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12668 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12669 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
12672 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
12673 LDKHTLCOutputInCommitment this_ptr_conv;
12674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12675 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12676 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12677 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
12681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12682 LDKHTLCOutputInCommitment this_ptr_conv;
12683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12684 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12685 LDKThirtyTwoBytes val_ref;
12686 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12687 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12688 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
12691 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
12692 LDKHTLCOutputInCommitment obj_conv;
12693 obj_conv.inner = (void*)(obj & (~1));
12694 obj_conv.is_owned = (obj & 1) || (obj == 0);
12695 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
12696 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12697 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12698 CVec_u8Z_free(arg_var);
12702 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12703 LDKu8slice ser_ref;
12704 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12705 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12706 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
12707 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12708 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12709 long ret_ref = (long)ret_var.inner;
12710 if (ret_var.is_owned) {
12713 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12717 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
12718 LDKHTLCOutputInCommitment htlc_conv;
12719 htlc_conv.inner = (void*)(htlc & (~1));
12720 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
12721 LDKTxCreationKeys keys_conv;
12722 keys_conv.inner = (void*)(keys & (~1));
12723 keys_conv.is_owned = (keys & 1) || (keys == 0);
12724 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
12725 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12726 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12727 CVec_u8Z_free(arg_var);
12731 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
12732 LDKPublicKey broadcaster_ref;
12733 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
12734 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
12735 LDKPublicKey countersignatory_ref;
12736 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
12737 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
12738 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
12739 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12740 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12741 CVec_u8Z_free(arg_var);
12745 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) {
12746 unsigned char prev_hash_arr[32];
12747 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
12748 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
12749 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
12750 LDKHTLCOutputInCommitment htlc_conv;
12751 htlc_conv.inner = (void*)(htlc & (~1));
12752 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
12753 LDKPublicKey broadcaster_delayed_payment_key_ref;
12754 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
12755 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
12756 LDKPublicKey revocation_key_ref;
12757 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
12758 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
12759 LDKTransaction *ret_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
12760 *ret_copy = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
12761 long ret_ref = (long)ret_copy;
12765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12766 LDKHolderCommitmentTransaction this_ptr_conv;
12767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12768 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12769 HolderCommitmentTransaction_free(this_ptr_conv);
12772 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12773 LDKHolderCommitmentTransaction orig_conv;
12774 orig_conv.inner = (void*)(orig & (~1));
12775 orig_conv.is_owned = (orig & 1) || (orig == 0);
12776 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
12777 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12778 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12779 long ret_ref = (long)ret_var.inner;
12780 if (ret_var.is_owned) {
12786 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
12787 LDKHolderCommitmentTransaction this_ptr_conv;
12788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12789 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12790 LDKTransaction *ret_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
12791 *ret_copy = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
12792 long ret_ref = (long)ret_copy;
12796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12797 LDKHolderCommitmentTransaction this_ptr_conv;
12798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12799 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12800 LDKTransaction val_conv = *(LDKTransaction*)val;
12801 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
12804 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
12805 LDKHolderCommitmentTransaction this_ptr_conv;
12806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12808 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
12809 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
12813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12814 LDKHolderCommitmentTransaction this_ptr_conv;
12815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12816 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12817 LDKSignature val_ref;
12818 CHECK((*_env)->GetArrayLength (_env, val) == 64);
12819 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
12820 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
12823 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
12824 LDKHolderCommitmentTransaction this_ptr_conv;
12825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12826 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12827 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
12831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12832 LDKHolderCommitmentTransaction this_ptr_conv;
12833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12834 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12835 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
12838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
12839 LDKHolderCommitmentTransaction this_ptr_conv;
12840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12841 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12842 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_constr;
12843 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12844 if (val_constr.datalen > 0)
12845 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
12847 val_constr.data = NULL;
12848 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
12849 for (size_t q = 0; q < val_constr.datalen; q++) {
12850 long arr_conv_42 = val_vals[q];
12851 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
12852 FREE((void*)arr_conv_42);
12853 val_constr.data[q] = arr_conv_42_conv;
12855 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
12856 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_constr);
12859 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) {
12860 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
12861 LDKSignature counterparty_sig_ref;
12862 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
12863 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
12864 LDKPublicKey holder_funding_key_ref;
12865 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
12866 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
12867 LDKPublicKey counterparty_funding_key_ref;
12868 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
12869 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
12870 LDKTxCreationKeys keys_conv;
12871 keys_conv.inner = (void*)(keys & (~1));
12872 keys_conv.is_owned = (keys & 1) || (keys == 0);
12873 if (keys_conv.inner != NULL)
12874 keys_conv = TxCreationKeys_clone(&keys_conv);
12875 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_constr;
12876 htlc_data_constr.datalen = (*_env)->GetArrayLength (_env, htlc_data);
12877 if (htlc_data_constr.datalen > 0)
12878 htlc_data_constr.data = MALLOC(htlc_data_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
12880 htlc_data_constr.data = NULL;
12881 long* htlc_data_vals = (*_env)->GetLongArrayElements (_env, htlc_data, NULL);
12882 for (size_t q = 0; q < htlc_data_constr.datalen; q++) {
12883 long arr_conv_42 = htlc_data_vals[q];
12884 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
12885 FREE((void*)arr_conv_42);
12886 htlc_data_constr.data[q] = arr_conv_42_conv;
12888 (*_env)->ReleaseLongArrayElements (_env, htlc_data, htlc_data_vals, 0);
12889 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);
12890 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12891 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12892 long ret_ref = (long)ret_var.inner;
12893 if (ret_var.is_owned) {
12899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
12900 LDKHolderCommitmentTransaction this_arg_conv;
12901 this_arg_conv.inner = (void*)(this_arg & (~1));
12902 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12903 LDKTxCreationKeys ret_var = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
12904 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12905 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12906 long ret_ref = (long)ret_var.inner;
12907 if (ret_var.is_owned) {
12913 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
12914 LDKHolderCommitmentTransaction this_arg_conv;
12915 this_arg_conv.inner = (void*)(this_arg & (~1));
12916 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12917 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
12918 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
12922 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) {
12923 LDKHolderCommitmentTransaction this_arg_conv;
12924 this_arg_conv.inner = (void*)(this_arg & (~1));
12925 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12926 unsigned char funding_key_arr[32];
12927 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
12928 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
12929 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
12930 LDKu8slice funding_redeemscript_ref;
12931 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
12932 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
12933 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
12934 (*_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);
12935 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
12939 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) {
12940 LDKHolderCommitmentTransaction this_arg_conv;
12941 this_arg_conv.inner = (void*)(this_arg & (~1));
12942 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12943 unsigned char htlc_base_key_arr[32];
12944 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
12945 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
12946 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
12947 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12948 *ret_conv = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
12949 return (long)ret_conv;
12952 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
12953 LDKHolderCommitmentTransaction obj_conv;
12954 obj_conv.inner = (void*)(obj & (~1));
12955 obj_conv.is_owned = (obj & 1) || (obj == 0);
12956 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
12957 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12958 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12959 CVec_u8Z_free(arg_var);
12963 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12964 LDKu8slice ser_ref;
12965 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12966 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12967 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
12968 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12969 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12970 long ret_ref = (long)ret_var.inner;
12971 if (ret_var.is_owned) {
12974 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12979 LDKInitFeatures this_ptr_conv;
12980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12981 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12982 InitFeatures_free(this_ptr_conv);
12985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12986 LDKNodeFeatures this_ptr_conv;
12987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12988 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12989 NodeFeatures_free(this_ptr_conv);
12992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12993 LDKChannelFeatures this_ptr_conv;
12994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12995 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12996 ChannelFeatures_free(this_ptr_conv);
12999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13000 LDKRouteHop this_ptr_conv;
13001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13002 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13003 RouteHop_free(this_ptr_conv);
13006 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13007 LDKRouteHop orig_conv;
13008 orig_conv.inner = (void*)(orig & (~1));
13009 orig_conv.is_owned = (orig & 1) || (orig == 0);
13010 LDKRouteHop ret_var = RouteHop_clone(&orig_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_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
13021 LDKRouteHop this_ptr_conv;
13022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13023 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13024 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13025 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
13029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13030 LDKRouteHop this_ptr_conv;
13031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13032 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13033 LDKPublicKey val_ref;
13034 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13035 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13036 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
13039 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13040 LDKRouteHop this_ptr_conv;
13041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13042 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13043 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
13044 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13045 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13046 long ret_ref = (long)ret_var.inner;
13047 if (ret_var.is_owned) {
13053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13054 LDKRouteHop this_ptr_conv;
13055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13056 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13057 LDKNodeFeatures val_conv;
13058 val_conv.inner = (void*)(val & (~1));
13059 val_conv.is_owned = (val & 1) || (val == 0);
13060 // Warning: we may need a move here but can't clone!
13061 RouteHop_set_node_features(&this_ptr_conv, val_conv);
13064 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13065 LDKRouteHop this_ptr_conv;
13066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13067 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13068 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
13072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13073 LDKRouteHop this_ptr_conv;
13074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13075 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13076 RouteHop_set_short_channel_id(&this_ptr_conv, val);
13079 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13080 LDKRouteHop this_ptr_conv;
13081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13082 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13083 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
13084 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13085 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13086 long ret_ref = (long)ret_var.inner;
13087 if (ret_var.is_owned) {
13093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13094 LDKRouteHop this_ptr_conv;
13095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13096 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13097 LDKChannelFeatures val_conv;
13098 val_conv.inner = (void*)(val & (~1));
13099 val_conv.is_owned = (val & 1) || (val == 0);
13100 // Warning: we may need a move here but can't clone!
13101 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
13104 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13105 LDKRouteHop this_ptr_conv;
13106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13107 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13108 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
13112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13113 LDKRouteHop this_ptr_conv;
13114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13115 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13116 RouteHop_set_fee_msat(&this_ptr_conv, val);
13119 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13120 LDKRouteHop this_ptr_conv;
13121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13122 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13123 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
13127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
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 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
13134 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) {
13135 LDKPublicKey pubkey_arg_ref;
13136 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
13137 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
13138 LDKNodeFeatures node_features_arg_conv;
13139 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
13140 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
13141 // Warning: we may need a move here but can't clone!
13142 LDKChannelFeatures channel_features_arg_conv;
13143 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
13144 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
13145 // Warning: we may need a move here but can't clone!
13146 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);
13147 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13148 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13149 long ret_ref = (long)ret_var.inner;
13150 if (ret_var.is_owned) {
13156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13157 LDKRoute this_ptr_conv;
13158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13159 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13160 Route_free(this_ptr_conv);
13163 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13164 LDKRoute orig_conv;
13165 orig_conv.inner = (void*)(orig & (~1));
13166 orig_conv.is_owned = (orig & 1) || (orig == 0);
13167 LDKRoute ret_var = Route_clone(&orig_conv);
13168 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13169 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13170 long ret_ref = (long)ret_var.inner;
13171 if (ret_var.is_owned) {
13177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
13178 LDKRoute this_ptr_conv;
13179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13180 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13181 LDKCVec_CVec_RouteHopZZ val_constr;
13182 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13183 if (val_constr.datalen > 0)
13184 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13186 val_constr.data = NULL;
13187 for (size_t m = 0; m < val_constr.datalen; m++) {
13188 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
13189 LDKCVec_RouteHopZ arr_conv_12_constr;
13190 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13191 if (arr_conv_12_constr.datalen > 0)
13192 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13194 arr_conv_12_constr.data = NULL;
13195 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13196 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13197 long arr_conv_10 = arr_conv_12_vals[k];
13198 LDKRouteHop arr_conv_10_conv;
13199 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13200 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13201 if (arr_conv_10_conv.inner != NULL)
13202 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13203 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13205 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13206 val_constr.data[m] = arr_conv_12_constr;
13208 Route_set_paths(&this_ptr_conv, val_constr);
13211 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
13212 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
13213 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
13214 if (paths_arg_constr.datalen > 0)
13215 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13217 paths_arg_constr.data = NULL;
13218 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
13219 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
13220 LDKCVec_RouteHopZ arr_conv_12_constr;
13221 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13222 if (arr_conv_12_constr.datalen > 0)
13223 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13225 arr_conv_12_constr.data = NULL;
13226 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13227 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13228 long arr_conv_10 = arr_conv_12_vals[k];
13229 LDKRouteHop arr_conv_10_conv;
13230 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13231 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13232 if (arr_conv_10_conv.inner != NULL)
13233 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13234 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13236 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13237 paths_arg_constr.data[m] = arr_conv_12_constr;
13239 LDKRoute ret_var = Route_new(paths_arg_constr);
13240 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13241 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13242 long ret_ref = (long)ret_var.inner;
13243 if (ret_var.is_owned) {
13249 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
13251 obj_conv.inner = (void*)(obj & (~1));
13252 obj_conv.is_owned = (obj & 1) || (obj == 0);
13253 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
13254 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13255 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13256 CVec_u8Z_free(arg_var);
13260 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13261 LDKu8slice ser_ref;
13262 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13263 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13264 LDKRoute ret_var = Route_read(ser_ref);
13265 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13266 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13267 long ret_ref = (long)ret_var.inner;
13268 if (ret_var.is_owned) {
13271 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13276 LDKRouteHint this_ptr_conv;
13277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13278 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13279 RouteHint_free(this_ptr_conv);
13282 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13283 LDKRouteHint orig_conv;
13284 orig_conv.inner = (void*)(orig & (~1));
13285 orig_conv.is_owned = (orig & 1) || (orig == 0);
13286 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
13287 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13288 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13289 long ret_ref = (long)ret_var.inner;
13290 if (ret_var.is_owned) {
13296 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13297 LDKRouteHint this_ptr_conv;
13298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13299 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13300 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13301 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
13305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13306 LDKRouteHint this_ptr_conv;
13307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13308 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13309 LDKPublicKey val_ref;
13310 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13311 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13312 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
13315 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13316 LDKRouteHint this_ptr_conv;
13317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13319 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
13323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13324 LDKRouteHint this_ptr_conv;
13325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13326 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13327 RouteHint_set_short_channel_id(&this_ptr_conv, val);
13330 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
13331 LDKRouteHint this_ptr_conv;
13332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13333 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13334 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
13335 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13336 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13337 long ret_ref = (long)ret_var.inner;
13338 if (ret_var.is_owned) {
13344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13345 LDKRouteHint this_ptr_conv;
13346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13348 LDKRoutingFees val_conv;
13349 val_conv.inner = (void*)(val & (~1));
13350 val_conv.is_owned = (val & 1) || (val == 0);
13351 if (val_conv.inner != NULL)
13352 val_conv = RoutingFees_clone(&val_conv);
13353 RouteHint_set_fees(&this_ptr_conv, val_conv);
13356 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13357 LDKRouteHint this_ptr_conv;
13358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13359 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13360 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
13364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13365 LDKRouteHint this_ptr_conv;
13366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13367 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13368 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
13371 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13372 LDKRouteHint this_ptr_conv;
13373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13374 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13375 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
13379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13380 LDKRouteHint this_ptr_conv;
13381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13382 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13383 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
13386 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) {
13387 LDKPublicKey src_node_id_arg_ref;
13388 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
13389 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
13390 LDKRoutingFees fees_arg_conv;
13391 fees_arg_conv.inner = (void*)(fees_arg & (~1));
13392 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
13393 if (fees_arg_conv.inner != NULL)
13394 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
13395 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);
13396 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13397 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13398 long ret_ref = (long)ret_var.inner;
13399 if (ret_var.is_owned) {
13405 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) {
13406 LDKPublicKey our_node_id_ref;
13407 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
13408 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
13409 LDKNetworkGraph network_conv;
13410 network_conv.inner = (void*)(network & (~1));
13411 network_conv.is_owned = (network & 1) || (network == 0);
13412 LDKPublicKey target_ref;
13413 CHECK((*_env)->GetArrayLength (_env, target) == 33);
13414 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
13415 LDKCVec_ChannelDetailsZ first_hops_constr;
13416 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
13417 if (first_hops_constr.datalen > 0)
13418 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13420 first_hops_constr.data = NULL;
13421 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
13422 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13423 long arr_conv_16 = first_hops_vals[q];
13424 LDKChannelDetails arr_conv_16_conv;
13425 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13426 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13427 first_hops_constr.data[q] = arr_conv_16_conv;
13429 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
13430 LDKCVec_RouteHintZ last_hops_constr;
13431 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
13432 if (last_hops_constr.datalen > 0)
13433 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13435 last_hops_constr.data = NULL;
13436 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
13437 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
13438 long arr_conv_11 = last_hops_vals[l];
13439 LDKRouteHint arr_conv_11_conv;
13440 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
13441 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
13442 if (arr_conv_11_conv.inner != NULL)
13443 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
13444 last_hops_constr.data[l] = arr_conv_11_conv;
13446 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
13447 LDKLogger logger_conv = *(LDKLogger*)logger;
13448 if (logger_conv.free == LDKLogger_JCalls_free) {
13449 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13450 LDKLogger_JCalls_clone(logger_conv.this_arg);
13452 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13453 *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);
13454 FREE(first_hops_constr.data);
13455 return (long)ret_conv;
13458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13459 LDKNetworkGraph this_ptr_conv;
13460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13462 NetworkGraph_free(this_ptr_conv);
13465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13466 LDKLockedNetworkGraph this_ptr_conv;
13467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13468 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13469 LockedNetworkGraph_free(this_ptr_conv);
13472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13473 LDKNetGraphMsgHandler this_ptr_conv;
13474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13475 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13476 NetGraphMsgHandler_free(this_ptr_conv);
13479 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
13480 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13481 LDKLogger logger_conv = *(LDKLogger*)logger;
13482 if (logger_conv.free == LDKLogger_JCalls_free) {
13483 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13484 LDKLogger_JCalls_clone(logger_conv.this_arg);
13486 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
13487 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13488 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13489 long ret_ref = (long)ret_var.inner;
13490 if (ret_var.is_owned) {
13496 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
13497 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13498 LDKLogger logger_conv = *(LDKLogger*)logger;
13499 if (logger_conv.free == LDKLogger_JCalls_free) {
13500 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13501 LDKLogger_JCalls_clone(logger_conv.this_arg);
13503 LDKNetworkGraph network_graph_conv;
13504 network_graph_conv.inner = (void*)(network_graph & (~1));
13505 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
13506 // Warning: we may need a move here but can't clone!
13507 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
13508 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13509 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13510 long ret_ref = (long)ret_var.inner;
13511 if (ret_var.is_owned) {
13517 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13518 LDKNetGraphMsgHandler this_arg_conv;
13519 this_arg_conv.inner = (void*)(this_arg & (~1));
13520 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13521 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
13522 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13523 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13524 long ret_ref = (long)ret_var.inner;
13525 if (ret_var.is_owned) {
13531 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13532 LDKLockedNetworkGraph this_arg_conv;
13533 this_arg_conv.inner = (void*)(this_arg & (~1));
13534 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13535 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
13536 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13537 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13538 long ret_ref = (long)ret_var.inner;
13539 if (ret_var.is_owned) {
13545 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
13546 LDKNetGraphMsgHandler this_arg_conv;
13547 this_arg_conv.inner = (void*)(this_arg & (~1));
13548 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13549 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13550 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
13554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13555 LDKDirectionalChannelInfo this_ptr_conv;
13556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13557 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13558 DirectionalChannelInfo_free(this_ptr_conv);
13561 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
13562 LDKDirectionalChannelInfo this_ptr_conv;
13563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13564 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13565 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
13569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13570 LDKDirectionalChannelInfo this_ptr_conv;
13571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13572 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13573 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
13576 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
13577 LDKDirectionalChannelInfo this_ptr_conv;
13578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13579 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13580 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
13584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
13585 LDKDirectionalChannelInfo this_ptr_conv;
13586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13587 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13588 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
13591 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13592 LDKDirectionalChannelInfo this_ptr_conv;
13593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13595 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
13599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13600 LDKDirectionalChannelInfo this_ptr_conv;
13601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13603 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
13606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13607 LDKDirectionalChannelInfo this_ptr_conv;
13608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13609 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13610 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
13614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13615 LDKDirectionalChannelInfo this_ptr_conv;
13616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13617 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13618 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
13621 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
13622 LDKDirectionalChannelInfo this_ptr_conv;
13623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13624 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13625 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
13626 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13627 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13628 long ret_ref = (long)ret_var.inner;
13629 if (ret_var.is_owned) {
13635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13636 LDKDirectionalChannelInfo this_ptr_conv;
13637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13639 LDKChannelUpdate val_conv;
13640 val_conv.inner = (void*)(val & (~1));
13641 val_conv.is_owned = (val & 1) || (val == 0);
13642 if (val_conv.inner != NULL)
13643 val_conv = ChannelUpdate_clone(&val_conv);
13644 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
13647 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13648 LDKDirectionalChannelInfo obj_conv;
13649 obj_conv.inner = (void*)(obj & (~1));
13650 obj_conv.is_owned = (obj & 1) || (obj == 0);
13651 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
13652 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13653 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13654 CVec_u8Z_free(arg_var);
13658 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13659 LDKu8slice ser_ref;
13660 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13661 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13662 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
13663 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13664 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13665 long ret_ref = (long)ret_var.inner;
13666 if (ret_var.is_owned) {
13669 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13674 LDKChannelInfo this_ptr_conv;
13675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13676 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13677 ChannelInfo_free(this_ptr_conv);
13680 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13681 LDKChannelInfo this_ptr_conv;
13682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13683 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13684 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
13685 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13686 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13687 long ret_ref = (long)ret_var.inner;
13688 if (ret_var.is_owned) {
13694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13695 LDKChannelInfo this_ptr_conv;
13696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13697 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13698 LDKChannelFeatures val_conv;
13699 val_conv.inner = (void*)(val & (~1));
13700 val_conv.is_owned = (val & 1) || (val == 0);
13701 // Warning: we may need a move here but can't clone!
13702 ChannelInfo_set_features(&this_ptr_conv, val_conv);
13705 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
13706 LDKChannelInfo this_ptr_conv;
13707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13709 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13710 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
13714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13715 LDKChannelInfo this_ptr_conv;
13716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13717 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13718 LDKPublicKey val_ref;
13719 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13720 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13721 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
13724 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
13725 LDKChannelInfo this_ptr_conv;
13726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13728 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
13729 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13730 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13731 long ret_ref = (long)ret_var.inner;
13732 if (ret_var.is_owned) {
13738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13739 LDKChannelInfo this_ptr_conv;
13740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13741 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13742 LDKDirectionalChannelInfo val_conv;
13743 val_conv.inner = (void*)(val & (~1));
13744 val_conv.is_owned = (val & 1) || (val == 0);
13745 // Warning: we may need a move here but can't clone!
13746 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
13749 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
13750 LDKChannelInfo this_ptr_conv;
13751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13752 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13753 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13754 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
13758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13759 LDKChannelInfo this_ptr_conv;
13760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13761 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13762 LDKPublicKey val_ref;
13763 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13764 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13765 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
13768 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
13769 LDKChannelInfo this_ptr_conv;
13770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13771 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13772 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
13773 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13774 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13775 long ret_ref = (long)ret_var.inner;
13776 if (ret_var.is_owned) {
13782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13783 LDKChannelInfo this_ptr_conv;
13784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13785 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13786 LDKDirectionalChannelInfo val_conv;
13787 val_conv.inner = (void*)(val & (~1));
13788 val_conv.is_owned = (val & 1) || (val == 0);
13789 // Warning: we may need a move here but can't clone!
13790 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
13793 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
13794 LDKChannelInfo this_ptr_conv;
13795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13796 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13797 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
13798 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13799 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13800 long ret_ref = (long)ret_var.inner;
13801 if (ret_var.is_owned) {
13807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13808 LDKChannelInfo this_ptr_conv;
13809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13810 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13811 LDKChannelAnnouncement val_conv;
13812 val_conv.inner = (void*)(val & (~1));
13813 val_conv.is_owned = (val & 1) || (val == 0);
13814 if (val_conv.inner != NULL)
13815 val_conv = ChannelAnnouncement_clone(&val_conv);
13816 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
13819 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13820 LDKChannelInfo obj_conv;
13821 obj_conv.inner = (void*)(obj & (~1));
13822 obj_conv.is_owned = (obj & 1) || (obj == 0);
13823 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
13824 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13825 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13826 CVec_u8Z_free(arg_var);
13830 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13831 LDKu8slice ser_ref;
13832 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13833 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13834 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
13835 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13836 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13837 long ret_ref = (long)ret_var.inner;
13838 if (ret_var.is_owned) {
13841 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13846 LDKRoutingFees 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 RoutingFees_free(this_ptr_conv);
13852 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13853 LDKRoutingFees orig_conv;
13854 orig_conv.inner = (void*)(orig & (~1));
13855 orig_conv.is_owned = (orig & 1) || (orig == 0);
13856 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
13857 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13858 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13859 long ret_ref = (long)ret_var.inner;
13860 if (ret_var.is_owned) {
13866 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13867 LDKRoutingFees this_ptr_conv;
13868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13869 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13870 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
13874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13875 LDKRoutingFees this_ptr_conv;
13876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13877 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13878 RoutingFees_set_base_msat(&this_ptr_conv, val);
13881 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
13882 LDKRoutingFees this_ptr_conv;
13883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13884 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13885 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
13889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13890 LDKRoutingFees 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 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
13896 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
13897 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
13898 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13899 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13900 long ret_ref = (long)ret_var.inner;
13901 if (ret_var.is_owned) {
13907 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13908 LDKu8slice ser_ref;
13909 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13910 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13911 LDKRoutingFees ret_var = RoutingFees_read(ser_ref);
13912 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13913 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13914 long ret_ref = (long)ret_var.inner;
13915 if (ret_var.is_owned) {
13918 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13922 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
13923 LDKRoutingFees obj_conv;
13924 obj_conv.inner = (void*)(obj & (~1));
13925 obj_conv.is_owned = (obj & 1) || (obj == 0);
13926 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
13927 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13928 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13929 CVec_u8Z_free(arg_var);
13933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13934 LDKNodeAnnouncementInfo this_ptr_conv;
13935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13936 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13937 NodeAnnouncementInfo_free(this_ptr_conv);
13940 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13941 LDKNodeAnnouncementInfo this_ptr_conv;
13942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13943 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13944 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
13945 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13946 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13947 long ret_ref = (long)ret_var.inner;
13948 if (ret_var.is_owned) {
13954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13955 LDKNodeAnnouncementInfo this_ptr_conv;
13956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13957 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13958 LDKNodeFeatures val_conv;
13959 val_conv.inner = (void*)(val & (~1));
13960 val_conv.is_owned = (val & 1) || (val == 0);
13961 // Warning: we may need a move here but can't clone!
13962 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
13965 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
13966 LDKNodeAnnouncementInfo this_ptr_conv;
13967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13968 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13969 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
13973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13974 LDKNodeAnnouncementInfo 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 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
13980 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
13981 LDKNodeAnnouncementInfo this_ptr_conv;
13982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13983 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13984 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
13985 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
13989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13990 LDKNodeAnnouncementInfo this_ptr_conv;
13991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13992 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13993 LDKThreeBytes val_ref;
13994 CHECK((*_env)->GetArrayLength (_env, val) == 3);
13995 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
13996 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
13999 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
14000 LDKNodeAnnouncementInfo this_ptr_conv;
14001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14002 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14003 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
14004 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
14008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14009 LDKNodeAnnouncementInfo this_ptr_conv;
14010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14011 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14012 LDKThirtyTwoBytes val_ref;
14013 CHECK((*_env)->GetArrayLength (_env, val) == 32);
14014 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
14015 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
14018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14019 LDKNodeAnnouncementInfo this_ptr_conv;
14020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14021 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14022 LDKCVec_NetAddressZ val_constr;
14023 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14024 if (val_constr.datalen > 0)
14025 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14027 val_constr.data = NULL;
14028 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14029 for (size_t m = 0; m < val_constr.datalen; m++) {
14030 long arr_conv_12 = val_vals[m];
14031 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14032 FREE((void*)arr_conv_12);
14033 val_constr.data[m] = arr_conv_12_conv;
14035 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14036 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
14039 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14040 LDKNodeAnnouncementInfo this_ptr_conv;
14041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14042 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14043 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
14044 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14045 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14046 long ret_ref = (long)ret_var.inner;
14047 if (ret_var.is_owned) {
14053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14054 LDKNodeAnnouncementInfo this_ptr_conv;
14055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14056 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14057 LDKNodeAnnouncement val_conv;
14058 val_conv.inner = (void*)(val & (~1));
14059 val_conv.is_owned = (val & 1) || (val == 0);
14060 if (val_conv.inner != NULL)
14061 val_conv = NodeAnnouncement_clone(&val_conv);
14062 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
14065 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) {
14066 LDKNodeFeatures features_arg_conv;
14067 features_arg_conv.inner = (void*)(features_arg & (~1));
14068 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
14069 // Warning: we may need a move here but can't clone!
14070 LDKThreeBytes rgb_arg_ref;
14071 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
14072 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
14073 LDKThirtyTwoBytes alias_arg_ref;
14074 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
14075 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
14076 LDKCVec_NetAddressZ addresses_arg_constr;
14077 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
14078 if (addresses_arg_constr.datalen > 0)
14079 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14081 addresses_arg_constr.data = NULL;
14082 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
14083 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
14084 long arr_conv_12 = addresses_arg_vals[m];
14085 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14086 FREE((void*)arr_conv_12);
14087 addresses_arg_constr.data[m] = arr_conv_12_conv;
14089 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
14090 LDKNodeAnnouncement announcement_message_arg_conv;
14091 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
14092 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
14093 if (announcement_message_arg_conv.inner != NULL)
14094 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
14095 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
14096 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14097 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14098 long ret_ref = (long)ret_var.inner;
14099 if (ret_var.is_owned) {
14105 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14106 LDKNodeAnnouncementInfo obj_conv;
14107 obj_conv.inner = (void*)(obj & (~1));
14108 obj_conv.is_owned = (obj & 1) || (obj == 0);
14109 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
14110 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14111 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14112 CVec_u8Z_free(arg_var);
14116 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14117 LDKu8slice ser_ref;
14118 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14119 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14120 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_read(ser_ref);
14121 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14122 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14123 long ret_ref = (long)ret_var.inner;
14124 if (ret_var.is_owned) {
14127 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14132 LDKNodeInfo this_ptr_conv;
14133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14134 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14135 NodeInfo_free(this_ptr_conv);
14138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14139 LDKNodeInfo this_ptr_conv;
14140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14141 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14142 LDKCVec_u64Z val_constr;
14143 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14144 if (val_constr.datalen > 0)
14145 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14147 val_constr.data = NULL;
14148 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14149 for (size_t g = 0; g < val_constr.datalen; g++) {
14150 long arr_conv_6 = val_vals[g];
14151 val_constr.data[g] = arr_conv_6;
14153 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14154 NodeInfo_set_channels(&this_ptr_conv, val_constr);
14157 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
14158 LDKNodeInfo this_ptr_conv;
14159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14160 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14161 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
14162 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14163 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14164 long ret_ref = (long)ret_var.inner;
14165 if (ret_var.is_owned) {
14171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14172 LDKNodeInfo this_ptr_conv;
14173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14174 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14175 LDKRoutingFees val_conv;
14176 val_conv.inner = (void*)(val & (~1));
14177 val_conv.is_owned = (val & 1) || (val == 0);
14178 if (val_conv.inner != NULL)
14179 val_conv = RoutingFees_clone(&val_conv);
14180 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
14183 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
14184 LDKNodeInfo this_ptr_conv;
14185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14186 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14187 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
14188 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14189 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14190 long ret_ref = (long)ret_var.inner;
14191 if (ret_var.is_owned) {
14197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14198 LDKNodeInfo this_ptr_conv;
14199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14200 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14201 LDKNodeAnnouncementInfo val_conv;
14202 val_conv.inner = (void*)(val & (~1));
14203 val_conv.is_owned = (val & 1) || (val == 0);
14204 // Warning: we may need a move here but can't clone!
14205 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
14208 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) {
14209 LDKCVec_u64Z channels_arg_constr;
14210 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
14211 if (channels_arg_constr.datalen > 0)
14212 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14214 channels_arg_constr.data = NULL;
14215 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
14216 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
14217 long arr_conv_6 = channels_arg_vals[g];
14218 channels_arg_constr.data[g] = arr_conv_6;
14220 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
14221 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
14222 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
14223 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
14224 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
14225 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
14226 LDKNodeAnnouncementInfo announcement_info_arg_conv;
14227 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
14228 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
14229 // Warning: we may need a move here but can't clone!
14230 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
14231 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14232 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14233 long ret_ref = (long)ret_var.inner;
14234 if (ret_var.is_owned) {
14240 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14241 LDKNodeInfo obj_conv;
14242 obj_conv.inner = (void*)(obj & (~1));
14243 obj_conv.is_owned = (obj & 1) || (obj == 0);
14244 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
14245 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14246 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14247 CVec_u8Z_free(arg_var);
14251 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14252 LDKu8slice ser_ref;
14253 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14254 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14255 LDKNodeInfo ret_var = NodeInfo_read(ser_ref);
14256 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14257 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14258 long ret_ref = (long)ret_var.inner;
14259 if (ret_var.is_owned) {
14262 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14266 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
14267 LDKNetworkGraph obj_conv;
14268 obj_conv.inner = (void*)(obj & (~1));
14269 obj_conv.is_owned = (obj & 1) || (obj == 0);
14270 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
14271 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14272 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14273 CVec_u8Z_free(arg_var);
14277 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14278 LDKu8slice ser_ref;
14279 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14280 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14281 LDKNetworkGraph ret_var = NetworkGraph_read(ser_ref);
14282 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14283 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14284 long ret_ref = (long)ret_var.inner;
14285 if (ret_var.is_owned) {
14288 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14292 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
14293 LDKNetworkGraph ret_var = NetworkGraph_new();
14294 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14295 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14296 long ret_ref = (long)ret_var.inner;
14297 if (ret_var.is_owned) {
14303 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) {
14304 LDKNetworkGraph this_arg_conv;
14305 this_arg_conv.inner = (void*)(this_arg & (~1));
14306 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
14307 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);