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 long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
156 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
157 txdata->datalen = (*env)->GetArrayLength(env, bytes);
158 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
159 txdata->data_is_owned = false;
160 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
164 LDKTransaction *tx = (LDKTransaction*)ptr;
165 tx->data_is_owned = true;
166 Transaction_free(*tx);
169 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
170 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
171 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
172 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
173 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
174 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
175 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
176 return (long)vec->datalen;
178 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * _env, jclass _b) {
179 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
180 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
181 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
182 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
183 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
184 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
190 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
191 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
192 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
193 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
195 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
196 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
197 case 0: return LDKAccessError_UnknownChain;
198 case 1: return LDKAccessError_UnknownTx;
202 static jclass LDKAccessError_class = NULL;
203 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
204 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
205 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv * env, jclass clz) {
206 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
207 CHECK(LDKAccessError_class != NULL);
208 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
209 CHECK(LDKAccessError_LDKAccessError_UnknownChain != NULL);
210 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
211 CHECK(LDKAccessError_LDKAccessError_UnknownTx != NULL);
213 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
215 case LDKAccessError_UnknownChain:
216 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
217 case LDKAccessError_UnknownTx:
218 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
223 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
224 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
225 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
226 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
230 static jclass LDKChannelMonitorUpdateErr_class = NULL;
231 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
232 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
233 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv * env, jclass clz) {
234 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
235 CHECK(LDKChannelMonitorUpdateErr_class != NULL);
236 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
237 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
238 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
239 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
241 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
243 case LDKChannelMonitorUpdateErr_TemporaryFailure:
244 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
245 case LDKChannelMonitorUpdateErr_PermanentFailure:
246 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
251 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
252 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
253 case 0: return LDKConfirmationTarget_Background;
254 case 1: return LDKConfirmationTarget_Normal;
255 case 2: return LDKConfirmationTarget_HighPriority;
259 static jclass LDKConfirmationTarget_class = NULL;
260 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
261 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
262 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
263 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv * env, jclass clz) {
264 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
265 CHECK(LDKConfirmationTarget_class != NULL);
266 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
267 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
268 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
269 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
270 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
271 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
273 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
275 case LDKConfirmationTarget_Background:
276 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
277 case LDKConfirmationTarget_Normal:
278 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
279 case LDKConfirmationTarget_HighPriority:
280 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
285 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
286 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
287 case 0: return LDKLevel_Off;
288 case 1: return LDKLevel_Error;
289 case 2: return LDKLevel_Warn;
290 case 3: return LDKLevel_Info;
291 case 4: return LDKLevel_Debug;
292 case 5: return LDKLevel_Trace;
296 static jclass LDKLevel_class = NULL;
297 static jfieldID LDKLevel_LDKLevel_Off = NULL;
298 static jfieldID LDKLevel_LDKLevel_Error = NULL;
299 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
300 static jfieldID LDKLevel_LDKLevel_Info = NULL;
301 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
302 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
303 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv * env, jclass clz) {
304 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
305 CHECK(LDKLevel_class != NULL);
306 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
307 CHECK(LDKLevel_LDKLevel_Off != NULL);
308 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
309 CHECK(LDKLevel_LDKLevel_Error != NULL);
310 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
311 CHECK(LDKLevel_LDKLevel_Warn != NULL);
312 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
313 CHECK(LDKLevel_LDKLevel_Info != NULL);
314 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
315 CHECK(LDKLevel_LDKLevel_Debug != NULL);
316 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
317 CHECK(LDKLevel_LDKLevel_Trace != NULL);
319 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
322 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
324 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
326 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
328 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
330 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
332 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
337 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
338 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
339 case 0: return LDKNetwork_Bitcoin;
340 case 1: return LDKNetwork_Testnet;
341 case 2: return LDKNetwork_Regtest;
345 static jclass LDKNetwork_class = NULL;
346 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
347 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
348 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
349 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv * env, jclass clz) {
350 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
351 CHECK(LDKNetwork_class != NULL);
352 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
353 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
354 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
355 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
356 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
357 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
359 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
361 case LDKNetwork_Bitcoin:
362 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
363 case LDKNetwork_Testnet:
364 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
365 case LDKNetwork_Regtest:
366 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
371 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
372 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
373 case 0: return LDKSecp256k1Error_IncorrectSignature;
374 case 1: return LDKSecp256k1Error_InvalidMessage;
375 case 2: return LDKSecp256k1Error_InvalidPublicKey;
376 case 3: return LDKSecp256k1Error_InvalidSignature;
377 case 4: return LDKSecp256k1Error_InvalidSecretKey;
378 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
379 case 6: return LDKSecp256k1Error_InvalidTweak;
380 case 7: return LDKSecp256k1Error_NotEnoughMemory;
381 case 8: return LDKSecp256k1Error_CallbackPanicked;
385 static jclass LDKSecp256k1Error_class = NULL;
386 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
387 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
388 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
389 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
390 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
391 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
392 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
393 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
394 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
395 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv * env, jclass clz) {
396 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
397 CHECK(LDKSecp256k1Error_class != NULL);
398 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
399 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
400 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
401 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
402 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
403 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
404 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
405 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
406 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
407 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
408 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
409 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
410 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
411 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
412 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
413 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
414 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
415 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
417 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
419 case LDKSecp256k1Error_IncorrectSignature:
420 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
421 case LDKSecp256k1Error_InvalidMessage:
422 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
423 case LDKSecp256k1Error_InvalidPublicKey:
424 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
425 case LDKSecp256k1Error_InvalidSignature:
426 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
427 case LDKSecp256k1Error_InvalidSecretKey:
428 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
429 case LDKSecp256k1Error_InvalidRecoveryId:
430 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
431 case LDKSecp256k1Error_InvalidTweak:
432 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
433 case LDKSecp256k1Error_NotEnoughMemory:
434 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
435 case LDKSecp256k1Error_CallbackPanicked:
436 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
441 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
442 LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr;
443 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
445 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1new(JNIEnv *env, jclass _b, jbyteArray elems){
446 LDKCVecTempl_u8 *ret = MALLOC(sizeof(LDKCVecTempl_u8), "LDKCVecTempl_u8");
447 ret->datalen = (*env)->GetArrayLength(env, elems);
448 if (ret->datalen == 0) {
451 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVecTempl_u8 Data");
452 jbyte *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
453 for (size_t i = 0; i < ret->datalen; i++) {
454 ret->data[i] = java_elems[i];
456 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
460 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
461 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
463 LDKTransaction b_conv = *(LDKTransaction*)b;
467 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
468 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
470 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
471 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
472 CHECK(val->result_ok);
473 return *val->contents.result;
475 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
476 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
477 CHECK(!val->result_ok);
478 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(_env, (*val->contents.err));
481 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
482 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
484 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
485 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
486 CHECK(val->result_ok);
487 return *val->contents.result;
489 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
490 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
491 CHECK(!val->result_ok);
492 LDKMonitorUpdateError err_var = (*val->contents.err);
493 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
494 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
495 long err_ref = (long)err_var.inner & ~1;
498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
499 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
501 a_conv.inner = (void*)(a & (~1));
502 a_conv.is_owned = (a & 1) || (a == 0);
503 if (a_conv.inner != NULL)
504 a_conv = OutPoint_clone(&a_conv);
507 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
508 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
510 //TODO: Really need to call (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0); here
513 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
514 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
515 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
517 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
518 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
519 ret->datalen = (*env)->GetArrayLength(env, elems);
520 if (ret->datalen == 0) {
523 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
524 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
525 for (size_t i = 0; i < ret->datalen; i++) {
526 jlong arr_elem = java_elems[i];
527 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
528 FREE((void*)arr_elem);
529 ret->data[i] = arr_elem_conv;
531 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlongArray b) {
536 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
537 LDKThirtyTwoBytes a_ref;
538 CHECK((*_env)->GetArrayLength (_env, a) == 32);
539 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
541 LDKCVecTempl_TxOut b_constr;
542 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
543 if (b_constr.datalen > 0)
544 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVecTempl_TxOut Elements");
546 b_constr.data = NULL;
547 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
548 for (size_t h = 0; h < b_constr.datalen; h++) {
549 long arr_conv_7 = b_vals[h];
550 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
551 FREE((void*)arr_conv_7);
552 b_constr.data[h] = arr_conv_7_conv;
554 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
558 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
559 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
564 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
565 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
566 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jbyteArray a, jobjectArray b) {
569 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
571 CHECK((*_env)->GetArrayLength (_env, a) == 64);
572 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
574 LDKCVecTempl_Signature b_constr;
575 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
576 if (b_constr.datalen > 0)
577 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVecTempl_Signature Elements");
579 b_constr.data = NULL;
580 for (size_t i = 0; i < b_constr.datalen; i++) {
581 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
582 LDKSignature arr_conv_8_ref;
583 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
584 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
585 b_constr.data[i] = arr_conv_8_ref;
590 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
591 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
593 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
594 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
595 CHECK(val->result_ok);
596 long res_ref = (long)&(*val->contents.result);
599 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
600 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
601 CHECK(!val->result_ok);
602 return *val->contents.err;
604 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
605 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
607 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
608 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
609 CHECK(val->result_ok);
610 jbyteArray res_arr = (*_env)->NewByteArray(_env, 64);
611 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 64, (*val->contents.result).compact_form);
614 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
615 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
616 CHECK(!val->result_ok);
617 return *val->contents.err;
619 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
620 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
622 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
623 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
624 CHECK(val->result_ok);
625 LDKCVecTempl_Signature res_var = (*val->contents.result);
626 jobjectArray res_arr = (*_env)->NewObjectArray(_env, res_var.datalen, NULL, NULL);
627 for (size_t i = 0; i < res_var.datalen; i++) {
628 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
629 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
630 (*_env)->SetObjectArrayElement(_env, res_arr, i, arr_conv_8_arr);
634 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
635 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
636 CHECK(!val->result_ok);
637 return *val->contents.err;
639 static jclass LDKAPIError_APIMisuseError_class = NULL;
640 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
641 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
642 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
643 static jclass LDKAPIError_RouteError_class = NULL;
644 static jmethodID LDKAPIError_RouteError_meth = NULL;
645 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
646 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
647 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
648 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
650 LDKAPIError_APIMisuseError_class =
651 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
652 CHECK(LDKAPIError_APIMisuseError_class != NULL);
653 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
654 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
655 LDKAPIError_FeeRateTooHigh_class =
656 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
657 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
658 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
659 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
660 LDKAPIError_RouteError_class =
661 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
662 CHECK(LDKAPIError_RouteError_class != NULL);
663 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
664 CHECK(LDKAPIError_RouteError_meth != NULL);
665 LDKAPIError_ChannelUnavailable_class =
666 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
667 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
668 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
669 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
670 LDKAPIError_MonitorUpdateFailed_class =
671 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
672 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
673 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
674 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
676 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
677 LDKAPIError *obj = (LDKAPIError*)ptr;
679 case LDKAPIError_APIMisuseError: {
680 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
681 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
682 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
683 return (*_env)->NewObject(_env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
685 case LDKAPIError_FeeRateTooHigh: {
686 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
687 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
688 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
689 return (*_env)->NewObject(_env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
691 case LDKAPIError_RouteError: {
692 LDKStr err_str = obj->route_error.err;
693 char* err_buf = MALLOC(err_str.len + 1, "str conv buf");
694 memcpy(err_buf, err_str.chars, err_str.len);
695 err_buf[err_str.len] = 0;
696 jstring err_conv = (*_env)->NewStringUTF(_env, err_str.chars);
698 return (*_env)->NewObject(_env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
700 case LDKAPIError_ChannelUnavailable: {
701 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
702 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
703 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
704 return (*_env)->NewObject(_env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
706 case LDKAPIError_MonitorUpdateFailed: {
707 return (*_env)->NewObject(_env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
712 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
713 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
715 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
716 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
717 CHECK(val->result_ok);
718 return *val->contents.result;
720 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
721 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
722 CHECK(!val->result_ok);
723 long err_ref = (long)&(*val->contents.err);
726 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
727 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
729 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
730 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
731 CHECK(val->result_ok);
732 return *val->contents.result;
734 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
735 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
736 CHECK(!val->result_ok);
737 LDKPaymentSendFailure err_var = (*val->contents.err);
738 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
739 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
740 long err_ref = (long)err_var.inner & ~1;
743 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) {
744 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
745 LDKChannelAnnouncement a_conv;
746 a_conv.inner = (void*)(a & (~1));
747 a_conv.is_owned = (a & 1) || (a == 0);
748 if (a_conv.inner != NULL)
749 a_conv = ChannelAnnouncement_clone(&a_conv);
751 LDKChannelUpdate b_conv;
752 b_conv.inner = (void*)(b & (~1));
753 b_conv.is_owned = (b & 1) || (b == 0);
754 if (b_conv.inner != NULL)
755 b_conv = ChannelUpdate_clone(&b_conv);
757 LDKChannelUpdate c_conv;
758 c_conv.inner = (void*)(c & (~1));
759 c_conv.is_owned = (c & 1) || (c == 0);
760 if (c_conv.inner != NULL)
761 c_conv = ChannelUpdate_clone(&c_conv);
765 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
766 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
768 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
769 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
770 CHECK(val->result_ok);
771 return *val->contents.result;
773 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
774 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
775 CHECK(!val->result_ok);
776 LDKPeerHandleError err_var = (*val->contents.err);
777 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
778 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
779 long err_ref = (long)err_var.inner & ~1;
782 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
783 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
784 LDKHTLCOutputInCommitment a_conv;
785 a_conv.inner = (void*)(a & (~1));
786 a_conv.is_owned = (a & 1) || (a == 0);
787 if (a_conv.inner != NULL)
788 a_conv = HTLCOutputInCommitment_clone(&a_conv);
791 CHECK((*_env)->GetArrayLength (_env, b) == 64);
792 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
796 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
797 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
798 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
799 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
800 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
801 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
803 LDKSpendableOutputDescriptor_StaticOutput_class =
804 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
805 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
806 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
807 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
808 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
809 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
810 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
811 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
812 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
813 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
814 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
815 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
816 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
817 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
819 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
820 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
822 case LDKSpendableOutputDescriptor_StaticOutput: {
823 LDKOutPoint outpoint_var = obj->static_output.outpoint;
824 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
825 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
826 long outpoint_ref = (long)outpoint_var.inner & ~1;
827 long output_ref = (long)&obj->static_output.output;
828 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
830 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
831 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
832 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
833 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
834 long outpoint_ref = (long)outpoint_var.inner & ~1;
835 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
836 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
837 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
838 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
839 jbyteArray revocation_pubkey_arr = (*_env)->NewByteArray(_env, 33);
840 (*_env)->SetByteArrayRegion(_env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
841 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);
843 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
844 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
845 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
846 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
847 long outpoint_ref = (long)outpoint_var.inner & ~1;
848 long output_ref = (long)&obj->static_output_counterparty_payment.output;
849 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
850 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
855 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
856 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
857 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
859 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
860 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
861 ret->datalen = (*env)->GetArrayLength(env, elems);
862 if (ret->datalen == 0) {
865 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
866 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
867 for (size_t i = 0; i < ret->datalen; i++) {
868 jlong arr_elem = java_elems[i];
869 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
870 FREE((void*)arr_elem);
871 ret->data[i] = arr_elem_conv;
873 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
877 static jclass LDKEvent_FundingGenerationReady_class = NULL;
878 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
879 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
880 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
881 static jclass LDKEvent_PaymentReceived_class = NULL;
882 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
883 static jclass LDKEvent_PaymentSent_class = NULL;
884 static jmethodID LDKEvent_PaymentSent_meth = NULL;
885 static jclass LDKEvent_PaymentFailed_class = NULL;
886 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
887 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
888 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
889 static jclass LDKEvent_SpendableOutputs_class = NULL;
890 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
892 LDKEvent_FundingGenerationReady_class =
893 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
894 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
895 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
896 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
897 LDKEvent_FundingBroadcastSafe_class =
898 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
899 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
900 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
901 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
902 LDKEvent_PaymentReceived_class =
903 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
904 CHECK(LDKEvent_PaymentReceived_class != NULL);
905 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
906 CHECK(LDKEvent_PaymentReceived_meth != NULL);
907 LDKEvent_PaymentSent_class =
908 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
909 CHECK(LDKEvent_PaymentSent_class != NULL);
910 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
911 CHECK(LDKEvent_PaymentSent_meth != NULL);
912 LDKEvent_PaymentFailed_class =
913 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
914 CHECK(LDKEvent_PaymentFailed_class != NULL);
915 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
916 CHECK(LDKEvent_PaymentFailed_meth != NULL);
917 LDKEvent_PendingHTLCsForwardable_class =
918 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
919 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
920 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
921 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
922 LDKEvent_SpendableOutputs_class =
923 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
924 CHECK(LDKEvent_SpendableOutputs_class != NULL);
925 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
926 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
928 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
929 LDKEvent *obj = (LDKEvent*)ptr;
931 case LDKEvent_FundingGenerationReady: {
932 jbyteArray temporary_channel_id_arr = (*_env)->NewByteArray(_env, 32);
933 (*_env)->SetByteArrayRegion(_env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
934 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
935 jbyteArray output_script_arr = (*_env)->NewByteArray(_env, output_script_var.datalen);
936 (*_env)->SetByteArrayRegion(_env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
937 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);
939 case LDKEvent_FundingBroadcastSafe: {
940 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
941 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
942 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
943 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
944 return (*_env)->NewObject(_env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
946 case LDKEvent_PaymentReceived: {
947 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
948 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
949 jbyteArray payment_secret_arr = (*_env)->NewByteArray(_env, 32);
950 (*_env)->SetByteArrayRegion(_env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
951 return (*_env)->NewObject(_env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
953 case LDKEvent_PaymentSent: {
954 jbyteArray payment_preimage_arr = (*_env)->NewByteArray(_env, 32);
955 (*_env)->SetByteArrayRegion(_env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
956 return (*_env)->NewObject(_env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
958 case LDKEvent_PaymentFailed: {
959 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
960 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
961 return (*_env)->NewObject(_env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
963 case LDKEvent_PendingHTLCsForwardable: {
964 return (*_env)->NewObject(_env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
966 case LDKEvent_SpendableOutputs: {
967 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
968 jlongArray outputs_arr = (*_env)->NewLongArray(_env, outputs_var.datalen);
969 jlong *outputs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, outputs_arr, NULL);
970 for (size_t b = 0; b < outputs_var.datalen; b++) {
971 long arr_conv_27_ref = (long)&outputs_var.data[b];
972 outputs_arr_ptr[b] = arr_conv_27_ref;
974 (*_env)->ReleasePrimitiveArrayCritical(_env, outputs_arr, outputs_arr_ptr, 0);
975 return (*_env)->NewObject(_env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
980 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
981 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
982 static jclass LDKErrorAction_IgnoreError_class = NULL;
983 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
984 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
985 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
987 LDKErrorAction_DisconnectPeer_class =
988 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
989 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
990 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
991 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
992 LDKErrorAction_IgnoreError_class =
993 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
994 CHECK(LDKErrorAction_IgnoreError_class != NULL);
995 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
996 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
997 LDKErrorAction_SendErrorMessage_class =
998 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
999 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1000 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1001 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1003 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1004 LDKErrorAction *obj = (LDKErrorAction*)ptr;
1006 case LDKErrorAction_DisconnectPeer: {
1007 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1008 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1009 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1010 long msg_ref = (long)msg_var.inner & ~1;
1011 return (*_env)->NewObject(_env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1013 case LDKErrorAction_IgnoreError: {
1014 return (*_env)->NewObject(_env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1016 case LDKErrorAction_SendErrorMessage: {
1017 LDKErrorMessage msg_var = obj->send_error_message.msg;
1018 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1019 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1020 long msg_ref = (long)msg_var.inner & ~1;
1021 return (*_env)->NewObject(_env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1026 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1027 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1028 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1029 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1030 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1031 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
1033 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1034 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1035 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1036 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1037 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1038 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1039 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1040 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1041 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1042 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1043 LDKHTLCFailChannelUpdate_NodeFailure_class =
1044 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1045 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1046 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1047 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1049 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1050 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
1052 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1053 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1054 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1055 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1056 long msg_ref = (long)msg_var.inner & ~1;
1057 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1059 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1060 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1062 case LDKHTLCFailChannelUpdate_NodeFailure: {
1063 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1064 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1065 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1070 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1071 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1072 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1073 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1074 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1075 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1076 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1077 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1078 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1079 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1080 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1081 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1082 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1083 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1084 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1085 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1086 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1087 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1088 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1089 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1090 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1091 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1092 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1093 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1094 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1095 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1096 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1097 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1098 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1099 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1100 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1101 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1103 LDKMessageSendEvent_SendAcceptChannel_class =
1104 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1105 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1106 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1107 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1108 LDKMessageSendEvent_SendOpenChannel_class =
1109 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1110 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1111 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1112 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1113 LDKMessageSendEvent_SendFundingCreated_class =
1114 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1115 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1116 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1117 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1118 LDKMessageSendEvent_SendFundingSigned_class =
1119 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1120 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1121 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1122 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1123 LDKMessageSendEvent_SendFundingLocked_class =
1124 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1125 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1126 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1127 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1128 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1129 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1130 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1131 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1132 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1133 LDKMessageSendEvent_UpdateHTLCs_class =
1134 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1135 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1136 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1137 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1138 LDKMessageSendEvent_SendRevokeAndACK_class =
1139 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1140 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1141 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1142 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1143 LDKMessageSendEvent_SendClosingSigned_class =
1144 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1145 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1146 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1147 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1148 LDKMessageSendEvent_SendShutdown_class =
1149 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1150 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1151 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1152 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1153 LDKMessageSendEvent_SendChannelReestablish_class =
1154 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1155 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1156 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1157 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1158 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1159 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1160 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1161 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1162 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1163 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1164 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1165 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1166 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1167 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1168 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1169 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1170 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1171 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1172 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1173 LDKMessageSendEvent_HandleError_class =
1174 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1175 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1176 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1177 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1178 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1179 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1180 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1181 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1182 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1184 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1185 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1187 case LDKMessageSendEvent_SendAcceptChannel: {
1188 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1189 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1190 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1191 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1192 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1193 long msg_ref = (long)msg_var.inner & ~1;
1194 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1196 case LDKMessageSendEvent_SendOpenChannel: {
1197 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1198 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1199 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1200 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1201 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1202 long msg_ref = (long)msg_var.inner & ~1;
1203 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1205 case LDKMessageSendEvent_SendFundingCreated: {
1206 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1207 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1208 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1209 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1210 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1211 long msg_ref = (long)msg_var.inner & ~1;
1212 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1214 case LDKMessageSendEvent_SendFundingSigned: {
1215 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1216 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1217 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1218 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1219 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1220 long msg_ref = (long)msg_var.inner & ~1;
1221 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1223 case LDKMessageSendEvent_SendFundingLocked: {
1224 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1225 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1226 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1227 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1228 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1229 long msg_ref = (long)msg_var.inner & ~1;
1230 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1232 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1233 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1234 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1235 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1236 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1237 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1238 long msg_ref = (long)msg_var.inner & ~1;
1239 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1241 case LDKMessageSendEvent_UpdateHTLCs: {
1242 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1243 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1244 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1245 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1246 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1247 long updates_ref = (long)updates_var.inner & ~1;
1248 return (*_env)->NewObject(_env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1250 case LDKMessageSendEvent_SendRevokeAndACK: {
1251 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1252 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1253 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1254 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1255 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1256 long msg_ref = (long)msg_var.inner & ~1;
1257 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1259 case LDKMessageSendEvent_SendClosingSigned: {
1260 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1261 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1262 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1263 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1264 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1265 long msg_ref = (long)msg_var.inner & ~1;
1266 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1268 case LDKMessageSendEvent_SendShutdown: {
1269 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1270 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1271 LDKShutdown msg_var = obj->send_shutdown.msg;
1272 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1273 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1274 long msg_ref = (long)msg_var.inner & ~1;
1275 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1277 case LDKMessageSendEvent_SendChannelReestablish: {
1278 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1279 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1280 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1281 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1282 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1283 long msg_ref = (long)msg_var.inner & ~1;
1284 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1286 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1287 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.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 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1292 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1293 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1294 long update_msg_ref = (long)update_msg_var.inner & ~1;
1295 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1297 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1298 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1299 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1300 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1301 long msg_ref = (long)msg_var.inner & ~1;
1302 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1304 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1305 LDKChannelUpdate msg_var = obj->broadcast_channel_update.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_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1311 case LDKMessageSendEvent_HandleError: {
1312 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1313 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1314 long action_ref = (long)&obj->handle_error.action;
1315 return (*_env)->NewObject(_env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1317 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1318 long update_ref = (long)&obj->payment_failure_network_update.update;
1319 return (*_env)->NewObject(_env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1324 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1325 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1326 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1328 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1329 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1330 ret->datalen = (*env)->GetArrayLength(env, elems);
1331 if (ret->datalen == 0) {
1334 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1335 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1336 for (size_t i = 0; i < ret->datalen; i++) {
1337 jlong arr_elem = java_elems[i];
1338 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1339 FREE((void*)arr_elem);
1340 ret->data[i] = arr_elem_conv;
1342 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1346 typedef struct LDKMessageSendEventsProvider_JCalls {
1347 atomic_size_t refcnt;
1350 jmethodID get_and_clear_pending_msg_events_meth;
1351 } LDKMessageSendEventsProvider_JCalls;
1352 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1353 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1355 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1356 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1358 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1359 LDKCVec_MessageSendEventZ ret_constr;
1360 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
1361 if (ret_constr.datalen > 0)
1362 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
1364 ret_constr.data = NULL;
1365 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
1366 for (size_t s = 0; s < ret_constr.datalen; s++) {
1367 long arr_conv_18 = ret_vals[s];
1368 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
1369 FREE((void*)arr_conv_18);
1370 ret_constr.data[s] = arr_conv_18_conv;
1372 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
1375 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1376 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1377 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1379 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1380 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1384 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1385 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1386 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1387 return (void*) this_arg;
1389 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1390 jclass c = (*env)->GetObjectClass(env, o);
1392 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1393 atomic_init(&calls->refcnt, 1);
1394 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1395 calls->o = (*env)->NewWeakGlobalRef(env, o);
1396 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
1397 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
1399 LDKMessageSendEventsProvider ret = {
1400 .this_arg = (void*) calls,
1401 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1402 .free = LDKMessageSendEventsProvider_JCalls_free,
1406 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1407 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1408 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1409 return (long)res_ptr;
1411 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1412 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1416 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1417 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1418 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1419 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1420 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1421 for (size_t s = 0; s < ret_var.datalen; s++) {
1422 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
1423 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
1424 long arr_conv_18_ref = (long)arr_conv_18_copy;
1425 ret_arr_ptr[s] = arr_conv_18_ref;
1427 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1428 CVec_MessageSendEventZ_free(ret_var);
1432 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1433 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1434 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1436 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1437 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1438 ret->datalen = (*env)->GetArrayLength(env, elems);
1439 if (ret->datalen == 0) {
1442 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1443 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1444 for (size_t i = 0; i < ret->datalen; i++) {
1445 jlong arr_elem = java_elems[i];
1446 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1447 FREE((void*)arr_elem);
1448 ret->data[i] = arr_elem_conv;
1450 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1454 typedef struct LDKEventsProvider_JCalls {
1455 atomic_size_t refcnt;
1458 jmethodID get_and_clear_pending_events_meth;
1459 } LDKEventsProvider_JCalls;
1460 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1461 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1463 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1464 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1466 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_events_meth);
1467 LDKCVec_EventZ ret_constr;
1468 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
1469 if (ret_constr.datalen > 0)
1470 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
1472 ret_constr.data = NULL;
1473 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
1474 for (size_t h = 0; h < ret_constr.datalen; h++) {
1475 long arr_conv_7 = ret_vals[h];
1476 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
1477 FREE((void*)arr_conv_7);
1478 ret_constr.data[h] = arr_conv_7_conv;
1480 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
1483 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1484 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1485 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1487 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1488 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1492 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1493 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1494 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1495 return (void*) this_arg;
1497 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1498 jclass c = (*env)->GetObjectClass(env, o);
1500 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1501 atomic_init(&calls->refcnt, 1);
1502 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1503 calls->o = (*env)->NewWeakGlobalRef(env, o);
1504 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
1505 CHECK(calls->get_and_clear_pending_events_meth != NULL);
1507 LDKEventsProvider ret = {
1508 .this_arg = (void*) calls,
1509 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1510 .free = LDKEventsProvider_JCalls_free,
1514 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1515 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1516 *res_ptr = LDKEventsProvider_init(env, _a, o);
1517 return (long)res_ptr;
1519 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1520 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1524 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1525 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1526 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1527 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1528 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1529 for (size_t h = 0; h < ret_var.datalen; h++) {
1530 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
1531 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
1532 long arr_conv_7_ref = (long)arr_conv_7_copy;
1533 ret_arr_ptr[h] = arr_conv_7_ref;
1535 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1536 CVec_EventZ_free(ret_var);
1540 typedef struct LDKLogger_JCalls {
1541 atomic_size_t refcnt;
1546 void log_jcall(const void* this_arg, const char *record) {
1547 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1549 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1550 jstring record_conv = (*_env)->NewStringUTF(_env, record);
1551 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1553 return (*_env)->CallVoidMethod(_env, obj, j_calls->log_meth, record_conv);
1555 static void LDKLogger_JCalls_free(void* this_arg) {
1556 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1557 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1559 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1560 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1564 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1565 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1566 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1567 return (void*) this_arg;
1569 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1570 jclass c = (*env)->GetObjectClass(env, o);
1572 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1573 atomic_init(&calls->refcnt, 1);
1574 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1575 calls->o = (*env)->NewWeakGlobalRef(env, o);
1576 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1577 CHECK(calls->log_meth != NULL);
1580 .this_arg = (void*) calls,
1582 .free = LDKLogger_JCalls_free,
1586 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1587 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1588 *res_ptr = LDKLogger_init(env, _a, o);
1589 return (long)res_ptr;
1591 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1592 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1596 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1597 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1599 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1600 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1601 CHECK(val->result_ok);
1602 long res_ref = (long)&(*val->contents.result);
1605 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1606 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1607 CHECK(!val->result_ok);
1608 jclass err_conv = LDKAccessError_to_java(_env, (*val->contents.err));
1611 typedef struct LDKAccess_JCalls {
1612 atomic_size_t refcnt;
1615 jmethodID get_utxo_meth;
1617 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1618 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1620 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1621 jbyteArray genesis_hash_arr = (*_env)->NewByteArray(_env, 32);
1622 (*_env)->SetByteArrayRegion(_env, genesis_hash_arr, 0, 32, *genesis_hash);
1623 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1625 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1626 LDKCResult_TxOutAccessErrorZ res = *ret;
1630 static void LDKAccess_JCalls_free(void* this_arg) {
1631 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1632 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1634 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1635 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1639 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1640 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1641 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1642 return (void*) this_arg;
1644 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1645 jclass c = (*env)->GetObjectClass(env, o);
1647 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1648 atomic_init(&calls->refcnt, 1);
1649 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1650 calls->o = (*env)->NewWeakGlobalRef(env, o);
1651 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1652 CHECK(calls->get_utxo_meth != NULL);
1655 .this_arg = (void*) calls,
1656 .get_utxo = get_utxo_jcall,
1657 .free = LDKAccess_JCalls_free,
1661 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1662 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1663 *res_ptr = LDKAccess_init(env, _a, o);
1664 return (long)res_ptr;
1666 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1667 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1671 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) {
1672 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1673 unsigned char genesis_hash_arr[32];
1674 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
1675 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1676 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1677 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1678 *ret = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1682 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1683 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1684 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1685 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1686 for (size_t i = 0; i < vec->datalen; i++) {
1687 CHECK((((long)vec->data[i].inner) & 1) == 0);
1688 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1690 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1694 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1695 ret->datalen = (*env)->GetArrayLength(env, elems);
1696 if (ret->datalen == 0) {
1699 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1700 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1701 for (size_t i = 0; i < ret->datalen; i++) {
1702 jlong arr_elem = java_elems[i];
1703 LDKHTLCOutputInCommitment arr_elem_conv;
1704 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1705 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1706 if (arr_elem_conv.inner != NULL)
1707 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1708 ret->data[i] = arr_elem_conv;
1710 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1714 typedef struct LDKChannelKeys_JCalls {
1715 atomic_size_t refcnt;
1718 jmethodID get_per_commitment_point_meth;
1719 jmethodID release_commitment_secret_meth;
1720 jmethodID key_derivation_params_meth;
1721 jmethodID sign_counterparty_commitment_meth;
1722 jmethodID sign_holder_commitment_meth;
1723 jmethodID sign_holder_commitment_htlc_transactions_meth;
1724 jmethodID sign_justice_transaction_meth;
1725 jmethodID sign_counterparty_htlc_transaction_meth;
1726 jmethodID sign_closing_transaction_meth;
1727 jmethodID sign_channel_announcement_meth;
1728 jmethodID on_accept_meth;
1729 } LDKChannelKeys_JCalls;
1730 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1731 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1733 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1734 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1736 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_per_commitment_point_meth, idx);
1737 LDKPublicKey ret_ref;
1738 CHECK((*_env)->GetArrayLength (_env, ret) == 33);
1739 (*_env)->GetByteArrayRegion (_env, ret, 0, 33, ret_ref.compressed_form);
1742 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1743 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1745 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1746 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1748 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->release_commitment_secret_meth, idx);
1749 LDKThirtyTwoBytes ret_ref;
1750 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
1751 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.data);
1754 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1755 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1757 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1758 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1760 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*_env)->CallLongMethod(_env, obj, j_calls->key_derivation_params_meth);
1761 LDKC2Tuple_u64u64Z res = *ret;
1765 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) {
1766 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1768 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1769 LDKTransaction *commitment_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1770 *commitment_tx_copy = commitment_tx;
1771 long commitment_tx_ref = (long)commitment_tx_copy;
1772 LDKCVec_HTLCOutputInCommitmentZ htlcs_var = htlcs;
1773 jlongArray htlcs_arr = (*_env)->NewLongArray(_env, htlcs_var.datalen);
1774 jlong *htlcs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, htlcs_arr, NULL);
1775 for (size_t y = 0; y < htlcs_var.datalen; y++) {
1776 LDKHTLCOutputInCommitment arr_conv_24_var = htlcs_var.data[y];
1777 CHECK((((long)arr_conv_24_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1778 CHECK((((long)&arr_conv_24_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1779 long arr_conv_24_ref;
1780 if (arr_conv_24_var.is_owned) {
1781 arr_conv_24_ref = (long)arr_conv_24_var.inner | 1;
1783 arr_conv_24_ref = (long)arr_conv_24_var.inner & ~1;
1785 htlcs_arr_ptr[y] = arr_conv_24_ref;
1787 (*_env)->ReleasePrimitiveArrayCritical(_env, htlcs_arr, htlcs_arr_ptr, 0);
1788 FREE(htlcs_var.data);
1789 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1791 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_counterparty_commitment_meth, feerate_per_kw, commitment_tx_ref, keys, htlcs_arr);
1792 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
1796 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1797 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1799 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1800 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1802 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx);
1803 LDKCResult_SignatureNoneZ res = *ret;
1807 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1808 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1810 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1811 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1813 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx);
1814 LDKCResult_CVec_SignatureZNoneZ res = *ret;
1818 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) {
1819 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1821 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1822 LDKTransaction *justice_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1823 *justice_tx_copy = justice_tx;
1824 long justice_tx_ref = (long)justice_tx_copy;
1825 jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32);
1826 (*_env)->SetByteArrayRegion(_env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1827 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1829 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_justice_transaction_meth, justice_tx_ref, input, amount, per_commitment_key_arr, htlc);
1830 LDKCResult_SignatureNoneZ res = *ret;
1834 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) {
1835 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1837 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1838 LDKTransaction *htlc_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1839 *htlc_tx_copy = htlc_tx;
1840 long htlc_tx_ref = (long)htlc_tx_copy;
1841 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
1842 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1843 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1845 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_ref, input, amount, per_commitment_point_arr, htlc);
1846 LDKCResult_SignatureNoneZ res = *ret;
1850 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1851 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1853 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1854 LDKTransaction *closing_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1855 *closing_tx_copy = closing_tx;
1856 long closing_tx_ref = (long)closing_tx_copy;
1857 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1859 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1860 LDKCResult_SignatureNoneZ res = *ret;
1864 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1865 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1867 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1868 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1870 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, msg);
1871 LDKCResult_SignatureNoneZ res = *ret;
1875 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1876 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1878 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1879 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1881 return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
1883 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1884 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1885 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1887 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1888 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1892 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1893 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1894 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1895 return (void*) this_arg;
1897 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
1898 jclass c = (*env)->GetObjectClass(env, o);
1900 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1901 atomic_init(&calls->refcnt, 1);
1902 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1903 calls->o = (*env)->NewWeakGlobalRef(env, o);
1904 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1905 CHECK(calls->get_per_commitment_point_meth != NULL);
1906 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1907 CHECK(calls->release_commitment_secret_meth != NULL);
1908 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1909 CHECK(calls->key_derivation_params_meth != NULL);
1910 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJ[J)J");
1911 CHECK(calls->sign_counterparty_commitment_meth != NULL);
1912 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1913 CHECK(calls->sign_holder_commitment_meth != NULL);
1914 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1915 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1916 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
1917 CHECK(calls->sign_justice_transaction_meth != NULL);
1918 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
1919 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
1920 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
1921 CHECK(calls->sign_closing_transaction_meth != NULL);
1922 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1923 CHECK(calls->sign_channel_announcement_meth != NULL);
1924 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
1925 CHECK(calls->on_accept_meth != NULL);
1927 LDKChannelPublicKeys pubkeys_conv;
1928 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1929 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1930 if (pubkeys_conv.inner != NULL)
1931 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1933 LDKChannelKeys ret = {
1934 .this_arg = (void*) calls,
1935 .get_per_commitment_point = get_per_commitment_point_jcall,
1936 .release_commitment_secret = release_commitment_secret_jcall,
1937 .key_derivation_params = key_derivation_params_jcall,
1938 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1939 .sign_holder_commitment = sign_holder_commitment_jcall,
1940 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1941 .sign_justice_transaction = sign_justice_transaction_jcall,
1942 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1943 .sign_closing_transaction = sign_closing_transaction_jcall,
1944 .sign_channel_announcement = sign_channel_announcement_jcall,
1945 .on_accept = on_accept_jcall,
1946 .clone = LDKChannelKeys_JCalls_clone,
1947 .free = LDKChannelKeys_JCalls_free,
1948 .pubkeys = pubkeys_conv,
1949 .set_pubkeys = NULL,
1953 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
1954 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1955 *res_ptr = LDKChannelKeys_init(env, _a, o, pubkeys);
1956 return (long)res_ptr;
1958 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1959 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
1963 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1964 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1965 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
1966 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
1970 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1971 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1972 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
1973 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
1977 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
1978 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1979 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1980 *ret = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1984 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) {
1985 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1986 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
1987 LDKPreCalculatedTxCreationKeys keys_conv;
1988 keys_conv.inner = (void*)(keys & (~1));
1989 keys_conv.is_owned = (keys & 1) || (keys == 0);
1990 LDKCVec_HTLCOutputInCommitmentZ htlcs_constr;
1991 htlcs_constr.datalen = (*_env)->GetArrayLength (_env, htlcs);
1992 if (htlcs_constr.datalen > 0)
1993 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
1995 htlcs_constr.data = NULL;
1996 long* htlcs_vals = (*_env)->GetLongArrayElements (_env, htlcs, NULL);
1997 for (size_t y = 0; y < htlcs_constr.datalen; y++) {
1998 long arr_conv_24 = htlcs_vals[y];
1999 LDKHTLCOutputInCommitment arr_conv_24_conv;
2000 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
2001 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
2002 if (arr_conv_24_conv.inner != NULL)
2003 arr_conv_24_conv = HTLCOutputInCommitment_clone(&arr_conv_24_conv);
2004 htlcs_constr.data[y] = arr_conv_24_conv;
2006 (*_env)->ReleaseLongArrayElements (_env, htlcs, htlcs_vals, 0);
2007 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2008 *ret = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_constr);
2012 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
2013 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2014 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2015 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2016 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
2017 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2018 *ret = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2022 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) {
2023 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2024 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2025 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2026 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
2027 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
2028 *ret = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2032 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) {
2033 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2034 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
2035 unsigned char per_commitment_key_arr[32];
2036 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
2037 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
2038 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2039 LDKHTLCOutputInCommitment htlc_conv;
2040 htlc_conv.inner = (void*)(htlc & (~1));
2041 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2042 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2043 *ret = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
2047 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) {
2048 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2049 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
2050 LDKPublicKey per_commitment_point_ref;
2051 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
2052 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2053 LDKHTLCOutputInCommitment htlc_conv;
2054 htlc_conv.inner = (void*)(htlc & (~1));
2055 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2056 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2057 *ret = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv);
2061 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) {
2062 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2063 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
2064 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2065 *ret = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv);
2069 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
2070 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2071 LDKUnsignedChannelAnnouncement msg_conv;
2072 msg_conv.inner = (void*)(msg & (~1));
2073 msg_conv.is_owned = (msg & 1) || (msg == 0);
2074 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2075 *ret = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2079 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) {
2080 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2081 LDKChannelPublicKeys channel_points_conv;
2082 channel_points_conv.inner = (void*)(channel_points & (~1));
2083 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2084 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2087 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
2088 if (this_arg->set_pubkeys != NULL)
2089 this_arg->set_pubkeys(this_arg);
2090 return this_arg->pubkeys;
2092 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
2093 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2094 LDKChannelPublicKeys ret = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
2095 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
2098 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2099 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2100 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2101 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2102 for (size_t i = 0; i < vec->datalen; i++) {
2103 CHECK((((long)vec->data[i].inner) & 1) == 0);
2104 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2106 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2109 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2110 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2111 ret->datalen = (*env)->GetArrayLength(env, elems);
2112 if (ret->datalen == 0) {
2115 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2116 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2117 for (size_t i = 0; i < ret->datalen; i++) {
2118 jlong arr_elem = java_elems[i];
2119 LDKMonitorEvent arr_elem_conv;
2120 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2121 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2122 // Warning: we may need a move here but can't clone!
2123 ret->data[i] = arr_elem_conv;
2125 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2129 typedef struct LDKWatch_JCalls {
2130 atomic_size_t refcnt;
2133 jmethodID watch_channel_meth;
2134 jmethodID update_channel_meth;
2135 jmethodID release_pending_monitor_events_meth;
2137 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2138 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2140 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2141 LDKOutPoint funding_txo_var = funding_txo;
2142 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2143 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2144 long funding_txo_ref;
2145 if (funding_txo_var.is_owned) {
2146 funding_txo_ref = (long)funding_txo_var.inner | 1;
2148 funding_txo_ref = (long)funding_txo_var.inner & ~1;
2150 LDKChannelMonitor monitor_var = monitor;
2151 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2152 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2154 if (monitor_var.is_owned) {
2155 monitor_ref = (long)monitor_var.inner | 1;
2157 monitor_ref = (long)monitor_var.inner & ~1;
2159 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2161 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2162 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2166 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2167 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2169 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2170 LDKOutPoint funding_txo_var = funding_txo;
2171 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2172 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2173 long funding_txo_ref;
2174 if (funding_txo_var.is_owned) {
2175 funding_txo_ref = (long)funding_txo_var.inner | 1;
2177 funding_txo_ref = (long)funding_txo_var.inner & ~1;
2179 LDKChannelMonitorUpdate update_var = update;
2180 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2181 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2183 if (update_var.is_owned) {
2184 update_ref = (long)update_var.inner | 1;
2186 update_ref = (long)update_var.inner & ~1;
2188 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2190 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2191 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2195 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2196 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2198 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2199 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2201 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->release_pending_monitor_events_meth);
2202 LDKCVec_MonitorEventZ ret_constr;
2203 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
2204 if (ret_constr.datalen > 0)
2205 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2207 ret_constr.data = NULL;
2208 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
2209 for (size_t o = 0; o < ret_constr.datalen; o++) {
2210 long arr_conv_14 = ret_vals[o];
2211 LDKMonitorEvent arr_conv_14_conv;
2212 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2213 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2214 // Warning: we may need a move here but can't clone!
2215 ret_constr.data[o] = arr_conv_14_conv;
2217 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
2220 static void LDKWatch_JCalls_free(void* this_arg) {
2221 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2222 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2224 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2225 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2229 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2230 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2231 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2232 return (void*) this_arg;
2234 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2235 jclass c = (*env)->GetObjectClass(env, o);
2237 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2238 atomic_init(&calls->refcnt, 1);
2239 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2240 calls->o = (*env)->NewWeakGlobalRef(env, o);
2241 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2242 CHECK(calls->watch_channel_meth != NULL);
2243 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2244 CHECK(calls->update_channel_meth != NULL);
2245 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2246 CHECK(calls->release_pending_monitor_events_meth != NULL);
2249 .this_arg = (void*) calls,
2250 .watch_channel = watch_channel_jcall,
2251 .update_channel = update_channel_jcall,
2252 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2253 .free = LDKWatch_JCalls_free,
2257 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2258 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2259 *res_ptr = LDKWatch_init(env, _a, o);
2260 return (long)res_ptr;
2262 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2263 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2267 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2268 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2269 LDKOutPoint funding_txo_conv;
2270 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2271 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2272 if (funding_txo_conv.inner != NULL)
2273 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2274 LDKChannelMonitor monitor_conv;
2275 monitor_conv.inner = (void*)(monitor & (~1));
2276 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2277 // Warning: we may need a move here but can't clone!
2278 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2279 *ret = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2283 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2284 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2285 LDKOutPoint funding_txo_conv;
2286 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2287 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2288 if (funding_txo_conv.inner != NULL)
2289 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2290 LDKChannelMonitorUpdate update_conv;
2291 update_conv.inner = (void*)(update & (~1));
2292 update_conv.is_owned = (update & 1) || (update == 0);
2293 if (update_conv.inner != NULL)
2294 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2295 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2296 *ret = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2300 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2301 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2302 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2303 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
2304 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
2305 for (size_t o = 0; o < ret_var.datalen; o++) {
2306 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2307 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2308 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2309 long arr_conv_14_ref;
2310 if (arr_conv_14_var.is_owned) {
2311 arr_conv_14_ref = (long)arr_conv_14_var.inner | 1;
2313 arr_conv_14_ref = (long)arr_conv_14_var.inner & ~1;
2315 ret_arr_ptr[o] = arr_conv_14_ref;
2317 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
2322 typedef struct LDKFilter_JCalls {
2323 atomic_size_t refcnt;
2326 jmethodID register_tx_meth;
2327 jmethodID register_output_meth;
2329 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2330 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2332 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2333 jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
2334 (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
2335 LDKu8slice script_pubkey_var = script_pubkey;
2336 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2337 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2338 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2340 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2342 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2343 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2345 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2346 LDKu8slice script_pubkey_var = script_pubkey;
2347 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2348 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2349 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2351 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, outpoint, script_pubkey_arr);
2353 static void LDKFilter_JCalls_free(void* this_arg) {
2354 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2355 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2357 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2358 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2362 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2363 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2364 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2365 return (void*) this_arg;
2367 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2368 jclass c = (*env)->GetObjectClass(env, o);
2370 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2371 atomic_init(&calls->refcnt, 1);
2372 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2373 calls->o = (*env)->NewWeakGlobalRef(env, o);
2374 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2375 CHECK(calls->register_tx_meth != NULL);
2376 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2377 CHECK(calls->register_output_meth != NULL);
2380 .this_arg = (void*) calls,
2381 .register_tx = register_tx_jcall,
2382 .register_output = register_output_jcall,
2383 .free = LDKFilter_JCalls_free,
2387 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2388 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2389 *res_ptr = LDKFilter_init(env, _a, o);
2390 return (long)res_ptr;
2392 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2393 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2398 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2399 unsigned char txid_arr[32];
2400 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2401 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2402 unsigned char (*txid_ref)[32] = &txid_arr;
2403 LDKu8slice script_pubkey_ref;
2404 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2405 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2406 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2407 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2411 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2412 LDKOutPoint outpoint_conv;
2413 outpoint_conv.inner = (void*)(outpoint & (~1));
2414 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2415 LDKu8slice script_pubkey_ref;
2416 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2417 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2418 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2419 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2422 typedef struct LDKBroadcasterInterface_JCalls {
2423 atomic_size_t refcnt;
2426 jmethodID broadcast_transaction_meth;
2427 } LDKBroadcasterInterface_JCalls;
2428 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2429 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2431 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2432 LDKTransaction *tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
2434 long tx_ref = (long)tx_copy;
2435 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2437 return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2439 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2440 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2441 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2443 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2444 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2448 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2449 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2450 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2451 return (void*) this_arg;
2453 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2454 jclass c = (*env)->GetObjectClass(env, o);
2456 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2457 atomic_init(&calls->refcnt, 1);
2458 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2459 calls->o = (*env)->NewWeakGlobalRef(env, o);
2460 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2461 CHECK(calls->broadcast_transaction_meth != NULL);
2463 LDKBroadcasterInterface ret = {
2464 .this_arg = (void*) calls,
2465 .broadcast_transaction = broadcast_transaction_jcall,
2466 .free = LDKBroadcasterInterface_JCalls_free,
2470 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2471 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2472 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2473 return (long)res_ptr;
2475 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2476 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2481 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2482 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2483 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv);
2486 typedef struct LDKFeeEstimator_JCalls {
2487 atomic_size_t refcnt;
2490 jmethodID get_est_sat_per_1000_weight_meth;
2491 } LDKFeeEstimator_JCalls;
2492 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2493 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2495 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2496 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target);
2497 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2499 return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2501 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2502 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2503 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2505 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2506 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2510 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2511 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2512 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2513 return (void*) this_arg;
2515 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2516 jclass c = (*env)->GetObjectClass(env, o);
2518 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2519 atomic_init(&calls->refcnt, 1);
2520 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2521 calls->o = (*env)->NewWeakGlobalRef(env, o);
2522 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2523 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2525 LDKFeeEstimator ret = {
2526 .this_arg = (void*) calls,
2527 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2528 .free = LDKFeeEstimator_JCalls_free,
2532 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2533 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2534 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2535 return (long)res_ptr;
2537 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2538 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2542 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) {
2543 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2544 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2545 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2549 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2550 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2551 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2553 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2554 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2555 ret->datalen = (*env)->GetArrayLength(env, elems);
2556 if (ret->datalen == 0) {
2559 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2560 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2561 for (size_t i = 0; i < ret->datalen; i++) {
2562 jlong arr_elem = java_elems[i];
2563 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2564 FREE((void*)arr_elem);
2565 ret->data[i] = arr_elem_conv;
2567 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2571 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2572 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2573 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2575 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2576 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2577 ret->datalen = (*env)->GetArrayLength(env, elems);
2578 if (ret->datalen == 0) {
2581 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2582 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2583 for (size_t i = 0; i < ret->datalen; i++) {
2584 jlong arr_elem = java_elems[i];
2585 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2586 ret->data[i] = arr_elem_conv;
2588 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2592 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2593 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2594 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2596 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2597 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2598 ret->datalen = (*env)->GetArrayLength(env, elems);
2599 if (ret->datalen == 0) {
2602 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2603 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2604 for (size_t i = 0; i < ret->datalen; i++) {
2605 jlong arr_elem = java_elems[i];
2606 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2607 FREE((void*)arr_elem);
2608 ret->data[i] = arr_elem_conv;
2610 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2614 typedef struct LDKKeysInterface_JCalls {
2615 atomic_size_t refcnt;
2618 jmethodID get_node_secret_meth;
2619 jmethodID get_destination_script_meth;
2620 jmethodID get_shutdown_pubkey_meth;
2621 jmethodID get_channel_keys_meth;
2622 jmethodID get_secure_random_bytes_meth;
2623 } LDKKeysInterface_JCalls;
2624 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2625 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2627 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2628 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2630 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth);
2631 LDKSecretKey ret_ref;
2632 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
2633 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.bytes);
2636 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2637 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2639 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2640 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2642 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_destination_script_meth);
2643 LDKCVec_u8Z ret_ref;
2644 ret_ref.data = (*_env)->GetByteArrayElements (_env, ret, NULL);
2645 ret_ref.datalen = (*_env)->GetArrayLength (_env, ret);
2648 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2649 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2651 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2652 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2654 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_shutdown_pubkey_meth);
2655 LDKPublicKey ret_ref;
2656 CHECK((*_env)->GetArrayLength (_env, ret) == 33);
2657 (*_env)->GetByteArrayRegion (_env, ret, 0, 33, ret_ref.compressed_form);
2660 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2661 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2663 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2664 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2666 LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2667 LDKChannelKeys res = *ret;
2671 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
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 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth);
2678 LDKThirtyTwoBytes ret_ref;
2679 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
2680 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.data);
2683 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2684 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2685 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2687 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2688 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2692 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2693 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2694 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2695 return (void*) this_arg;
2697 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2698 jclass c = (*env)->GetObjectClass(env, o);
2700 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2701 atomic_init(&calls->refcnt, 1);
2702 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2703 calls->o = (*env)->NewWeakGlobalRef(env, o);
2704 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2705 CHECK(calls->get_node_secret_meth != NULL);
2706 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2707 CHECK(calls->get_destination_script_meth != NULL);
2708 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2709 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2710 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2711 CHECK(calls->get_channel_keys_meth != NULL);
2712 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2713 CHECK(calls->get_secure_random_bytes_meth != NULL);
2715 LDKKeysInterface ret = {
2716 .this_arg = (void*) calls,
2717 .get_node_secret = get_node_secret_jcall,
2718 .get_destination_script = get_destination_script_jcall,
2719 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2720 .get_channel_keys = get_channel_keys_jcall,
2721 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2722 .free = LDKKeysInterface_JCalls_free,
2726 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2727 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2728 *res_ptr = LDKKeysInterface_init(env, _a, o);
2729 return (long)res_ptr;
2731 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2732 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2736 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2737 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2738 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2739 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2743 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2744 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2745 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2746 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2747 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2748 CVec_u8Z_free(arg_var);
2752 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2753 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2754 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2755 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2759 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) {
2760 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2761 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2762 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2766 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2767 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2768 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2769 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2773 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2774 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2775 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2776 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2777 for (size_t i = 0; i < vec->datalen; i++) {
2778 CHECK((((long)vec->data[i].inner) & 1) == 0);
2779 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2781 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2784 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2785 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2786 ret->datalen = (*env)->GetArrayLength(env, elems);
2787 if (ret->datalen == 0) {
2790 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2791 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2792 for (size_t i = 0; i < ret->datalen; i++) {
2793 jlong arr_elem = java_elems[i];
2794 LDKChannelDetails arr_elem_conv;
2795 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2796 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2797 if (arr_elem_conv.inner != NULL)
2798 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2799 ret->data[i] = arr_elem_conv;
2801 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2805 static jclass LDKNetAddress_IPv4_class = NULL;
2806 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2807 static jclass LDKNetAddress_IPv6_class = NULL;
2808 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2809 static jclass LDKNetAddress_OnionV2_class = NULL;
2810 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2811 static jclass LDKNetAddress_OnionV3_class = NULL;
2812 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2814 LDKNetAddress_IPv4_class =
2815 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2816 CHECK(LDKNetAddress_IPv4_class != NULL);
2817 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2818 CHECK(LDKNetAddress_IPv4_meth != NULL);
2819 LDKNetAddress_IPv6_class =
2820 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2821 CHECK(LDKNetAddress_IPv6_class != NULL);
2822 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2823 CHECK(LDKNetAddress_IPv6_meth != NULL);
2824 LDKNetAddress_OnionV2_class =
2825 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2826 CHECK(LDKNetAddress_OnionV2_class != NULL);
2827 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2828 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2829 LDKNetAddress_OnionV3_class =
2830 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2831 CHECK(LDKNetAddress_OnionV3_class != NULL);
2832 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2833 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2835 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
2836 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2838 case LDKNetAddress_IPv4: {
2839 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 4);
2840 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 4, obj->i_pv4.addr.data);
2841 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
2843 case LDKNetAddress_IPv6: {
2844 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 16);
2845 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 16, obj->i_pv6.addr.data);
2846 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
2848 case LDKNetAddress_OnionV2: {
2849 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 10);
2850 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 10, obj->onion_v2.addr.data);
2851 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
2853 case LDKNetAddress_OnionV3: {
2854 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
2855 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2856 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);
2861 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2862 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2863 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2865 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2866 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2867 ret->datalen = (*env)->GetArrayLength(env, elems);
2868 if (ret->datalen == 0) {
2871 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2872 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2873 for (size_t i = 0; i < ret->datalen; i++) {
2874 jlong arr_elem = java_elems[i];
2875 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2876 FREE((void*)arr_elem);
2877 ret->data[i] = arr_elem_conv;
2879 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2883 typedef struct LDKChannelMessageHandler_JCalls {
2884 atomic_size_t refcnt;
2887 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2888 jmethodID handle_open_channel_meth;
2889 jmethodID handle_accept_channel_meth;
2890 jmethodID handle_funding_created_meth;
2891 jmethodID handle_funding_signed_meth;
2892 jmethodID handle_funding_locked_meth;
2893 jmethodID handle_shutdown_meth;
2894 jmethodID handle_closing_signed_meth;
2895 jmethodID handle_update_add_htlc_meth;
2896 jmethodID handle_update_fulfill_htlc_meth;
2897 jmethodID handle_update_fail_htlc_meth;
2898 jmethodID handle_update_fail_malformed_htlc_meth;
2899 jmethodID handle_commitment_signed_meth;
2900 jmethodID handle_revoke_and_ack_meth;
2901 jmethodID handle_update_fee_meth;
2902 jmethodID handle_announcement_signatures_meth;
2903 jmethodID peer_disconnected_meth;
2904 jmethodID peer_connected_meth;
2905 jmethodID handle_channel_reestablish_meth;
2906 jmethodID handle_error_meth;
2907 } LDKChannelMessageHandler_JCalls;
2908 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
2909 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2911 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2912 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2913 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2914 LDKInitFeatures their_features_var = their_features;
2915 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2916 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2917 long their_features_ref;
2918 if (their_features_var.is_owned) {
2919 their_features_ref = (long)their_features_var.inner | 1;
2921 their_features_ref = (long)their_features_var.inner & ~1;
2923 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2925 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg);
2927 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
2928 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2930 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2931 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2932 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2933 LDKInitFeatures their_features_var = their_features;
2934 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2935 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2936 long their_features_ref;
2937 if (their_features_var.is_owned) {
2938 their_features_ref = (long)their_features_var.inner | 1;
2940 their_features_ref = (long)their_features_var.inner & ~1;
2942 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2944 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg);
2946 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
2947 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2949 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2950 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2951 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2952 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2954 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg);
2956 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
2957 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2959 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2960 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2961 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2962 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2964 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg);
2966 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
2967 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2969 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2970 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2971 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2972 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2974 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg);
2976 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
2977 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2979 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2980 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2981 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2982 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2984 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg);
2986 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
2987 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2989 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2990 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2991 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2992 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2994 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg);
2996 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
2997 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2999 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3000 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3001 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3002 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3004 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg);
3006 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
3007 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3009 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3010 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3011 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3012 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3014 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg);
3016 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
3017 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3019 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3020 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3021 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3022 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3024 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg);
3026 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
3027 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3029 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3030 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3031 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3032 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3034 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg);
3036 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
3037 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3039 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3040 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3041 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3042 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3044 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg);
3046 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *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 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3054 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg);
3056 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
3057 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3059 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3060 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3061 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3062 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3064 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg);
3066 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
3067 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3069 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3070 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3071 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3072 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3074 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg);
3076 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3077 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3079 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3080 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3081 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3082 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3084 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
3086 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
3087 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3089 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3090 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3091 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3092 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3094 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg);
3096 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3097 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3099 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3100 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3101 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3102 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3104 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg);
3106 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
3107 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3109 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3110 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3111 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3112 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3114 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, msg);
3116 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3117 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3118 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3120 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3121 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3125 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3126 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3127 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3128 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3129 return (void*) this_arg;
3131 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3132 jclass c = (*env)->GetObjectClass(env, o);
3134 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3135 atomic_init(&calls->refcnt, 1);
3136 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3137 calls->o = (*env)->NewWeakGlobalRef(env, o);
3138 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3139 CHECK(calls->handle_open_channel_meth != NULL);
3140 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3141 CHECK(calls->handle_accept_channel_meth != NULL);
3142 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3143 CHECK(calls->handle_funding_created_meth != NULL);
3144 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3145 CHECK(calls->handle_funding_signed_meth != NULL);
3146 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3147 CHECK(calls->handle_funding_locked_meth != NULL);
3148 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3149 CHECK(calls->handle_shutdown_meth != NULL);
3150 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3151 CHECK(calls->handle_closing_signed_meth != NULL);
3152 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3153 CHECK(calls->handle_update_add_htlc_meth != NULL);
3154 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3155 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3156 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3157 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3158 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3159 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3160 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3161 CHECK(calls->handle_commitment_signed_meth != NULL);
3162 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3163 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3164 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3165 CHECK(calls->handle_update_fee_meth != NULL);
3166 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3167 CHECK(calls->handle_announcement_signatures_meth != NULL);
3168 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3169 CHECK(calls->peer_disconnected_meth != NULL);
3170 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3171 CHECK(calls->peer_connected_meth != NULL);
3172 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3173 CHECK(calls->handle_channel_reestablish_meth != NULL);
3174 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3175 CHECK(calls->handle_error_meth != NULL);
3177 LDKChannelMessageHandler ret = {
3178 .this_arg = (void*) calls,
3179 .handle_open_channel = handle_open_channel_jcall,
3180 .handle_accept_channel = handle_accept_channel_jcall,
3181 .handle_funding_created = handle_funding_created_jcall,
3182 .handle_funding_signed = handle_funding_signed_jcall,
3183 .handle_funding_locked = handle_funding_locked_jcall,
3184 .handle_shutdown = handle_shutdown_jcall,
3185 .handle_closing_signed = handle_closing_signed_jcall,
3186 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3187 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3188 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3189 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3190 .handle_commitment_signed = handle_commitment_signed_jcall,
3191 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3192 .handle_update_fee = handle_update_fee_jcall,
3193 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3194 .peer_disconnected = peer_disconnected_jcall,
3195 .peer_connected = peer_connected_jcall,
3196 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3197 .handle_error = handle_error_jcall,
3198 .free = LDKChannelMessageHandler_JCalls_free,
3199 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3201 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3204 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3205 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3206 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3207 return (long)res_ptr;
3209 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3210 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3214 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) {
3215 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3216 LDKPublicKey their_node_id_ref;
3217 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3218 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3219 LDKInitFeatures their_features_conv;
3220 their_features_conv.inner = (void*)(their_features & (~1));
3221 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3222 // Warning: we may need a move here but can't clone!
3223 LDKOpenChannel msg_conv;
3224 msg_conv.inner = (void*)(msg & (~1));
3225 msg_conv.is_owned = (msg & 1) || (msg == 0);
3226 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3229 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) {
3230 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3231 LDKPublicKey their_node_id_ref;
3232 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3233 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3234 LDKInitFeatures their_features_conv;
3235 their_features_conv.inner = (void*)(their_features & (~1));
3236 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3237 // Warning: we may need a move here but can't clone!
3238 LDKAcceptChannel msg_conv;
3239 msg_conv.inner = (void*)(msg & (~1));
3240 msg_conv.is_owned = (msg & 1) || (msg == 0);
3241 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3244 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) {
3245 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3246 LDKPublicKey their_node_id_ref;
3247 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3248 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3249 LDKFundingCreated msg_conv;
3250 msg_conv.inner = (void*)(msg & (~1));
3251 msg_conv.is_owned = (msg & 1) || (msg == 0);
3252 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3255 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) {
3256 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3257 LDKPublicKey their_node_id_ref;
3258 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3259 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3260 LDKFundingSigned msg_conv;
3261 msg_conv.inner = (void*)(msg & (~1));
3262 msg_conv.is_owned = (msg & 1) || (msg == 0);
3263 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3266 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) {
3267 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3268 LDKPublicKey their_node_id_ref;
3269 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3270 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3271 LDKFundingLocked msg_conv;
3272 msg_conv.inner = (void*)(msg & (~1));
3273 msg_conv.is_owned = (msg & 1) || (msg == 0);
3274 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3278 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3279 LDKPublicKey their_node_id_ref;
3280 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3281 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3282 LDKShutdown msg_conv;
3283 msg_conv.inner = (void*)(msg & (~1));
3284 msg_conv.is_owned = (msg & 1) || (msg == 0);
3285 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3288 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) {
3289 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3290 LDKPublicKey their_node_id_ref;
3291 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3292 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3293 LDKClosingSigned msg_conv;
3294 msg_conv.inner = (void*)(msg & (~1));
3295 msg_conv.is_owned = (msg & 1) || (msg == 0);
3296 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3299 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) {
3300 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3301 LDKPublicKey their_node_id_ref;
3302 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3303 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3304 LDKUpdateAddHTLC msg_conv;
3305 msg_conv.inner = (void*)(msg & (~1));
3306 msg_conv.is_owned = (msg & 1) || (msg == 0);
3307 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3310 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) {
3311 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3312 LDKPublicKey their_node_id_ref;
3313 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3314 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3315 LDKUpdateFulfillHTLC msg_conv;
3316 msg_conv.inner = (void*)(msg & (~1));
3317 msg_conv.is_owned = (msg & 1) || (msg == 0);
3318 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3321 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) {
3322 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3323 LDKPublicKey their_node_id_ref;
3324 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3325 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3326 LDKUpdateFailHTLC msg_conv;
3327 msg_conv.inner = (void*)(msg & (~1));
3328 msg_conv.is_owned = (msg & 1) || (msg == 0);
3329 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3332 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) {
3333 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3334 LDKPublicKey their_node_id_ref;
3335 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3336 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3337 LDKUpdateFailMalformedHTLC msg_conv;
3338 msg_conv.inner = (void*)(msg & (~1));
3339 msg_conv.is_owned = (msg & 1) || (msg == 0);
3340 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3343 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) {
3344 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3345 LDKPublicKey their_node_id_ref;
3346 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3347 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3348 LDKCommitmentSigned msg_conv;
3349 msg_conv.inner = (void*)(msg & (~1));
3350 msg_conv.is_owned = (msg & 1) || (msg == 0);
3351 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3354 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) {
3355 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3356 LDKPublicKey their_node_id_ref;
3357 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3358 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3359 LDKRevokeAndACK msg_conv;
3360 msg_conv.inner = (void*)(msg & (~1));
3361 msg_conv.is_owned = (msg & 1) || (msg == 0);
3362 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3365 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) {
3366 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3367 LDKPublicKey their_node_id_ref;
3368 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3369 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3370 LDKUpdateFee msg_conv;
3371 msg_conv.inner = (void*)(msg & (~1));
3372 msg_conv.is_owned = (msg & 1) || (msg == 0);
3373 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3376 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) {
3377 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3378 LDKPublicKey their_node_id_ref;
3379 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3380 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3381 LDKAnnouncementSignatures msg_conv;
3382 msg_conv.inner = (void*)(msg & (~1));
3383 msg_conv.is_owned = (msg & 1) || (msg == 0);
3384 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3387 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) {
3388 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3389 LDKPublicKey their_node_id_ref;
3390 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3391 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3392 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3396 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3397 LDKPublicKey their_node_id_ref;
3398 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3399 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3401 msg_conv.inner = (void*)(msg & (~1));
3402 msg_conv.is_owned = (msg & 1) || (msg == 0);
3403 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3406 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) {
3407 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3408 LDKPublicKey their_node_id_ref;
3409 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3410 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3411 LDKChannelReestablish msg_conv;
3412 msg_conv.inner = (void*)(msg & (~1));
3413 msg_conv.is_owned = (msg & 1) || (msg == 0);
3414 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3418 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3419 LDKPublicKey their_node_id_ref;
3420 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3421 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3422 LDKErrorMessage msg_conv;
3423 msg_conv.inner = (void*)(msg & (~1));
3424 msg_conv.is_owned = (msg & 1) || (msg == 0);
3425 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3428 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3429 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3430 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3431 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3432 for (size_t i = 0; i < vec->datalen; i++) {
3433 CHECK((((long)vec->data[i].inner) & 1) == 0);
3434 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3436 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3439 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3440 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3441 ret->datalen = (*env)->GetArrayLength(env, elems);
3442 if (ret->datalen == 0) {
3445 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3446 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3447 for (size_t i = 0; i < ret->datalen; i++) {
3448 jlong arr_elem = java_elems[i];
3449 LDKChannelMonitor arr_elem_conv;
3450 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3451 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3452 // Warning: we may need a move here but can't clone!
3453 ret->data[i] = arr_elem_conv;
3455 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3459 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3460 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3461 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3463 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3464 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3465 ret->datalen = (*env)->GetArrayLength(env, elems);
3466 if (ret->datalen == 0) {
3469 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3470 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3471 for (size_t i = 0; i < ret->datalen; i++) {
3472 ret->data[i] = java_elems[i];
3474 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3478 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3479 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3480 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3481 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3482 for (size_t i = 0; i < vec->datalen; i++) {
3483 CHECK((((long)vec->data[i].inner) & 1) == 0);
3484 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3486 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3489 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3490 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3491 ret->datalen = (*env)->GetArrayLength(env, elems);
3492 if (ret->datalen == 0) {
3495 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3496 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3497 for (size_t i = 0; i < ret->datalen; i++) {
3498 jlong arr_elem = java_elems[i];
3499 LDKUpdateAddHTLC arr_elem_conv;
3500 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3501 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3502 if (arr_elem_conv.inner != NULL)
3503 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3504 ret->data[i] = arr_elem_conv;
3506 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3510 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3511 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3512 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3513 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3514 for (size_t i = 0; i < vec->datalen; i++) {
3515 CHECK((((long)vec->data[i].inner) & 1) == 0);
3516 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3518 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3521 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3522 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3523 ret->datalen = (*env)->GetArrayLength(env, elems);
3524 if (ret->datalen == 0) {
3527 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3528 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3529 for (size_t i = 0; i < ret->datalen; i++) {
3530 jlong arr_elem = java_elems[i];
3531 LDKUpdateFulfillHTLC arr_elem_conv;
3532 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3533 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3534 if (arr_elem_conv.inner != NULL)
3535 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3536 ret->data[i] = arr_elem_conv;
3538 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3542 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3543 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3544 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3545 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3546 for (size_t i = 0; i < vec->datalen; i++) {
3547 CHECK((((long)vec->data[i].inner) & 1) == 0);
3548 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3550 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3553 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3554 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3555 ret->datalen = (*env)->GetArrayLength(env, elems);
3556 if (ret->datalen == 0) {
3559 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3560 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3561 for (size_t i = 0; i < ret->datalen; i++) {
3562 jlong arr_elem = java_elems[i];
3563 LDKUpdateFailHTLC arr_elem_conv;
3564 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3565 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3566 if (arr_elem_conv.inner != NULL)
3567 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3568 ret->data[i] = arr_elem_conv;
3570 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3574 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3575 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3576 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3577 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3578 for (size_t i = 0; i < vec->datalen; i++) {
3579 CHECK((((long)vec->data[i].inner) & 1) == 0);
3580 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3582 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3585 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3586 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3587 ret->datalen = (*env)->GetArrayLength(env, elems);
3588 if (ret->datalen == 0) {
3591 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3592 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3593 for (size_t i = 0; i < ret->datalen; i++) {
3594 jlong arr_elem = java_elems[i];
3595 LDKUpdateFailMalformedHTLC arr_elem_conv;
3596 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3597 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3598 if (arr_elem_conv.inner != NULL)
3599 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3600 ret->data[i] = arr_elem_conv;
3602 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3607 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3609 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3610 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3611 CHECK(val->result_ok);
3612 return *val->contents.result;
3614 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3615 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3616 CHECK(!val->result_ok);
3617 LDKLightningError err_var = (*val->contents.err);
3618 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3619 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3620 long err_ref = (long)err_var.inner & ~1;
3623 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3624 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3625 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3627 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3628 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3629 ret->datalen = (*env)->GetArrayLength(env, elems);
3630 if (ret->datalen == 0) {
3633 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3634 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3635 for (size_t i = 0; i < ret->datalen; i++) {
3636 jlong arr_elem = java_elems[i];
3637 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3638 FREE((void*)arr_elem);
3639 ret->data[i] = arr_elem_conv;
3641 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3645 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3646 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3647 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3648 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3649 for (size_t i = 0; i < vec->datalen; i++) {
3650 CHECK((((long)vec->data[i].inner) & 1) == 0);
3651 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3653 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3656 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3657 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3658 ret->datalen = (*env)->GetArrayLength(env, elems);
3659 if (ret->datalen == 0) {
3662 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3663 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3664 for (size_t i = 0; i < ret->datalen; i++) {
3665 jlong arr_elem = java_elems[i];
3666 LDKNodeAnnouncement arr_elem_conv;
3667 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3668 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3669 if (arr_elem_conv.inner != NULL)
3670 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3671 ret->data[i] = arr_elem_conv;
3673 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3677 typedef struct LDKRoutingMessageHandler_JCalls {
3678 atomic_size_t refcnt;
3681 jmethodID handle_node_announcement_meth;
3682 jmethodID handle_channel_announcement_meth;
3683 jmethodID handle_channel_update_meth;
3684 jmethodID handle_htlc_fail_channel_update_meth;
3685 jmethodID get_next_channel_announcements_meth;
3686 jmethodID get_next_node_announcements_meth;
3687 jmethodID should_request_full_sync_meth;
3688 } LDKRoutingMessageHandler_JCalls;
3689 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3690 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3692 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3693 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3695 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, msg);
3696 LDKCResult_boolLightningErrorZ res = *ret;
3700 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3701 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3703 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3704 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3706 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, msg);
3707 LDKCResult_boolLightningErrorZ res = *ret;
3711 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3712 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3714 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3715 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3717 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, msg);
3718 LDKCResult_boolLightningErrorZ res = *ret;
3722 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3723 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3725 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3726 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3728 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, update);
3730 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3731 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3733 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3734 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3736 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3737 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
3738 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
3739 if (ret_constr.datalen > 0)
3740 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
3742 ret_constr.data = NULL;
3743 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
3744 for (size_t l = 0; l < ret_constr.datalen; l++) {
3745 long arr_conv_63 = ret_vals[l];
3746 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
3747 FREE((void*)arr_conv_63);
3748 ret_constr.data[l] = arr_conv_63_conv;
3750 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
3753 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
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 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
3758 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
3759 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3761 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3762 LDKCVec_NodeAnnouncementZ ret_constr;
3763 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
3764 if (ret_constr.datalen > 0)
3765 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
3767 ret_constr.data = NULL;
3768 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
3769 for (size_t s = 0; s < ret_constr.datalen; s++) {
3770 long arr_conv_18 = ret_vals[s];
3771 LDKNodeAnnouncement arr_conv_18_conv;
3772 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
3773 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
3774 if (arr_conv_18_conv.inner != NULL)
3775 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
3776 ret_constr.data[s] = arr_conv_18_conv;
3778 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
3781 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3782 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3784 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3785 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
3786 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form);
3787 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3789 return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3791 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3792 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3793 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3795 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3796 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3800 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3801 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3802 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3803 return (void*) this_arg;
3805 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3806 jclass c = (*env)->GetObjectClass(env, o);
3808 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3809 atomic_init(&calls->refcnt, 1);
3810 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3811 calls->o = (*env)->NewWeakGlobalRef(env, o);
3812 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3813 CHECK(calls->handle_node_announcement_meth != NULL);
3814 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3815 CHECK(calls->handle_channel_announcement_meth != NULL);
3816 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3817 CHECK(calls->handle_channel_update_meth != NULL);
3818 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3819 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
3820 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
3821 CHECK(calls->get_next_channel_announcements_meth != NULL);
3822 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
3823 CHECK(calls->get_next_node_announcements_meth != NULL);
3824 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3825 CHECK(calls->should_request_full_sync_meth != NULL);
3827 LDKRoutingMessageHandler ret = {
3828 .this_arg = (void*) calls,
3829 .handle_node_announcement = handle_node_announcement_jcall,
3830 .handle_channel_announcement = handle_channel_announcement_jcall,
3831 .handle_channel_update = handle_channel_update_jcall,
3832 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3833 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3834 .get_next_node_announcements = get_next_node_announcements_jcall,
3835 .should_request_full_sync = should_request_full_sync_jcall,
3836 .free = LDKRoutingMessageHandler_JCalls_free,
3840 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3841 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3842 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3843 return (long)res_ptr;
3845 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3846 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3850 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3851 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3852 LDKNodeAnnouncement msg_conv;
3853 msg_conv.inner = (void*)(msg & (~1));
3854 msg_conv.is_owned = (msg & 1) || (msg == 0);
3855 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3856 *ret = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
3860 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3861 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3862 LDKChannelAnnouncement msg_conv;
3863 msg_conv.inner = (void*)(msg & (~1));
3864 msg_conv.is_owned = (msg & 1) || (msg == 0);
3865 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3866 *ret = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3870 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3871 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3872 LDKChannelUpdate msg_conv;
3873 msg_conv.inner = (void*)(msg & (~1));
3874 msg_conv.is_owned = (msg & 1) || (msg == 0);
3875 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3876 *ret = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
3880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
3881 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3882 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3883 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
3886 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) {
3887 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3888 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
3889 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
3890 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
3891 for (size_t l = 0; l < ret_var.datalen; l++) {
3892 /*XXX False */long arr_conv_63_ref = (long)&ret_var.data[l];
3893 ret_arr_ptr[l] = arr_conv_63_ref;
3895 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
3896 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(ret_var);
3900 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) {
3901 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3902 LDKPublicKey starting_point_ref;
3903 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
3904 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
3905 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
3906 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
3907 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
3908 for (size_t s = 0; s < ret_var.datalen; s++) {
3909 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
3910 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3911 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3912 long arr_conv_18_ref;
3913 if (arr_conv_18_var.is_owned) {
3914 arr_conv_18_ref = (long)arr_conv_18_var.inner | 1;
3916 arr_conv_18_ref = (long)arr_conv_18_var.inner & ~1;
3918 ret_arr_ptr[s] = arr_conv_18_ref;
3920 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
3925 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
3926 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3927 LDKPublicKey node_id_ref;
3928 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
3929 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
3930 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
3934 typedef struct LDKSocketDescriptor_JCalls {
3935 atomic_size_t refcnt;
3938 jmethodID send_data_meth;
3939 jmethodID disconnect_socket_meth;
3941 jmethodID hash_meth;
3942 } LDKSocketDescriptor_JCalls;
3943 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
3944 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3946 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3947 LDKu8slice data_var = data;
3948 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
3949 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
3950 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3952 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
3954 void disconnect_socket_jcall(void* this_arg) {
3955 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3957 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3958 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3960 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
3962 bool eq_jcall(const void* this_arg, const void *other_arg) {
3963 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3965 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3966 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3968 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, other_arg);
3970 uint64_t hash_jcall(const void* this_arg) {
3971 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3973 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3974 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3976 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
3978 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
3979 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3980 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3982 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3983 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3987 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
3988 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3989 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3990 return (void*) this_arg;
3992 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
3993 jclass c = (*env)->GetObjectClass(env, o);
3995 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
3996 atomic_init(&calls->refcnt, 1);
3997 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3998 calls->o = (*env)->NewWeakGlobalRef(env, o);
3999 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
4000 CHECK(calls->send_data_meth != NULL);
4001 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
4002 CHECK(calls->disconnect_socket_meth != NULL);
4003 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
4004 CHECK(calls->eq_meth != NULL);
4005 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
4006 CHECK(calls->hash_meth != NULL);
4008 LDKSocketDescriptor ret = {
4009 .this_arg = (void*) calls,
4010 .send_data = send_data_jcall,
4011 .disconnect_socket = disconnect_socket_jcall,
4014 .clone = LDKSocketDescriptor_JCalls_clone,
4015 .free = LDKSocketDescriptor_JCalls_free,
4019 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
4020 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4021 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
4022 return (long)res_ptr;
4024 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4025 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
4029 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
4030 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4031 LDKu8slice data_ref;
4032 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
4033 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
4034 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4035 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
4039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
4040 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4041 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4044 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
4045 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4046 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4050 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4051 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
4052 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
4054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4055 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4057 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4058 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4059 CHECK(val->result_ok);
4060 LDKCVecTempl_u8 res_var = (*val->contents.result);
4061 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
4062 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
4065 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4066 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4067 CHECK(!val->result_ok);
4068 LDKPeerHandleError err_var = (*val->contents.err);
4069 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4070 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4071 long err_ref = (long)err_var.inner & ~1;
4074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4075 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4077 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4078 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4079 CHECK(val->result_ok);
4080 return *val->contents.result;
4082 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4083 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4084 CHECK(!val->result_ok);
4085 LDKPeerHandleError err_var = (*val->contents.err);
4086 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4087 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4088 long err_ref = (long)err_var.inner & ~1;
4091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4092 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
4094 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4095 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4096 CHECK(val->result_ok);
4097 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
4098 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
4101 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4102 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4103 CHECK(!val->result_ok);
4104 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4108 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
4110 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4111 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4112 CHECK(val->result_ok);
4113 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
4114 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
4117 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4118 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4119 CHECK(!val->result_ok);
4120 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4124 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
4126 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4127 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4128 CHECK(val->result_ok);
4129 LDKTxCreationKeys res_var = (*val->contents.result);
4130 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4131 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4132 long res_ref = (long)res_var.inner & ~1;
4135 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4136 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4137 CHECK(!val->result_ok);
4138 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4141 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4142 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4143 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4145 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4146 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4147 ret->datalen = (*env)->GetArrayLength(env, elems);
4148 if (ret->datalen == 0) {
4151 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4152 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4153 for (size_t i = 0; i < ret->datalen; i++) {
4154 jlong arr_elem = java_elems[i];
4155 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4156 FREE((void*)arr_elem);
4157 ret->data[i] = arr_elem_conv;
4159 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4163 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4164 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4165 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4166 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4167 for (size_t i = 0; i < vec->datalen; i++) {
4168 CHECK((((long)vec->data[i].inner) & 1) == 0);
4169 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4171 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4174 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4175 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4176 ret->datalen = (*env)->GetArrayLength(env, elems);
4177 if (ret->datalen == 0) {
4180 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4181 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4182 for (size_t i = 0; i < ret->datalen; i++) {
4183 jlong arr_elem = java_elems[i];
4184 LDKRouteHop arr_elem_conv;
4185 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4186 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4187 if (arr_elem_conv.inner != NULL)
4188 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4189 ret->data[i] = arr_elem_conv;
4191 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4195 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4196 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4197 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4199 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4200 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4202 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4203 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4204 CHECK(val->result_ok);
4205 LDKRoute res_var = (*val->contents.result);
4206 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4207 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4208 long res_ref = (long)res_var.inner & ~1;
4211 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4212 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4213 CHECK(!val->result_ok);
4214 LDKLightningError err_var = (*val->contents.err);
4215 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4216 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4217 long err_ref = (long)err_var.inner & ~1;
4220 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4221 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4222 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4223 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4224 for (size_t i = 0; i < vec->datalen; i++) {
4225 CHECK((((long)vec->data[i].inner) & 1) == 0);
4226 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4228 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4231 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4232 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4233 ret->datalen = (*env)->GetArrayLength(env, elems);
4234 if (ret->datalen == 0) {
4237 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4238 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4239 for (size_t i = 0; i < ret->datalen; i++) {
4240 jlong arr_elem = java_elems[i];
4241 LDKRouteHint arr_elem_conv;
4242 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4243 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4244 if (arr_elem_conv.inner != NULL)
4245 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4246 ret->data[i] = arr_elem_conv;
4248 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4253 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4255 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4259 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4261 C2Tuple_OutPointScriptZ_free(arg_conv);
4264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4265 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4267 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4271 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4273 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4277 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4279 C2Tuple_u64u64Z_free(arg_conv);
4282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4283 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4285 C2Tuple_usizeTransactionZ_free(arg_conv);
4288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4289 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4291 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4295 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4297 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4300 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4301 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4303 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4304 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4309 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4311 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4314 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray arg) {
4315 LDKCVec_SignatureZ arg_constr;
4316 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4317 if (arg_constr.datalen > 0)
4318 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4320 arg_constr.data = NULL;
4321 for (size_t i = 0; i < arg_constr.datalen; i++) {
4322 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4323 LDKSignature arr_conv_8_ref;
4324 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4325 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4326 arg_constr.data[i] = arr_conv_8_ref;
4328 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4329 *ret = CResult_CVec_SignatureZNoneZ_ok(arg_constr);
4333 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4334 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4336 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4337 *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4342 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4344 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4347 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4348 LDKCVec_u8Z arg_ref;
4349 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
4350 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4351 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4352 *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4353 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
4357 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4358 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4360 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4361 *ret = CResult_NoneAPIErrorZ_err(arg_conv);
4365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4366 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4368 CResult_NoneAPIErrorZ_free(arg_conv);
4371 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4372 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4374 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4375 *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4380 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4382 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4385 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4386 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4388 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4389 *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4394 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4396 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4399 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4400 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4402 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4403 *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
4407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4408 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4410 CResult_NonePaymentSendFailureZ_free(arg_conv);
4413 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4414 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4416 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4417 *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
4421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4422 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4424 CResult_NonePeerHandleErrorZ_free(arg_conv);
4427 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4428 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4430 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4431 *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
4435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4436 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4438 CResult_PublicKeySecpErrorZ_free(arg_conv);
4441 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4442 LDKPublicKey arg_ref;
4443 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4444 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4445 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4446 *ret = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4450 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4451 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4453 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4454 *ret = CResult_RouteLightningErrorZ_err(arg_conv);
4458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4459 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4461 CResult_RouteLightningErrorZ_free(arg_conv);
4464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4465 LDKRoute arg_conv = *(LDKRoute*)arg;
4467 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4468 *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
4472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4473 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4475 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4476 *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
4480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4481 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4483 CResult_SecretKeySecpErrorZ_free(arg_conv);
4486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4487 LDKSecretKey arg_ref;
4488 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4489 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4490 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4491 *ret = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4496 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4498 CResult_SignatureNoneZ_free(arg_conv);
4501 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4502 LDKSignature arg_ref;
4503 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4504 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4505 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4506 *ret = CResult_SignatureNoneZ_ok(arg_ref);
4510 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4511 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4513 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4514 *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4519 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4521 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4524 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4525 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4527 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4528 *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4533 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4535 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4536 *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
4540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4541 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4543 CResult_TxOutAccessErrorZ_free(arg_conv);
4546 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4547 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4549 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4550 *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
4554 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4555 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4557 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4558 *ret = CResult_boolLightningErrorZ_err(arg_conv);
4562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4563 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4565 CResult_boolLightningErrorZ_free(arg_conv);
4568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4569 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4570 *ret = CResult_boolLightningErrorZ_ok(arg);
4574 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4575 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4577 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4578 *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
4582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4583 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4585 CResult_boolPeerHandleErrorZ_free(arg_conv);
4588 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4589 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4590 *ret = CResult_boolPeerHandleErrorZ_ok(arg);
4594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4595 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_constr;
4596 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4597 if (arg_constr.datalen > 0)
4598 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
4600 arg_constr.data = NULL;
4601 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4602 for (size_t q = 0; q < arg_constr.datalen; q++) {
4603 long arr_conv_42 = arg_vals[q];
4604 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
4605 FREE((void*)arr_conv_42);
4606 arg_constr.data[q] = arr_conv_42_conv;
4608 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4609 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_constr);
4612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4613 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_constr;
4614 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4615 if (arg_constr.datalen > 0)
4616 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ Elements");
4618 arg_constr.data = NULL;
4619 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4620 for (size_t b = 0; b < arg_constr.datalen; b++) {
4621 long arr_conv_27 = arg_vals[b];
4622 LDKC2Tuple_TxidCVec_TxOutZZ arr_conv_27_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arr_conv_27;
4623 FREE((void*)arr_conv_27);
4624 arg_constr.data[b] = arr_conv_27_conv;
4626 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4627 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_constr);
4630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4631 LDKCVec_C2Tuple_usizeTransactionZZ arg_constr;
4632 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4633 if (arg_constr.datalen > 0)
4634 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
4636 arg_constr.data = NULL;
4637 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4638 for (size_t d = 0; d < arg_constr.datalen; d++) {
4639 long arr_conv_29 = arg_vals[d];
4640 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
4641 FREE((void*)arr_conv_29);
4642 arg_constr.data[d] = arr_conv_29_conv;
4644 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4645 CVec_C2Tuple_usizeTransactionZZ_free(arg_constr);
4648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4649 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4650 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4651 if (arg_constr.datalen > 0)
4652 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4654 arg_constr.data = NULL;
4655 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4656 for (size_t l = 0; l < arg_constr.datalen; l++) {
4657 long arr_conv_63 = arg_vals[l];
4658 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4659 FREE((void*)arr_conv_63);
4660 arg_constr.data[l] = arr_conv_63_conv;
4662 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4663 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_constr);
4666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4667 LDKCVec_CVec_RouteHopZZ arg_constr;
4668 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4669 if (arg_constr.datalen > 0)
4670 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
4672 arg_constr.data = NULL;
4673 for (size_t m = 0; m < arg_constr.datalen; m++) {
4674 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, arg, m);
4675 LDKCVec_RouteHopZ arr_conv_12_constr;
4676 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
4677 if (arr_conv_12_constr.datalen > 0)
4678 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4680 arr_conv_12_constr.data = NULL;
4681 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
4682 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
4683 long arr_conv_10 = arr_conv_12_vals[k];
4684 LDKRouteHop arr_conv_10_conv;
4685 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4686 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4687 arr_conv_12_constr.data[k] = arr_conv_10_conv;
4689 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
4690 arg_constr.data[m] = arr_conv_12_constr;
4692 CVec_CVec_RouteHopZZ_free(arg_constr);
4695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4696 LDKCVec_ChannelDetailsZ arg_constr;
4697 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4698 if (arg_constr.datalen > 0)
4699 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
4701 arg_constr.data = NULL;
4702 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4703 for (size_t q = 0; q < arg_constr.datalen; q++) {
4704 long arr_conv_16 = arg_vals[q];
4705 LDKChannelDetails arr_conv_16_conv;
4706 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4707 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4708 arg_constr.data[q] = arr_conv_16_conv;
4710 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4711 CVec_ChannelDetailsZ_free(arg_constr);
4714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4715 LDKCVec_ChannelMonitorZ arg_constr;
4716 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4717 if (arg_constr.datalen > 0)
4718 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
4720 arg_constr.data = NULL;
4721 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4722 for (size_t q = 0; q < arg_constr.datalen; q++) {
4723 long arr_conv_16 = arg_vals[q];
4724 LDKChannelMonitor arr_conv_16_conv;
4725 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4726 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4727 arg_constr.data[q] = arr_conv_16_conv;
4729 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4730 CVec_ChannelMonitorZ_free(arg_constr);
4733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4734 LDKCVec_EventZ arg_constr;
4735 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4736 if (arg_constr.datalen > 0)
4737 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4739 arg_constr.data = NULL;
4740 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4741 for (size_t h = 0; h < arg_constr.datalen; h++) {
4742 long arr_conv_7 = arg_vals[h];
4743 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
4744 FREE((void*)arr_conv_7);
4745 arg_constr.data[h] = arr_conv_7_conv;
4747 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4748 CVec_EventZ_free(arg_constr);
4751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4752 LDKCVec_HTLCOutputInCommitmentZ arg_constr;
4753 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4754 if (arg_constr.datalen > 0)
4755 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
4757 arg_constr.data = NULL;
4758 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4759 for (size_t y = 0; y < arg_constr.datalen; y++) {
4760 long arr_conv_24 = arg_vals[y];
4761 LDKHTLCOutputInCommitment arr_conv_24_conv;
4762 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
4763 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
4764 arg_constr.data[y] = arr_conv_24_conv;
4766 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4767 CVec_HTLCOutputInCommitmentZ_free(arg_constr);
4770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4771 LDKCVec_MessageSendEventZ arg_constr;
4772 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4773 if (arg_constr.datalen > 0)
4774 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4776 arg_constr.data = NULL;
4777 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4778 for (size_t s = 0; s < arg_constr.datalen; s++) {
4779 long arr_conv_18 = arg_vals[s];
4780 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
4781 FREE((void*)arr_conv_18);
4782 arg_constr.data[s] = arr_conv_18_conv;
4784 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4785 CVec_MessageSendEventZ_free(arg_constr);
4788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4789 LDKCVec_MonitorEventZ arg_constr;
4790 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4791 if (arg_constr.datalen > 0)
4792 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
4794 arg_constr.data = NULL;
4795 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4796 for (size_t o = 0; o < arg_constr.datalen; o++) {
4797 long arr_conv_14 = arg_vals[o];
4798 LDKMonitorEvent arr_conv_14_conv;
4799 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
4800 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
4801 arg_constr.data[o] = arr_conv_14_conv;
4803 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4804 CVec_MonitorEventZ_free(arg_constr);
4807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4808 LDKCVec_NetAddressZ arg_constr;
4809 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4810 if (arg_constr.datalen > 0)
4811 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
4813 arg_constr.data = NULL;
4814 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4815 for (size_t m = 0; m < arg_constr.datalen; m++) {
4816 long arr_conv_12 = arg_vals[m];
4817 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
4818 FREE((void*)arr_conv_12);
4819 arg_constr.data[m] = arr_conv_12_conv;
4821 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4822 CVec_NetAddressZ_free(arg_constr);
4825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4826 LDKCVec_NodeAnnouncementZ arg_constr;
4827 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4828 if (arg_constr.datalen > 0)
4829 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4831 arg_constr.data = NULL;
4832 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4833 for (size_t s = 0; s < arg_constr.datalen; s++) {
4834 long arr_conv_18 = arg_vals[s];
4835 LDKNodeAnnouncement arr_conv_18_conv;
4836 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4837 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4838 arg_constr.data[s] = arr_conv_18_conv;
4840 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4841 CVec_NodeAnnouncementZ_free(arg_constr);
4844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4845 LDKCVec_PublicKeyZ arg_constr;
4846 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4847 if (arg_constr.datalen > 0)
4848 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
4850 arg_constr.data = NULL;
4851 for (size_t i = 0; i < arg_constr.datalen; i++) {
4852 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4853 LDKPublicKey arr_conv_8_ref;
4854 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
4855 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
4856 arg_constr.data[i] = arr_conv_8_ref;
4858 CVec_PublicKeyZ_free(arg_constr);
4861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4862 LDKCVec_RouteHintZ arg_constr;
4863 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4864 if (arg_constr.datalen > 0)
4865 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
4867 arg_constr.data = NULL;
4868 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4869 for (size_t l = 0; l < arg_constr.datalen; l++) {
4870 long arr_conv_11 = arg_vals[l];
4871 LDKRouteHint arr_conv_11_conv;
4872 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
4873 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
4874 arg_constr.data[l] = arr_conv_11_conv;
4876 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4877 CVec_RouteHintZ_free(arg_constr);
4880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4881 LDKCVec_RouteHopZ arg_constr;
4882 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4883 if (arg_constr.datalen > 0)
4884 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4886 arg_constr.data = NULL;
4887 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4888 for (size_t k = 0; k < arg_constr.datalen; k++) {
4889 long arr_conv_10 = arg_vals[k];
4890 LDKRouteHop arr_conv_10_conv;
4891 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4892 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4893 arg_constr.data[k] = arr_conv_10_conv;
4895 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4896 CVec_RouteHopZ_free(arg_constr);
4899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4900 LDKCVec_SignatureZ arg_constr;
4901 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4902 if (arg_constr.datalen > 0)
4903 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4905 arg_constr.data = NULL;
4906 for (size_t i = 0; i < arg_constr.datalen; i++) {
4907 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4908 LDKSignature arr_conv_8_ref;
4909 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4910 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4911 arg_constr.data[i] = arr_conv_8_ref;
4913 CVec_SignatureZ_free(arg_constr);
4916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4917 LDKCVec_SpendableOutputDescriptorZ arg_constr;
4918 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4919 if (arg_constr.datalen > 0)
4920 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
4922 arg_constr.data = NULL;
4923 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4924 for (size_t b = 0; b < arg_constr.datalen; b++) {
4925 long arr_conv_27 = arg_vals[b];
4926 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
4927 FREE((void*)arr_conv_27);
4928 arg_constr.data[b] = arr_conv_27_conv;
4930 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4931 CVec_SpendableOutputDescriptorZ_free(arg_constr);
4934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4935 LDKCVec_TransactionZ arg_constr;
4936 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4937 if (arg_constr.datalen > 0)
4938 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
4940 arg_constr.data = NULL;
4941 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4942 for (size_t n = 0; n < arg_constr.datalen; n++) {
4943 long arr_conv_13 = arg_vals[n];
4944 LDKTransaction arr_conv_13_conv = *(LDKTransaction*)arr_conv_13;
4945 arg_constr.data[n] = arr_conv_13_conv;
4947 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4948 CVec_TransactionZ_free(arg_constr);
4951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4952 LDKCVec_TxOutZ arg_constr;
4953 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4954 if (arg_constr.datalen > 0)
4955 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
4957 arg_constr.data = NULL;
4958 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4959 for (size_t h = 0; h < arg_constr.datalen; h++) {
4960 long arr_conv_7 = arg_vals[h];
4961 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
4962 FREE((void*)arr_conv_7);
4963 arg_constr.data[h] = arr_conv_7_conv;
4965 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4966 CVec_TxOutZ_free(arg_constr);
4969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4970 LDKCVec_UpdateAddHTLCZ arg_constr;
4971 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4972 if (arg_constr.datalen > 0)
4973 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
4975 arg_constr.data = NULL;
4976 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4977 for (size_t p = 0; p < arg_constr.datalen; p++) {
4978 long arr_conv_15 = arg_vals[p];
4979 LDKUpdateAddHTLC arr_conv_15_conv;
4980 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
4981 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
4982 arg_constr.data[p] = arr_conv_15_conv;
4984 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4985 CVec_UpdateAddHTLCZ_free(arg_constr);
4988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4989 LDKCVec_UpdateFailHTLCZ arg_constr;
4990 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4991 if (arg_constr.datalen > 0)
4992 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
4994 arg_constr.data = NULL;
4995 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4996 for (size_t q = 0; q < arg_constr.datalen; q++) {
4997 long arr_conv_16 = arg_vals[q];
4998 LDKUpdateFailHTLC arr_conv_16_conv;
4999 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5000 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5001 arg_constr.data[q] = arr_conv_16_conv;
5003 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5004 CVec_UpdateFailHTLCZ_free(arg_constr);
5007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5008 LDKCVec_UpdateFailMalformedHTLCZ arg_constr;
5009 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5010 if (arg_constr.datalen > 0)
5011 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
5013 arg_constr.data = NULL;
5014 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5015 for (size_t z = 0; z < arg_constr.datalen; z++) {
5016 long arr_conv_25 = arg_vals[z];
5017 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
5018 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
5019 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
5020 arg_constr.data[z] = arr_conv_25_conv;
5022 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5023 CVec_UpdateFailMalformedHTLCZ_free(arg_constr);
5026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5027 LDKCVec_UpdateFulfillHTLCZ arg_constr;
5028 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5029 if (arg_constr.datalen > 0)
5030 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
5032 arg_constr.data = NULL;
5033 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5034 for (size_t t = 0; t < arg_constr.datalen; t++) {
5035 long arr_conv_19 = arg_vals[t];
5036 LDKUpdateFulfillHTLC arr_conv_19_conv;
5037 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5038 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5039 arg_constr.data[t] = arr_conv_19_conv;
5041 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5042 CVec_UpdateFulfillHTLCZ_free(arg_constr);
5045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5046 LDKCVec_u64Z arg_constr;
5047 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5048 if (arg_constr.datalen > 0)
5049 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
5051 arg_constr.data = NULL;
5052 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5053 for (size_t g = 0; g < arg_constr.datalen; g++) {
5054 long arr_conv_6 = arg_vals[g];
5055 arg_constr.data[g] = arr_conv_6;
5057 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5058 CVec_u64Z_free(arg_constr);
5061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
5062 LDKCVec_u8Z arg_ref;
5063 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
5064 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
5065 CVec_u8Z_free(arg_ref);
5066 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
5069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
5070 LDKTransaction _res_conv = *(LDKTransaction*)_res;
5071 Transaction_free(_res_conv);
5074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5075 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5077 TxOut_free(_res_conv);
5080 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5081 LDKTransaction b_conv = *(LDKTransaction*)b;
5082 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5083 *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
5087 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5088 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5089 *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
5093 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5094 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5095 *ret = CResult_NoneMonitorUpdateErrorZ_ok();
5099 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5101 a_conv.inner = (void*)(a & (~1));
5102 a_conv.is_owned = (a & 1) || (a == 0);
5103 if (a_conv.inner != NULL)
5104 a_conv = OutPoint_clone(&a_conv);
5106 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
5107 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5108 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5109 *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5110 (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0);
5114 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5115 LDKThirtyTwoBytes a_ref;
5116 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5117 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5118 LDKCVec_TxOutZ b_constr;
5119 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5120 if (b_constr.datalen > 0)
5121 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5123 b_constr.data = NULL;
5124 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5125 for (size_t h = 0; h < b_constr.datalen; h++) {
5126 long arr_conv_7 = b_vals[h];
5127 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5128 FREE((void*)arr_conv_7);
5129 b_constr.data[h] = arr_conv_7_conv;
5131 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5132 LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
5133 *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_constr);
5137 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5138 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5139 *ret = C2Tuple_u64u64Z_new(a, b);
5143 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5145 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5146 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5147 LDKCVec_SignatureZ b_constr;
5148 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5149 if (b_constr.datalen > 0)
5150 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5152 b_constr.data = NULL;
5153 for (size_t i = 0; i < b_constr.datalen; i++) {
5154 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5155 LDKSignature arr_conv_8_ref;
5156 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5157 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5158 b_constr.data[i] = arr_conv_8_ref;
5160 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5161 *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5165 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
5166 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5167 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5171 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
5172 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5173 *ret = CResult_SignatureNoneZ_err();
5177 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
5178 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5179 *ret = CResult_CVec_SignatureZNoneZ_err();
5183 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
5184 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5185 *ret = CResult_NoneAPIErrorZ_ok();
5189 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
5190 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5191 *ret = CResult_NonePaymentSendFailureZ_ok();
5195 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
5196 LDKChannelAnnouncement a_conv;
5197 a_conv.inner = (void*)(a & (~1));
5198 a_conv.is_owned = (a & 1) || (a == 0);
5199 if (a_conv.inner != NULL)
5200 a_conv = ChannelAnnouncement_clone(&a_conv);
5201 LDKChannelUpdate b_conv;
5202 b_conv.inner = (void*)(b & (~1));
5203 b_conv.is_owned = (b & 1) || (b == 0);
5204 if (b_conv.inner != NULL)
5205 b_conv = ChannelUpdate_clone(&b_conv);
5206 LDKChannelUpdate c_conv;
5207 c_conv.inner = (void*)(c & (~1));
5208 c_conv.is_owned = (c & 1) || (c == 0);
5209 if (c_conv.inner != NULL)
5210 c_conv = ChannelUpdate_clone(&c_conv);
5211 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5212 *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5216 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
5217 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5218 *ret = CResult_NonePeerHandleErrorZ_ok();
5222 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5223 LDKHTLCOutputInCommitment a_conv;
5224 a_conv.inner = (void*)(a & (~1));
5225 a_conv.is_owned = (a & 1) || (a == 0);
5226 if (a_conv.inner != NULL)
5227 a_conv = HTLCOutputInCommitment_clone(&a_conv);
5229 CHECK((*_env)->GetArrayLength (_env, b) == 64);
5230 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
5231 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
5232 *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
5236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5237 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
5238 FREE((void*)this_ptr);
5239 Event_free(this_ptr_conv);
5242 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5243 LDKEvent* orig_conv = (LDKEvent*)orig;
5244 LDKEvent* ret = MALLOC(sizeof(LDKEvent), "LDKEvent");
5245 *ret = Event_clone(orig_conv);
5249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5250 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
5251 FREE((void*)this_ptr);
5252 MessageSendEvent_free(this_ptr_conv);
5255 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5256 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
5257 LDKMessageSendEvent* ret = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5258 *ret = MessageSendEvent_clone(orig_conv);
5262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5263 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
5264 FREE((void*)this_ptr);
5265 MessageSendEventsProvider_free(this_ptr_conv);
5268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5269 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
5270 FREE((void*)this_ptr);
5271 EventsProvider_free(this_ptr_conv);
5274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5275 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
5276 FREE((void*)this_ptr);
5277 APIError_free(this_ptr_conv);
5280 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5281 LDKAPIError* orig_conv = (LDKAPIError*)orig;
5282 LDKAPIError* ret = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5283 *ret = APIError_clone(orig_conv);
5287 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5288 LDKLevel* orig_conv = (LDKLevel*)orig;
5289 jclass ret = LDKLevel_to_java(_env, Level_clone(orig_conv));
5293 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
5294 jclass ret = LDKLevel_to_java(_env, Level_max());
5298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5299 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
5300 FREE((void*)this_ptr);
5301 Logger_free(this_ptr_conv);
5304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5305 LDKChannelHandshakeConfig this_ptr_conv;
5306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5308 ChannelHandshakeConfig_free(this_ptr_conv);
5311 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5312 LDKChannelHandshakeConfig orig_conv;
5313 orig_conv.inner = (void*)(orig & (~1));
5314 orig_conv.is_owned = (orig & 1) || (orig == 0);
5315 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_clone(&orig_conv);
5316 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5319 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5320 LDKChannelHandshakeConfig this_ptr_conv;
5321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5322 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5323 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
5327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5328 LDKChannelHandshakeConfig this_ptr_conv;
5329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5330 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5331 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
5334 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5335 LDKChannelHandshakeConfig this_ptr_conv;
5336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5337 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5338 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
5342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5343 LDKChannelHandshakeConfig this_ptr_conv;
5344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5345 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5346 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
5349 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5350 LDKChannelHandshakeConfig this_ptr_conv;
5351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5352 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5353 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
5357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5358 LDKChannelHandshakeConfig this_ptr_conv;
5359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5360 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5361 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
5364 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) {
5365 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
5366 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5369 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
5370 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_default();
5371 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5375 LDKChannelHandshakeLimits 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 ChannelHandshakeLimits_free(this_ptr_conv);
5381 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5382 LDKChannelHandshakeLimits orig_conv;
5383 orig_conv.inner = (void*)(orig & (~1));
5384 orig_conv.is_owned = (orig & 1) || (orig == 0);
5385 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_clone(&orig_conv);
5386 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5390 LDKChannelHandshakeLimits 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 = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
5397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5398 LDKChannelHandshakeLimits 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 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
5404 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5405 LDKChannelHandshakeLimits this_ptr_conv;
5406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5408 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
5412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5413 LDKChannelHandshakeLimits this_ptr_conv;
5414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5415 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5416 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
5419 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5420 LDKChannelHandshakeLimits this_ptr_conv;
5421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5422 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5423 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
5427 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) {
5428 LDKChannelHandshakeLimits this_ptr_conv;
5429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5431 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
5434 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5435 LDKChannelHandshakeLimits this_ptr_conv;
5436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5437 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5438 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
5442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5443 LDKChannelHandshakeLimits this_ptr_conv;
5444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5445 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5446 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
5449 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
5450 LDKChannelHandshakeLimits this_ptr_conv;
5451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5452 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5453 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
5457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5458 LDKChannelHandshakeLimits this_ptr_conv;
5459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5460 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5461 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
5464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5465 LDKChannelHandshakeLimits this_ptr_conv;
5466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5467 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5468 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
5472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5473 LDKChannelHandshakeLimits this_ptr_conv;
5474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5475 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5476 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
5479 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5480 LDKChannelHandshakeLimits this_ptr_conv;
5481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5482 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5483 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
5487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5488 LDKChannelHandshakeLimits this_ptr_conv;
5489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5491 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
5494 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5495 LDKChannelHandshakeLimits this_ptr_conv;
5496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5497 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5498 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
5502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5503 LDKChannelHandshakeLimits this_ptr_conv;
5504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5505 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5506 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
5510 LDKChannelHandshakeLimits this_ptr_conv;
5511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5512 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5513 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5518 LDKChannelHandshakeLimits this_ptr_conv;
5519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5520 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5521 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5524 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5525 LDKChannelHandshakeLimits this_ptr_conv;
5526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5527 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5528 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5533 LDKChannelHandshakeLimits this_ptr_conv;
5534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5536 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5539 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) {
5540 LDKChannelHandshakeLimits ret = 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);
5541 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5544 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5545 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_default();
5546 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5550 LDKChannelConfig this_ptr_conv;
5551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5552 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5553 ChannelConfig_free(this_ptr_conv);
5556 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5557 LDKChannelConfig orig_conv;
5558 orig_conv.inner = (void*)(orig & (~1));
5559 orig_conv.is_owned = (orig & 1) || (orig == 0);
5560 LDKChannelConfig ret = ChannelConfig_clone(&orig_conv);
5561 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5564 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
5565 LDKChannelConfig this_ptr_conv;
5566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5568 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
5572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5573 LDKChannelConfig this_ptr_conv;
5574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5576 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
5579 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
5580 LDKChannelConfig this_ptr_conv;
5581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5582 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5583 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
5587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5588 LDKChannelConfig this_ptr_conv;
5589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5590 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5591 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5594 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5595 LDKChannelConfig this_ptr_conv;
5596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5597 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5598 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5603 LDKChannelConfig this_ptr_conv;
5604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5605 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5606 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5609 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) {
5610 LDKChannelConfig ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5611 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5614 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
5615 LDKChannelConfig ret = ChannelConfig_default();
5616 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5619 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
5620 LDKChannelConfig obj_conv;
5621 obj_conv.inner = (void*)(obj & (~1));
5622 obj_conv.is_owned = (obj & 1) || (obj == 0);
5623 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
5624 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5625 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5626 CVec_u8Z_free(arg_var);
5630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5632 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5633 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5634 LDKChannelConfig ret = ChannelConfig_read(ser_ref);
5635 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5636 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5640 LDKUserConfig this_ptr_conv;
5641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5642 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5643 UserConfig_free(this_ptr_conv);
5646 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5647 LDKUserConfig orig_conv;
5648 orig_conv.inner = (void*)(orig & (~1));
5649 orig_conv.is_owned = (orig & 1) || (orig == 0);
5650 LDKUserConfig ret = UserConfig_clone(&orig_conv);
5651 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5654 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
5655 LDKUserConfig this_ptr_conv;
5656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5657 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5658 LDKChannelHandshakeConfig ret = UserConfig_get_own_channel_config(&this_ptr_conv);
5659 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5663 LDKUserConfig this_ptr_conv;
5664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5665 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5666 LDKChannelHandshakeConfig val_conv;
5667 val_conv.inner = (void*)(val & (~1));
5668 val_conv.is_owned = (val & 1) || (val == 0);
5669 if (val_conv.inner != NULL)
5670 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5671 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5674 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
5675 LDKUserConfig this_ptr_conv;
5676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5677 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5678 LDKChannelHandshakeLimits ret = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5679 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5683 LDKUserConfig this_ptr_conv;
5684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5685 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5686 LDKChannelHandshakeLimits val_conv;
5687 val_conv.inner = (void*)(val & (~1));
5688 val_conv.is_owned = (val & 1) || (val == 0);
5689 if (val_conv.inner != NULL)
5690 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5691 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5694 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
5695 LDKUserConfig this_ptr_conv;
5696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5697 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5698 LDKChannelConfig ret = UserConfig_get_channel_options(&this_ptr_conv);
5699 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5703 LDKUserConfig this_ptr_conv;
5704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5705 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5706 LDKChannelConfig val_conv;
5707 val_conv.inner = (void*)(val & (~1));
5708 val_conv.is_owned = (val & 1) || (val == 0);
5709 if (val_conv.inner != NULL)
5710 val_conv = ChannelConfig_clone(&val_conv);
5711 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5714 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) {
5715 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5716 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5717 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5718 if (own_channel_config_arg_conv.inner != NULL)
5719 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5720 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5721 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5722 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5723 if (peer_channel_config_limits_arg_conv.inner != NULL)
5724 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5725 LDKChannelConfig channel_options_arg_conv;
5726 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5727 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5728 if (channel_options_arg_conv.inner != NULL)
5729 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5730 LDKUserConfig ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5731 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5734 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5735 LDKUserConfig ret = UserConfig_default();
5736 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5739 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5740 LDKAccessError* orig_conv = (LDKAccessError*)orig;
5741 jclass ret = LDKAccessError_to_java(_env, AccessError_clone(orig_conv));
5745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5746 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5747 FREE((void*)this_ptr);
5748 Access_free(this_ptr_conv);
5751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5752 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5753 FREE((void*)this_ptr);
5754 Watch_free(this_ptr_conv);
5757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5758 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5759 FREE((void*)this_ptr);
5760 Filter_free(this_ptr_conv);
5763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5764 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
5765 FREE((void*)this_ptr);
5766 BroadcasterInterface_free(this_ptr_conv);
5769 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5770 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
5771 jclass ret = LDKConfirmationTarget_to_java(_env, ConfirmationTarget_clone(orig_conv));
5775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5776 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
5777 FREE((void*)this_ptr);
5778 FeeEstimator_free(this_ptr_conv);
5781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5782 LDKChainMonitor this_ptr_conv;
5783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5784 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5785 ChainMonitor_free(this_ptr_conv);
5788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
5789 LDKChainMonitor this_arg_conv;
5790 this_arg_conv.inner = (void*)(this_arg & (~1));
5791 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5792 unsigned char header_arr[80];
5793 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5794 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5795 unsigned char (*header_ref)[80] = &header_arr;
5796 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5797 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
5798 if (txdata_constr.datalen > 0)
5799 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5801 txdata_constr.data = NULL;
5802 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
5803 for (size_t d = 0; d < txdata_constr.datalen; d++) {
5804 long arr_conv_29 = txdata_vals[d];
5805 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
5806 FREE((void*)arr_conv_29);
5807 txdata_constr.data[d] = arr_conv_29_conv;
5809 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
5810 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
5813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
5814 LDKChainMonitor this_arg_conv;
5815 this_arg_conv.inner = (void*)(this_arg & (~1));
5816 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5817 unsigned char header_arr[80];
5818 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5819 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5820 unsigned char (*header_ref)[80] = &header_arr;
5821 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
5824 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
5825 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
5826 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5827 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5828 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5829 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5831 LDKLogger logger_conv = *(LDKLogger*)logger;
5832 if (logger_conv.free == LDKLogger_JCalls_free) {
5833 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5834 LDKLogger_JCalls_clone(logger_conv.this_arg);
5836 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
5837 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
5838 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5839 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
5841 LDKChainMonitor ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
5842 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5845 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
5846 LDKChainMonitor this_arg_conv;
5847 this_arg_conv.inner = (void*)(this_arg & (~1));
5848 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5849 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
5850 *ret = ChainMonitor_as_Watch(&this_arg_conv);
5854 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5855 LDKChainMonitor this_arg_conv;
5856 this_arg_conv.inner = (void*)(this_arg & (~1));
5857 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5858 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5859 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
5863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5864 LDKChannelMonitorUpdate this_ptr_conv;
5865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5866 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5867 ChannelMonitorUpdate_free(this_ptr_conv);
5870 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5871 LDKChannelMonitorUpdate orig_conv;
5872 orig_conv.inner = (void*)(orig & (~1));
5873 orig_conv.is_owned = (orig & 1) || (orig == 0);
5874 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_clone(&orig_conv);
5875 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5878 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5879 LDKChannelMonitorUpdate this_ptr_conv;
5880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5881 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5882 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
5886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5887 LDKChannelMonitorUpdate this_ptr_conv;
5888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5889 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5890 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
5893 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5894 LDKChannelMonitorUpdate obj_conv;
5895 obj_conv.inner = (void*)(obj & (~1));
5896 obj_conv.is_owned = (obj & 1) || (obj == 0);
5897 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
5898 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5899 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5900 CVec_u8Z_free(arg_var);
5904 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5906 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5907 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5908 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_read(ser_ref);
5909 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5910 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5913 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5914 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
5915 jclass ret = LDKChannelMonitorUpdateErr_to_java(_env, ChannelMonitorUpdateErr_clone(orig_conv));
5919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5920 LDKMonitorUpdateError this_ptr_conv;
5921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5922 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5923 MonitorUpdateError_free(this_ptr_conv);
5926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5927 LDKMonitorEvent this_ptr_conv;
5928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5929 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5930 MonitorEvent_free(this_ptr_conv);
5933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5934 LDKHTLCUpdate this_ptr_conv;
5935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5936 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5937 HTLCUpdate_free(this_ptr_conv);
5940 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5941 LDKHTLCUpdate orig_conv;
5942 orig_conv.inner = (void*)(orig & (~1));
5943 orig_conv.is_owned = (orig & 1) || (orig == 0);
5944 LDKHTLCUpdate ret = HTLCUpdate_clone(&orig_conv);
5945 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5948 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5949 LDKHTLCUpdate obj_conv;
5950 obj_conv.inner = (void*)(obj & (~1));
5951 obj_conv.is_owned = (obj & 1) || (obj == 0);
5952 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
5953 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5954 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5955 CVec_u8Z_free(arg_var);
5959 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5961 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5962 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5963 LDKHTLCUpdate ret = HTLCUpdate_read(ser_ref);
5964 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5965 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5969 LDKChannelMonitor this_ptr_conv;
5970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5971 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5972 ChannelMonitor_free(this_ptr_conv);
5975 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
5976 LDKChannelMonitor this_arg_conv;
5977 this_arg_conv.inner = (void*)(this_arg & (~1));
5978 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5979 LDKChannelMonitorUpdate updates_conv;
5980 updates_conv.inner = (void*)(updates & (~1));
5981 updates_conv.is_owned = (updates & 1) || (updates == 0);
5982 if (updates_conv.inner != NULL)
5983 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
5984 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
5985 LDKLogger* logger_conv = (LDKLogger*)logger;
5986 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5987 *ret = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
5991 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5992 LDKChannelMonitor this_arg_conv;
5993 this_arg_conv.inner = (void*)(this_arg & (~1));
5994 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5995 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
5999 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
6000 LDKChannelMonitor this_arg_conv;
6001 this_arg_conv.inner = (void*)(this_arg & (~1));
6002 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6003 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6004 *ret = ChannelMonitor_get_funding_txo(&this_arg_conv);
6008 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6009 LDKChannelMonitor this_arg_conv;
6010 this_arg_conv.inner = (void*)(this_arg & (~1));
6011 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6012 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
6013 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6014 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6015 for (size_t o = 0; o < ret_var.datalen; o++) {
6016 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
6017 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6018 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6019 long arr_conv_14_ref;
6020 if (arr_conv_14_var.is_owned) {
6021 arr_conv_14_ref = (long)arr_conv_14_var.inner | 1;
6023 arr_conv_14_ref = (long)arr_conv_14_var.inner & ~1;
6025 ret_arr_ptr[o] = arr_conv_14_ref;
6027 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6032 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6033 LDKChannelMonitor this_arg_conv;
6034 this_arg_conv.inner = (void*)(this_arg & (~1));
6035 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6036 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
6037 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6038 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6039 for (size_t h = 0; h < ret_var.datalen; h++) {
6040 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6041 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
6042 long arr_conv_7_ref = (long)arr_conv_7_copy;
6043 ret_arr_ptr[h] = arr_conv_7_ref;
6045 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6046 CVec_EventZ_free(ret_var);
6050 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
6051 LDKChannelMonitor this_arg_conv;
6052 this_arg_conv.inner = (void*)(this_arg & (~1));
6053 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6054 LDKLogger* logger_conv = (LDKLogger*)logger;
6055 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
6056 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6057 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6058 for (size_t n = 0; n < ret_var.datalen; n++) {
6059 LDKTransaction *arr_conv_13_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
6060 *arr_conv_13_copy = ret_var.data[n];
6061 long arr_conv_13_ref = (long)arr_conv_13_copy;
6062 ret_arr_ptr[n] = arr_conv_13_ref;
6064 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6065 CVec_TransactionZ_free(ret_var);
6069 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) {
6070 LDKChannelMonitor this_arg_conv;
6071 this_arg_conv.inner = (void*)(this_arg & (~1));
6072 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6073 unsigned char header_arr[80];
6074 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6075 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6076 unsigned char (*header_ref)[80] = &header_arr;
6077 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6078 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6079 if (txdata_constr.datalen > 0)
6080 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6082 txdata_constr.data = NULL;
6083 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6084 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6085 long arr_conv_29 = txdata_vals[d];
6086 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6087 FREE((void*)arr_conv_29);
6088 txdata_constr.data[d] = arr_conv_29_conv;
6090 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6091 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6092 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6093 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6094 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6096 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6097 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6098 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6099 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6101 LDKLogger logger_conv = *(LDKLogger*)logger;
6102 if (logger_conv.free == LDKLogger_JCalls_free) {
6103 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6104 LDKLogger_JCalls_clone(logger_conv.this_arg);
6106 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6107 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6108 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6109 for (size_t b = 0; b < ret_var.datalen; b++) {
6110 /*XXX False */long arr_conv_27_ref = (long)&ret_var.data[b];
6111 ret_arr_ptr[b] = arr_conv_27_ref;
6113 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6114 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(ret_var);
6118 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) {
6119 LDKChannelMonitor this_arg_conv;
6120 this_arg_conv.inner = (void*)(this_arg & (~1));
6121 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6122 unsigned char header_arr[80];
6123 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6124 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6125 unsigned char (*header_ref)[80] = &header_arr;
6126 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6127 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6128 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6129 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6131 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6132 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6133 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6134 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6136 LDKLogger logger_conv = *(LDKLogger*)logger;
6137 if (logger_conv.free == LDKLogger_JCalls_free) {
6138 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6139 LDKLogger_JCalls_clone(logger_conv.this_arg);
6141 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6145 LDKOutPoint this_ptr_conv;
6146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6147 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6148 OutPoint_free(this_ptr_conv);
6151 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6152 LDKOutPoint orig_conv;
6153 orig_conv.inner = (void*)(orig & (~1));
6154 orig_conv.is_owned = (orig & 1) || (orig == 0);
6155 LDKOutPoint ret = OutPoint_clone(&orig_conv);
6156 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6159 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6160 LDKOutPoint this_ptr_conv;
6161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6162 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6163 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6164 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
6168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6169 LDKOutPoint this_ptr_conv;
6170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6171 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6172 LDKThirtyTwoBytes val_ref;
6173 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6174 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6175 OutPoint_set_txid(&this_ptr_conv, val_ref);
6178 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6179 LDKOutPoint this_ptr_conv;
6180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6181 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6182 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
6186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6187 LDKOutPoint this_ptr_conv;
6188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6189 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6190 OutPoint_set_index(&this_ptr_conv, val);
6193 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
6194 LDKThirtyTwoBytes txid_arg_ref;
6195 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
6196 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
6197 LDKOutPoint ret = OutPoint_new(txid_arg_ref, index_arg);
6198 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6201 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6202 LDKOutPoint this_arg_conv;
6203 this_arg_conv.inner = (void*)(this_arg & (~1));
6204 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6205 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
6206 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
6210 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
6211 LDKOutPoint obj_conv;
6212 obj_conv.inner = (void*)(obj & (~1));
6213 obj_conv.is_owned = (obj & 1) || (obj == 0);
6214 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
6215 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6216 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6217 CVec_u8Z_free(arg_var);
6221 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6223 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6224 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6225 LDKOutPoint ret = OutPoint_read(ser_ref);
6226 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6227 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6231 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
6232 FREE((void*)this_ptr);
6233 SpendableOutputDescriptor_free(this_ptr_conv);
6236 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6237 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
6238 LDKSpendableOutputDescriptor* ret = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
6239 *ret = SpendableOutputDescriptor_clone(orig_conv);
6243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6244 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
6245 FREE((void*)this_ptr);
6246 ChannelKeys_free(this_ptr_conv);
6249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6250 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
6251 FREE((void*)this_ptr);
6252 KeysInterface_free(this_ptr_conv);
6255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6256 LDKInMemoryChannelKeys this_ptr_conv;
6257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6258 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6259 InMemoryChannelKeys_free(this_ptr_conv);
6262 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6263 LDKInMemoryChannelKeys orig_conv;
6264 orig_conv.inner = (void*)(orig & (~1));
6265 orig_conv.is_owned = (orig & 1) || (orig == 0);
6266 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_clone(&orig_conv);
6267 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6270 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6271 LDKInMemoryChannelKeys this_ptr_conv;
6272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6273 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6274 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6275 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
6279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6280 LDKInMemoryChannelKeys this_ptr_conv;
6281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6282 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6283 LDKSecretKey val_ref;
6284 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6285 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6286 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
6289 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6290 LDKInMemoryChannelKeys this_ptr_conv;
6291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6292 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6293 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6294 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
6298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6299 LDKInMemoryChannelKeys this_ptr_conv;
6300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6301 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6302 LDKSecretKey val_ref;
6303 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6304 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6305 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
6308 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6309 LDKInMemoryChannelKeys this_ptr_conv;
6310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6311 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6312 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6313 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
6317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6318 LDKInMemoryChannelKeys 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 LDKSecretKey val_ref;
6322 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6323 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6324 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
6327 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6328 LDKInMemoryChannelKeys this_ptr_conv;
6329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6330 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6331 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6332 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
6336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6337 LDKInMemoryChannelKeys this_ptr_conv;
6338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6339 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6340 LDKSecretKey val_ref;
6341 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6342 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6343 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
6346 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6347 LDKInMemoryChannelKeys this_ptr_conv;
6348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6349 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6350 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6351 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
6355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6356 LDKInMemoryChannelKeys this_ptr_conv;
6357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6358 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6359 LDKSecretKey val_ref;
6360 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6361 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6362 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6365 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
6366 LDKInMemoryChannelKeys 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6370 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
6374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6375 LDKInMemoryChannelKeys this_ptr_conv;
6376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6377 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6378 LDKThirtyTwoBytes val_ref;
6379 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6380 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6381 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6384 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) {
6385 LDKSecretKey funding_key_ref;
6386 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
6387 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
6388 LDKSecretKey revocation_base_key_ref;
6389 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
6390 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
6391 LDKSecretKey payment_key_ref;
6392 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
6393 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
6394 LDKSecretKey delayed_payment_base_key_ref;
6395 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
6396 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
6397 LDKSecretKey htlc_base_key_ref;
6398 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
6399 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
6400 LDKThirtyTwoBytes commitment_seed_ref;
6401 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
6402 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
6403 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
6404 FREE((void*)key_derivation_params);
6405 LDKInMemoryChannelKeys ret = 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);
6406 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6410 LDKInMemoryChannelKeys this_arg_conv;
6411 this_arg_conv.inner = (void*)(this_arg & (~1));
6412 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6413 LDKChannelPublicKeys ret = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
6414 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6417 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6418 LDKInMemoryChannelKeys this_arg_conv;
6419 this_arg_conv.inner = (void*)(this_arg & (~1));
6420 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6421 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
6425 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6426 LDKInMemoryChannelKeys this_arg_conv;
6427 this_arg_conv.inner = (void*)(this_arg & (~1));
6428 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6429 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
6433 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6434 LDKInMemoryChannelKeys this_arg_conv;
6435 this_arg_conv.inner = (void*)(this_arg & (~1));
6436 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6437 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6438 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
6442 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
6443 LDKInMemoryChannelKeys obj_conv;
6444 obj_conv.inner = (void*)(obj & (~1));
6445 obj_conv.is_owned = (obj & 1) || (obj == 0);
6446 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
6447 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6448 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6449 CVec_u8Z_free(arg_var);
6453 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6455 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6456 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6457 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_read(ser_ref);
6458 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6459 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6463 LDKKeysManager this_ptr_conv;
6464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6465 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6466 KeysManager_free(this_ptr_conv);
6469 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) {
6470 unsigned char seed_arr[32];
6471 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
6472 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
6473 unsigned char (*seed_ref)[32] = &seed_arr;
6474 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6475 LDKKeysManager ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
6476 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6479 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) {
6480 LDKKeysManager this_arg_conv;
6481 this_arg_conv.inner = (void*)(this_arg & (~1));
6482 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6483 LDKInMemoryChannelKeys ret = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
6484 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6487 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
6488 LDKKeysManager this_arg_conv;
6489 this_arg_conv.inner = (void*)(this_arg & (~1));
6490 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6491 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6492 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
6496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6497 LDKChannelManager 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 ChannelManager_free(this_ptr_conv);
6503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6504 LDKChannelDetails this_ptr_conv;
6505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6506 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6507 ChannelDetails_free(this_ptr_conv);
6510 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6511 LDKChannelDetails orig_conv;
6512 orig_conv.inner = (void*)(orig & (~1));
6513 orig_conv.is_owned = (orig & 1) || (orig == 0);
6514 LDKChannelDetails ret = ChannelDetails_clone(&orig_conv);
6515 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6518 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6519 LDKChannelDetails this_ptr_conv;
6520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6521 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6522 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6523 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
6527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6528 LDKChannelDetails this_ptr_conv;
6529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6530 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6531 LDKThirtyTwoBytes val_ref;
6532 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6533 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6534 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
6537 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6538 LDKChannelDetails this_ptr_conv;
6539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6541 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6542 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
6546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6547 LDKChannelDetails this_ptr_conv;
6548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6549 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6550 LDKPublicKey val_ref;
6551 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6552 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6553 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
6556 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
6557 LDKChannelDetails this_ptr_conv;
6558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6559 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6560 LDKInitFeatures ret = ChannelDetails_get_counterparty_features(&this_ptr_conv);
6561 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6565 LDKChannelDetails this_ptr_conv;
6566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6568 LDKInitFeatures val_conv;
6569 val_conv.inner = (void*)(val & (~1));
6570 val_conv.is_owned = (val & 1) || (val == 0);
6571 // Warning: we may need a move here but can't clone!
6572 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
6575 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6576 LDKChannelDetails this_ptr_conv;
6577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6579 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
6583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6584 LDKChannelDetails this_ptr_conv;
6585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6586 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6587 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
6590 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6591 LDKChannelDetails this_ptr_conv;
6592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6593 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6594 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
6598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6599 LDKChannelDetails this_ptr_conv;
6600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6601 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6602 ChannelDetails_set_user_id(&this_ptr_conv, val);
6605 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6606 LDKChannelDetails this_ptr_conv;
6607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6608 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6609 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
6613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6614 LDKChannelDetails this_ptr_conv;
6615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6616 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6617 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
6620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6621 LDKChannelDetails this_ptr_conv;
6622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6623 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6624 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
6628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6629 LDKChannelDetails this_ptr_conv;
6630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6631 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6632 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
6635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
6636 LDKChannelDetails this_ptr_conv;
6637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6639 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
6643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6644 LDKChannelDetails this_ptr_conv;
6645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6646 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6647 ChannelDetails_set_is_live(&this_ptr_conv, val);
6650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6651 LDKPaymentSendFailure this_ptr_conv;
6652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6653 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6654 PaymentSendFailure_free(this_ptr_conv);
6657 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) {
6658 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6659 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
6660 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
6661 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6662 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
6664 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6665 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6666 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6667 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6669 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6670 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6671 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6672 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6674 LDKLogger logger_conv = *(LDKLogger*)logger;
6675 if (logger_conv.free == LDKLogger_JCalls_free) {
6676 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6677 LDKLogger_JCalls_clone(logger_conv.this_arg);
6679 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6680 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6681 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6682 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6684 LDKUserConfig config_conv;
6685 config_conv.inner = (void*)(config & (~1));
6686 config_conv.is_owned = (config & 1) || (config == 0);
6687 if (config_conv.inner != NULL)
6688 config_conv = UserConfig_clone(&config_conv);
6689 LDKChannelManager ret = ChannelManager_new(network_conv, fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, current_blockchain_height);
6690 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6693 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) {
6694 LDKChannelManager this_arg_conv;
6695 this_arg_conv.inner = (void*)(this_arg & (~1));
6696 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6697 LDKPublicKey their_network_key_ref;
6698 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
6699 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
6700 LDKUserConfig override_config_conv;
6701 override_config_conv.inner = (void*)(override_config & (~1));
6702 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
6703 if (override_config_conv.inner != NULL)
6704 override_config_conv = UserConfig_clone(&override_config_conv);
6705 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6706 *ret = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
6710 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6711 LDKChannelManager this_arg_conv;
6712 this_arg_conv.inner = (void*)(this_arg & (~1));
6713 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6714 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
6715 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6716 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6717 for (size_t q = 0; q < ret_var.datalen; q++) {
6718 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
6719 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6720 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6721 long arr_conv_16_ref;
6722 if (arr_conv_16_var.is_owned) {
6723 arr_conv_16_ref = (long)arr_conv_16_var.inner | 1;
6725 arr_conv_16_ref = (long)arr_conv_16_var.inner & ~1;
6727 ret_arr_ptr[q] = arr_conv_16_ref;
6729 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6734 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6735 LDKChannelManager this_arg_conv;
6736 this_arg_conv.inner = (void*)(this_arg & (~1));
6737 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6738 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
6739 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6740 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6741 for (size_t q = 0; q < ret_var.datalen; q++) {
6742 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
6743 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6744 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6745 long arr_conv_16_ref;
6746 if (arr_conv_16_var.is_owned) {
6747 arr_conv_16_ref = (long)arr_conv_16_var.inner | 1;
6749 arr_conv_16_ref = (long)arr_conv_16_var.inner & ~1;
6751 ret_arr_ptr[q] = arr_conv_16_ref;
6753 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6758 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6759 LDKChannelManager this_arg_conv;
6760 this_arg_conv.inner = (void*)(this_arg & (~1));
6761 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6762 unsigned char channel_id_arr[32];
6763 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6764 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6765 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6766 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6767 *ret = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
6771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6772 LDKChannelManager this_arg_conv;
6773 this_arg_conv.inner = (void*)(this_arg & (~1));
6774 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6775 unsigned char channel_id_arr[32];
6776 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6777 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6778 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6779 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
6782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6783 LDKChannelManager this_arg_conv;
6784 this_arg_conv.inner = (void*)(this_arg & (~1));
6785 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6786 ChannelManager_force_close_all_channels(&this_arg_conv);
6789 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) {
6790 LDKChannelManager this_arg_conv;
6791 this_arg_conv.inner = (void*)(this_arg & (~1));
6792 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6793 LDKRoute route_conv;
6794 route_conv.inner = (void*)(route & (~1));
6795 route_conv.is_owned = (route & 1) || (route == 0);
6796 LDKThirtyTwoBytes payment_hash_ref;
6797 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6798 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
6799 LDKThirtyTwoBytes payment_secret_ref;
6800 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6801 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6802 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6803 *ret = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
6807 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) {
6808 LDKChannelManager this_arg_conv;
6809 this_arg_conv.inner = (void*)(this_arg & (~1));
6810 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6811 unsigned char temporary_channel_id_arr[32];
6812 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
6813 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
6814 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
6815 LDKOutPoint funding_txo_conv;
6816 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6817 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6818 if (funding_txo_conv.inner != NULL)
6819 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6820 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
6823 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) {
6824 LDKChannelManager this_arg_conv;
6825 this_arg_conv.inner = (void*)(this_arg & (~1));
6826 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6827 LDKThreeBytes rgb_ref;
6828 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
6829 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
6830 LDKThirtyTwoBytes alias_ref;
6831 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
6832 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
6833 LDKCVec_NetAddressZ addresses_constr;
6834 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
6835 if (addresses_constr.datalen > 0)
6836 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6838 addresses_constr.data = NULL;
6839 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
6840 for (size_t m = 0; m < addresses_constr.datalen; m++) {
6841 long arr_conv_12 = addresses_vals[m];
6842 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
6843 FREE((void*)arr_conv_12);
6844 addresses_constr.data[m] = arr_conv_12_conv;
6846 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
6847 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
6850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
6851 LDKChannelManager this_arg_conv;
6852 this_arg_conv.inner = (void*)(this_arg & (~1));
6853 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6854 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
6857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
6858 LDKChannelManager this_arg_conv;
6859 this_arg_conv.inner = (void*)(this_arg & (~1));
6860 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6861 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
6864 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) {
6865 LDKChannelManager this_arg_conv;
6866 this_arg_conv.inner = (void*)(this_arg & (~1));
6867 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6868 unsigned char payment_hash_arr[32];
6869 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6870 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
6871 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
6872 LDKThirtyTwoBytes payment_secret_ref;
6873 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6874 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6875 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
6879 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) {
6880 LDKChannelManager this_arg_conv;
6881 this_arg_conv.inner = (void*)(this_arg & (~1));
6882 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6883 LDKThirtyTwoBytes payment_preimage_ref;
6884 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
6885 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
6886 LDKThirtyTwoBytes payment_secret_ref;
6887 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6888 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6889 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
6893 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6894 LDKChannelManager this_arg_conv;
6895 this_arg_conv.inner = (void*)(this_arg & (~1));
6896 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6897 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6898 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
6902 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) {
6903 LDKChannelManager this_arg_conv;
6904 this_arg_conv.inner = (void*)(this_arg & (~1));
6905 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6906 LDKOutPoint funding_txo_conv;
6907 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6908 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6909 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
6912 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6913 LDKChannelManager this_arg_conv;
6914 this_arg_conv.inner = (void*)(this_arg & (~1));
6915 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6916 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6917 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
6921 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6922 LDKChannelManager this_arg_conv;
6923 this_arg_conv.inner = (void*)(this_arg & (~1));
6924 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6925 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6926 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
6930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
6931 LDKChannelManager this_arg_conv;
6932 this_arg_conv.inner = (void*)(this_arg & (~1));
6933 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6934 unsigned char header_arr[80];
6935 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6936 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6937 unsigned char (*header_ref)[80] = &header_arr;
6938 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6939 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6940 if (txdata_constr.datalen > 0)
6941 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6943 txdata_constr.data = NULL;
6944 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6945 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6946 long arr_conv_29 = txdata_vals[d];
6947 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6948 FREE((void*)arr_conv_29);
6949 txdata_constr.data[d] = arr_conv_29_conv;
6951 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6952 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
6956 LDKChannelManager this_arg_conv;
6957 this_arg_conv.inner = (void*)(this_arg & (~1));
6958 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6959 unsigned char header_arr[80];
6960 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6961 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6962 unsigned char (*header_ref)[80] = &header_arr;
6963 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
6966 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
6967 LDKChannelManager this_arg_conv;
6968 this_arg_conv.inner = (void*)(this_arg & (~1));
6969 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6970 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6971 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
6975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6976 LDKChannelManagerReadArgs this_ptr_conv;
6977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6978 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6979 ChannelManagerReadArgs_free(this_ptr_conv);
6982 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
6983 LDKChannelManagerReadArgs this_ptr_conv;
6984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6985 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6986 long ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
6990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6991 LDKChannelManagerReadArgs this_ptr_conv;
6992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6993 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6994 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
6995 if (val_conv.free == LDKKeysInterface_JCalls_free) {
6996 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6997 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
6999 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
7002 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
7003 LDKChannelManagerReadArgs this_ptr_conv;
7004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7005 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7006 long ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
7010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7011 LDKChannelManagerReadArgs this_ptr_conv;
7012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7013 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7014 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
7015 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
7016 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7017 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
7019 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
7022 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
7023 LDKChannelManagerReadArgs this_ptr_conv;
7024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7025 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7026 long ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
7030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7031 LDKChannelManagerReadArgs this_ptr_conv;
7032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7034 LDKWatch val_conv = *(LDKWatch*)val;
7035 if (val_conv.free == LDKWatch_JCalls_free) {
7036 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7037 LDKWatch_JCalls_clone(val_conv.this_arg);
7039 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
7042 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
7043 LDKChannelManagerReadArgs this_ptr_conv;
7044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7045 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7046 long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
7050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7051 LDKChannelManagerReadArgs this_ptr_conv;
7052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7053 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7054 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
7055 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
7056 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7057 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
7059 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
7062 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
7063 LDKChannelManagerReadArgs this_ptr_conv;
7064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7066 long ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
7070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7071 LDKChannelManagerReadArgs this_ptr_conv;
7072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7073 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7074 LDKLogger val_conv = *(LDKLogger*)val;
7075 if (val_conv.free == LDKLogger_JCalls_free) {
7076 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7077 LDKLogger_JCalls_clone(val_conv.this_arg);
7079 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
7082 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
7083 LDKChannelManagerReadArgs this_ptr_conv;
7084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7085 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7086 LDKUserConfig ret = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
7087 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7091 LDKChannelManagerReadArgs this_ptr_conv;
7092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7094 LDKUserConfig val_conv;
7095 val_conv.inner = (void*)(val & (~1));
7096 val_conv.is_owned = (val & 1) || (val == 0);
7097 if (val_conv.inner != NULL)
7098 val_conv = UserConfig_clone(&val_conv);
7099 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
7102 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) {
7103 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7104 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7105 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7106 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7108 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7109 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
7110 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7111 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
7113 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7114 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7115 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7116 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7118 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7119 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7120 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7121 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7123 LDKLogger logger_conv = *(LDKLogger*)logger;
7124 if (logger_conv.free == LDKLogger_JCalls_free) {
7125 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7126 LDKLogger_JCalls_clone(logger_conv.this_arg);
7128 LDKUserConfig default_config_conv;
7129 default_config_conv.inner = (void*)(default_config & (~1));
7130 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
7131 if (default_config_conv.inner != NULL)
7132 default_config_conv = UserConfig_clone(&default_config_conv);
7133 LDKCVec_ChannelMonitorZ channel_monitors_constr;
7134 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
7135 if (channel_monitors_constr.datalen > 0)
7136 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7138 channel_monitors_constr.data = NULL;
7139 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
7140 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
7141 long arr_conv_16 = channel_monitors_vals[q];
7142 LDKChannelMonitor arr_conv_16_conv;
7143 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7144 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7145 // Warning: we may need a move here but can't clone!
7146 channel_monitors_constr.data[q] = arr_conv_16_conv;
7148 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
7149 LDKChannelManagerReadArgs ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr);
7150 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7154 LDKDecodeError this_ptr_conv;
7155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7156 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7157 DecodeError_free(this_ptr_conv);
7160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7161 LDKInit this_ptr_conv;
7162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7163 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7164 Init_free(this_ptr_conv);
7167 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7169 orig_conv.inner = (void*)(orig & (~1));
7170 orig_conv.is_owned = (orig & 1) || (orig == 0);
7171 LDKInit ret = Init_clone(&orig_conv);
7172 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7176 LDKErrorMessage this_ptr_conv;
7177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7178 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7179 ErrorMessage_free(this_ptr_conv);
7182 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7183 LDKErrorMessage orig_conv;
7184 orig_conv.inner = (void*)(orig & (~1));
7185 orig_conv.is_owned = (orig & 1) || (orig == 0);
7186 LDKErrorMessage ret = ErrorMessage_clone(&orig_conv);
7187 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7190 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7191 LDKErrorMessage this_ptr_conv;
7192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7193 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7194 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7195 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
7199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7200 LDKErrorMessage this_ptr_conv;
7201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7202 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7203 LDKThirtyTwoBytes val_ref;
7204 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7205 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7206 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
7209 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
7210 LDKErrorMessage this_ptr_conv;
7211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7212 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7213 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
7214 char* _buf = MALLOC(_str.len + 1, "str conv buf");
7215 memcpy(_buf, _str.chars, _str.len);
7217 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
7222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7223 LDKErrorMessage this_ptr_conv;
7224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7225 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7226 LDKCVec_u8Z val_ref;
7227 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
7228 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7229 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7230 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
7233 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
7234 LDKThirtyTwoBytes channel_id_arg_ref;
7235 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7236 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7237 LDKCVec_u8Z data_arg_ref;
7238 data_arg_ref.data = (*_env)->GetByteArrayElements (_env, data_arg, NULL);
7239 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
7240 LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7241 (*_env)->ReleaseByteArrayElements(_env, data_arg, (int8_t*)data_arg_ref.data, 0);
7242 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7246 LDKPing this_ptr_conv;
7247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7248 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7249 Ping_free(this_ptr_conv);
7252 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7254 orig_conv.inner = (void*)(orig & (~1));
7255 orig_conv.is_owned = (orig & 1) || (orig == 0);
7256 LDKPing ret = Ping_clone(&orig_conv);
7257 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7260 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7261 LDKPing this_ptr_conv;
7262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7263 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7264 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7269 LDKPing this_ptr_conv;
7270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7271 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7272 Ping_set_ponglen(&this_ptr_conv, val);
7275 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7276 LDKPing this_ptr_conv;
7277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7278 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7279 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7284 LDKPing this_ptr_conv;
7285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7286 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7287 Ping_set_byteslen(&this_ptr_conv, val);
7290 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
7291 LDKPing ret = Ping_new(ponglen_arg, byteslen_arg);
7292 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7296 LDKPong this_ptr_conv;
7297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7298 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7299 Pong_free(this_ptr_conv);
7302 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7304 orig_conv.inner = (void*)(orig & (~1));
7305 orig_conv.is_owned = (orig & 1) || (orig == 0);
7306 LDKPong ret = Pong_clone(&orig_conv);
7307 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7310 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7311 LDKPong this_ptr_conv;
7312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7313 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7314 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
7318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7319 LDKPong this_ptr_conv;
7320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7321 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7322 Pong_set_byteslen(&this_ptr_conv, val);
7325 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
7326 LDKPong ret = Pong_new(byteslen_arg);
7327 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7331 LDKOpenChannel this_ptr_conv;
7332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7333 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7334 OpenChannel_free(this_ptr_conv);
7337 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7338 LDKOpenChannel orig_conv;
7339 orig_conv.inner = (void*)(orig & (~1));
7340 orig_conv.is_owned = (orig & 1) || (orig == 0);
7341 LDKOpenChannel ret = OpenChannel_clone(&orig_conv);
7342 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7345 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7346 LDKOpenChannel this_ptr_conv;
7347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7348 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7349 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7350 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
7354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7355 LDKOpenChannel this_ptr_conv;
7356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7357 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7358 LDKThirtyTwoBytes val_ref;
7359 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7360 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7361 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
7364 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7365 LDKOpenChannel this_ptr_conv;
7366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7367 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7368 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7369 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
7373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7374 LDKOpenChannel this_ptr_conv;
7375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7376 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7377 LDKThirtyTwoBytes val_ref;
7378 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7379 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7380 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7383 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7384 LDKOpenChannel this_ptr_conv;
7385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7387 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
7391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7392 LDKOpenChannel this_ptr_conv;
7393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7394 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7395 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
7398 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7399 LDKOpenChannel this_ptr_conv;
7400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7401 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7402 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
7406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7407 LDKOpenChannel 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 OpenChannel_set_push_msat(&this_ptr_conv, val);
7413 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7414 LDKOpenChannel 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 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
7421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7422 LDKOpenChannel this_ptr_conv;
7423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7424 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7425 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7428 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7429 LDKOpenChannel this_ptr_conv;
7430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7431 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7432 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7436 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) {
7437 LDKOpenChannel this_ptr_conv;
7438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7439 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7440 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7444 LDKOpenChannel this_ptr_conv;
7445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7446 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7447 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7452 LDKOpenChannel this_ptr_conv;
7453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7454 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7455 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7458 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7459 LDKOpenChannel this_ptr_conv;
7460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7462 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
7466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7467 LDKOpenChannel this_ptr_conv;
7468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7469 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7470 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7473 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7474 LDKOpenChannel this_ptr_conv;
7475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7476 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7477 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
7481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7482 LDKOpenChannel this_ptr_conv;
7483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7484 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7485 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
7488 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7489 LDKOpenChannel this_ptr_conv;
7490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7491 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7492 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
7496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7497 LDKOpenChannel this_ptr_conv;
7498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7499 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7500 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
7503 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7504 LDKOpenChannel this_ptr_conv;
7505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7506 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7507 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
7511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7512 LDKOpenChannel this_ptr_conv;
7513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7514 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7515 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7518 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7519 LDKOpenChannel this_ptr_conv;
7520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7521 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7522 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7523 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7528 LDKOpenChannel this_ptr_conv;
7529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7530 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7531 LDKPublicKey val_ref;
7532 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7533 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7534 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7537 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7538 LDKOpenChannel 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7542 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7547 LDKOpenChannel this_ptr_conv;
7548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7549 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7550 LDKPublicKey val_ref;
7551 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7552 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7553 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7556 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7557 LDKOpenChannel this_ptr_conv;
7558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7559 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7560 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7561 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
7565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7566 LDKOpenChannel this_ptr_conv;
7567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7569 LDKPublicKey val_ref;
7570 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7571 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7572 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
7575 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7576 LDKOpenChannel this_ptr_conv;
7577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7579 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7580 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7585 LDKOpenChannel this_ptr_conv;
7586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7587 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7588 LDKPublicKey val_ref;
7589 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7590 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7591 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7594 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7595 LDKOpenChannel this_ptr_conv;
7596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7597 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7598 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7599 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
7603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7604 LDKOpenChannel this_ptr_conv;
7605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7606 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7607 LDKPublicKey val_ref;
7608 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7609 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7610 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7613 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7614 LDKOpenChannel this_ptr_conv;
7615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7616 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7617 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7618 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
7622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7623 LDKOpenChannel this_ptr_conv;
7624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7625 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7626 LDKPublicKey val_ref;
7627 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7628 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7629 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7632 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
7633 LDKOpenChannel this_ptr_conv;
7634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7635 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7636 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
7640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
7641 LDKOpenChannel this_ptr_conv;
7642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7643 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7644 OpenChannel_set_channel_flags(&this_ptr_conv, val);
7647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7648 LDKAcceptChannel this_ptr_conv;
7649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7650 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7651 AcceptChannel_free(this_ptr_conv);
7654 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7655 LDKAcceptChannel orig_conv;
7656 orig_conv.inner = (void*)(orig & (~1));
7657 orig_conv.is_owned = (orig & 1) || (orig == 0);
7658 LDKAcceptChannel ret = AcceptChannel_clone(&orig_conv);
7659 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7662 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7663 LDKAcceptChannel this_ptr_conv;
7664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7665 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7666 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7667 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
7671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7672 LDKAcceptChannel this_ptr_conv;
7673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7674 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7675 LDKThirtyTwoBytes val_ref;
7676 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7677 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7678 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7681 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7682 LDKAcceptChannel this_ptr_conv;
7683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7684 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7685 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
7689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7690 LDKAcceptChannel this_ptr_conv;
7691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7692 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7693 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7696 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7697 LDKAcceptChannel this_ptr_conv;
7698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7699 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7700 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7704 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) {
7705 LDKAcceptChannel this_ptr_conv;
7706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7707 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7708 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7711 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7712 LDKAcceptChannel this_ptr_conv;
7713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7715 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7720 LDKAcceptChannel this_ptr_conv;
7721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7722 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7723 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7726 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7727 LDKAcceptChannel this_ptr_conv;
7728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7729 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7730 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
7734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7735 LDKAcceptChannel this_ptr_conv;
7736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7738 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7741 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
7742 LDKAcceptChannel this_ptr_conv;
7743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7744 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7745 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
7749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7750 LDKAcceptChannel this_ptr_conv;
7751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7752 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7753 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
7756 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7757 LDKAcceptChannel this_ptr_conv;
7758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7759 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7760 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
7764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7765 LDKAcceptChannel this_ptr_conv;
7766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7767 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7768 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
7771 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7772 LDKAcceptChannel this_ptr_conv;
7773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7774 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7775 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
7779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7780 LDKAcceptChannel this_ptr_conv;
7781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7782 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7783 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7786 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7787 LDKAcceptChannel this_ptr_conv;
7788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7789 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7790 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7791 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7796 LDKAcceptChannel this_ptr_conv;
7797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7799 LDKPublicKey val_ref;
7800 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7801 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7802 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7805 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7806 LDKAcceptChannel this_ptr_conv;
7807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7808 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7809 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7810 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7815 LDKAcceptChannel this_ptr_conv;
7816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7817 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7818 LDKPublicKey val_ref;
7819 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7820 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7821 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7824 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7825 LDKAcceptChannel this_ptr_conv;
7826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7827 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7828 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7829 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
7833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7834 LDKAcceptChannel this_ptr_conv;
7835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7836 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7837 LDKPublicKey val_ref;
7838 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7839 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7840 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
7843 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7844 LDKAcceptChannel this_ptr_conv;
7845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7846 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7847 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7848 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7853 LDKAcceptChannel this_ptr_conv;
7854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7855 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7856 LDKPublicKey val_ref;
7857 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7858 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7859 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7862 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7863 LDKAcceptChannel this_ptr_conv;
7864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7865 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7866 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7867 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
7871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7872 LDKAcceptChannel this_ptr_conv;
7873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7874 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7875 LDKPublicKey val_ref;
7876 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7877 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7878 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7881 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7882 LDKAcceptChannel this_ptr_conv;
7883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7884 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7885 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7886 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
7890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7891 LDKAcceptChannel this_ptr_conv;
7892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7893 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7894 LDKPublicKey val_ref;
7895 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7896 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7897 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7901 LDKFundingCreated this_ptr_conv;
7902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7903 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7904 FundingCreated_free(this_ptr_conv);
7907 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7908 LDKFundingCreated orig_conv;
7909 orig_conv.inner = (void*)(orig & (~1));
7910 orig_conv.is_owned = (orig & 1) || (orig == 0);
7911 LDKFundingCreated ret = FundingCreated_clone(&orig_conv);
7912 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7915 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7916 LDKFundingCreated this_ptr_conv;
7917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7918 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7919 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7920 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
7924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7925 LDKFundingCreated this_ptr_conv;
7926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7927 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7928 LDKThirtyTwoBytes val_ref;
7929 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7930 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7931 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
7934 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
7935 LDKFundingCreated this_ptr_conv;
7936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7937 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7938 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7939 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
7943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7944 LDKFundingCreated this_ptr_conv;
7945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7946 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7947 LDKThirtyTwoBytes val_ref;
7948 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7949 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7950 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
7953 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
7954 LDKFundingCreated this_ptr_conv;
7955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7956 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7957 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
7961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7962 LDKFundingCreated this_ptr_conv;
7963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7964 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7965 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
7968 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7969 LDKFundingCreated this_ptr_conv;
7970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7971 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7972 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7973 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
7977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7978 LDKFundingCreated this_ptr_conv;
7979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7980 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7981 LDKSignature val_ref;
7982 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7983 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7984 FundingCreated_set_signature(&this_ptr_conv, val_ref);
7987 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) {
7988 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
7989 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
7990 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
7991 LDKThirtyTwoBytes funding_txid_arg_ref;
7992 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
7993 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
7994 LDKSignature signature_arg_ref;
7995 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7996 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7997 LDKFundingCreated ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
7998 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8002 LDKFundingSigned this_ptr_conv;
8003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8004 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8005 FundingSigned_free(this_ptr_conv);
8008 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8009 LDKFundingSigned orig_conv;
8010 orig_conv.inner = (void*)(orig & (~1));
8011 orig_conv.is_owned = (orig & 1) || (orig == 0);
8012 LDKFundingSigned ret = FundingSigned_clone(&orig_conv);
8013 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8016 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8017 LDKFundingSigned this_ptr_conv;
8018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8019 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8020 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8021 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
8025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8026 LDKFundingSigned this_ptr_conv;
8027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8028 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8029 LDKThirtyTwoBytes val_ref;
8030 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8031 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8032 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
8035 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8036 LDKFundingSigned this_ptr_conv;
8037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8038 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8039 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8040 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
8044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8045 LDKFundingSigned this_ptr_conv;
8046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8047 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8048 LDKSignature val_ref;
8049 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8050 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8051 FundingSigned_set_signature(&this_ptr_conv, val_ref);
8054 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
8055 LDKThirtyTwoBytes channel_id_arg_ref;
8056 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8057 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8058 LDKSignature signature_arg_ref;
8059 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8060 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8061 LDKFundingSigned ret = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
8062 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8066 LDKFundingLocked this_ptr_conv;
8067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8068 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8069 FundingLocked_free(this_ptr_conv);
8072 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8073 LDKFundingLocked orig_conv;
8074 orig_conv.inner = (void*)(orig & (~1));
8075 orig_conv.is_owned = (orig & 1) || (orig == 0);
8076 LDKFundingLocked ret = FundingLocked_clone(&orig_conv);
8077 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8080 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8081 LDKFundingLocked this_ptr_conv;
8082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8083 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8084 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8085 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
8089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8090 LDKFundingLocked this_ptr_conv;
8091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8092 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8093 LDKThirtyTwoBytes val_ref;
8094 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8095 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8096 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
8099 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8100 LDKFundingLocked this_ptr_conv;
8101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8102 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8103 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8104 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8109 LDKFundingLocked this_ptr_conv;
8110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8111 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8112 LDKPublicKey val_ref;
8113 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8114 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8115 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8118 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
8119 LDKThirtyTwoBytes channel_id_arg_ref;
8120 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8121 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8122 LDKPublicKey next_per_commitment_point_arg_ref;
8123 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8124 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8125 LDKFundingLocked ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
8126 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8130 LDKShutdown this_ptr_conv;
8131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8132 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8133 Shutdown_free(this_ptr_conv);
8136 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8137 LDKShutdown orig_conv;
8138 orig_conv.inner = (void*)(orig & (~1));
8139 orig_conv.is_owned = (orig & 1) || (orig == 0);
8140 LDKShutdown ret = Shutdown_clone(&orig_conv);
8141 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8144 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8145 LDKShutdown this_ptr_conv;
8146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8147 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8148 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8149 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
8153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8154 LDKShutdown this_ptr_conv;
8155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8156 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8157 LDKThirtyTwoBytes val_ref;
8158 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8159 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8160 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8163 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8164 LDKShutdown this_ptr_conv;
8165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8166 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8167 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8168 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8169 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8174 LDKShutdown this_ptr_conv;
8175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8176 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8177 LDKCVec_u8Z val_ref;
8178 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
8179 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
8180 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8181 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
8184 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
8185 LDKThirtyTwoBytes channel_id_arg_ref;
8186 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8187 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8188 LDKCVec_u8Z scriptpubkey_arg_ref;
8189 scriptpubkey_arg_ref.data = (*_env)->GetByteArrayElements (_env, scriptpubkey_arg, NULL);
8190 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
8191 LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8192 (*_env)->ReleaseByteArrayElements(_env, scriptpubkey_arg, (int8_t*)scriptpubkey_arg_ref.data, 0);
8193 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8197 LDKClosingSigned this_ptr_conv;
8198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8199 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8200 ClosingSigned_free(this_ptr_conv);
8203 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8204 LDKClosingSigned orig_conv;
8205 orig_conv.inner = (void*)(orig & (~1));
8206 orig_conv.is_owned = (orig & 1) || (orig == 0);
8207 LDKClosingSigned ret = ClosingSigned_clone(&orig_conv);
8208 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8211 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8212 LDKClosingSigned this_ptr_conv;
8213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8214 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8215 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8216 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
8220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8221 LDKClosingSigned this_ptr_conv;
8222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8223 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8224 LDKThirtyTwoBytes val_ref;
8225 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8226 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8227 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
8230 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8231 LDKClosingSigned this_ptr_conv;
8232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8233 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8234 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
8238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8239 LDKClosingSigned this_ptr_conv;
8240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8241 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8242 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
8245 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8246 LDKClosingSigned this_ptr_conv;
8247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8248 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8249 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8250 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
8254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8255 LDKClosingSigned this_ptr_conv;
8256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8257 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8258 LDKSignature val_ref;
8259 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8260 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8261 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
8264 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) {
8265 LDKThirtyTwoBytes channel_id_arg_ref;
8266 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8267 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8268 LDKSignature signature_arg_ref;
8269 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8270 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8271 LDKClosingSigned ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
8272 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8276 LDKUpdateAddHTLC this_ptr_conv;
8277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8278 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8279 UpdateAddHTLC_free(this_ptr_conv);
8282 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8283 LDKUpdateAddHTLC orig_conv;
8284 orig_conv.inner = (void*)(orig & (~1));
8285 orig_conv.is_owned = (orig & 1) || (orig == 0);
8286 LDKUpdateAddHTLC ret = UpdateAddHTLC_clone(&orig_conv);
8287 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8290 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8291 LDKUpdateAddHTLC 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8295 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
8299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8300 LDKUpdateAddHTLC this_ptr_conv;
8301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8302 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8303 LDKThirtyTwoBytes val_ref;
8304 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8305 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8306 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
8309 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8310 LDKUpdateAddHTLC this_ptr_conv;
8311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8312 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8313 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
8317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8318 LDKUpdateAddHTLC this_ptr_conv;
8319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8320 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8321 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
8324 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8325 LDKUpdateAddHTLC this_ptr_conv;
8326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8327 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8328 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
8332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8333 LDKUpdateAddHTLC this_ptr_conv;
8334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8335 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8336 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
8339 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8340 LDKUpdateAddHTLC this_ptr_conv;
8341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8342 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8343 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8344 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
8348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8349 LDKUpdateAddHTLC this_ptr_conv;
8350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8351 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8352 LDKThirtyTwoBytes val_ref;
8353 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8354 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8355 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
8358 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
8359 LDKUpdateAddHTLC this_ptr_conv;
8360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8361 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8362 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
8366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8367 LDKUpdateAddHTLC this_ptr_conv;
8368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8369 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8370 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
8373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8374 LDKUpdateFulfillHTLC this_ptr_conv;
8375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8376 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8377 UpdateFulfillHTLC_free(this_ptr_conv);
8380 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8381 LDKUpdateFulfillHTLC orig_conv;
8382 orig_conv.inner = (void*)(orig & (~1));
8383 orig_conv.is_owned = (orig & 1) || (orig == 0);
8384 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_clone(&orig_conv);
8385 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8388 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8389 LDKUpdateFulfillHTLC this_ptr_conv;
8390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8391 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8392 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8393 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
8397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8398 LDKUpdateFulfillHTLC this_ptr_conv;
8399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8401 LDKThirtyTwoBytes val_ref;
8402 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8403 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8404 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
8407 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8408 LDKUpdateFulfillHTLC this_ptr_conv;
8409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8410 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8411 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
8415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8416 LDKUpdateFulfillHTLC this_ptr_conv;
8417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8418 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8419 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
8422 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
8423 LDKUpdateFulfillHTLC this_ptr_conv;
8424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8425 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8426 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8427 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
8431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8432 LDKUpdateFulfillHTLC this_ptr_conv;
8433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8434 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8435 LDKThirtyTwoBytes val_ref;
8436 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8437 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8438 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
8441 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) {
8442 LDKThirtyTwoBytes channel_id_arg_ref;
8443 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8444 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8445 LDKThirtyTwoBytes payment_preimage_arg_ref;
8446 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
8447 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
8448 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
8449 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8453 LDKUpdateFailHTLC this_ptr_conv;
8454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8455 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8456 UpdateFailHTLC_free(this_ptr_conv);
8459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8460 LDKUpdateFailHTLC orig_conv;
8461 orig_conv.inner = (void*)(orig & (~1));
8462 orig_conv.is_owned = (orig & 1) || (orig == 0);
8463 LDKUpdateFailHTLC ret = UpdateFailHTLC_clone(&orig_conv);
8464 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8467 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8468 LDKUpdateFailHTLC this_ptr_conv;
8469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8471 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8472 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
8476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8477 LDKUpdateFailHTLC this_ptr_conv;
8478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8479 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8480 LDKThirtyTwoBytes val_ref;
8481 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8482 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8483 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
8486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8487 LDKUpdateFailHTLC this_ptr_conv;
8488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8489 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8490 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
8494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8495 LDKUpdateFailHTLC this_ptr_conv;
8496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8497 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8498 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
8501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8502 LDKUpdateFailMalformedHTLC this_ptr_conv;
8503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8504 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8505 UpdateFailMalformedHTLC_free(this_ptr_conv);
8508 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8509 LDKUpdateFailMalformedHTLC orig_conv;
8510 orig_conv.inner = (void*)(orig & (~1));
8511 orig_conv.is_owned = (orig & 1) || (orig == 0);
8512 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_clone(&orig_conv);
8513 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8516 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8517 LDKUpdateFailMalformedHTLC this_ptr_conv;
8518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8519 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8520 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8521 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
8525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8526 LDKUpdateFailMalformedHTLC this_ptr_conv;
8527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8528 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8529 LDKThirtyTwoBytes val_ref;
8530 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8531 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8532 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
8535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8536 LDKUpdateFailMalformedHTLC this_ptr_conv;
8537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8538 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8539 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
8543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8544 LDKUpdateFailMalformedHTLC this_ptr_conv;
8545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8546 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8547 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
8550 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
8551 LDKUpdateFailMalformedHTLC this_ptr_conv;
8552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8554 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
8558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8559 LDKUpdateFailMalformedHTLC this_ptr_conv;
8560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8561 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8562 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
8565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8566 LDKCommitmentSigned this_ptr_conv;
8567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8569 CommitmentSigned_free(this_ptr_conv);
8572 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8573 LDKCommitmentSigned orig_conv;
8574 orig_conv.inner = (void*)(orig & (~1));
8575 orig_conv.is_owned = (orig & 1) || (orig == 0);
8576 LDKCommitmentSigned ret = CommitmentSigned_clone(&orig_conv);
8577 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8580 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8581 LDKCommitmentSigned this_ptr_conv;
8582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8583 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8584 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8585 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
8589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8590 LDKCommitmentSigned this_ptr_conv;
8591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8592 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8593 LDKThirtyTwoBytes val_ref;
8594 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8595 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8596 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
8599 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8600 LDKCommitmentSigned 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8604 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
8608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8609 LDKCommitmentSigned this_ptr_conv;
8610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8611 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8612 LDKSignature val_ref;
8613 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8614 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8615 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
8618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
8619 LDKCommitmentSigned this_ptr_conv;
8620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8621 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8622 LDKCVec_SignatureZ val_constr;
8623 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
8624 if (val_constr.datalen > 0)
8625 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8627 val_constr.data = NULL;
8628 for (size_t i = 0; i < val_constr.datalen; i++) {
8629 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
8630 LDKSignature arr_conv_8_ref;
8631 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
8632 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
8633 val_constr.data[i] = arr_conv_8_ref;
8635 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
8638 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) {
8639 LDKThirtyTwoBytes channel_id_arg_ref;
8640 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8641 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8642 LDKSignature signature_arg_ref;
8643 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8644 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8645 LDKCVec_SignatureZ htlc_signatures_arg_constr;
8646 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
8647 if (htlc_signatures_arg_constr.datalen > 0)
8648 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8650 htlc_signatures_arg_constr.data = NULL;
8651 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
8652 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
8653 LDKSignature arr_conv_8_ref;
8654 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
8655 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
8656 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
8658 LDKCommitmentSigned ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
8659 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8663 LDKRevokeAndACK this_ptr_conv;
8664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8665 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8666 RevokeAndACK_free(this_ptr_conv);
8669 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8670 LDKRevokeAndACK orig_conv;
8671 orig_conv.inner = (void*)(orig & (~1));
8672 orig_conv.is_owned = (orig & 1) || (orig == 0);
8673 LDKRevokeAndACK ret = RevokeAndACK_clone(&orig_conv);
8674 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8677 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8678 LDKRevokeAndACK this_ptr_conv;
8679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8680 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8681 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8682 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
8686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8687 LDKRevokeAndACK this_ptr_conv;
8688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8690 LDKThirtyTwoBytes val_ref;
8691 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8692 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8693 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
8696 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
8697 LDKRevokeAndACK this_ptr_conv;
8698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8699 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8700 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8701 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
8705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8706 LDKRevokeAndACK 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 LDKThirtyTwoBytes val_ref;
8710 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8711 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8712 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
8715 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8716 LDKRevokeAndACK this_ptr_conv;
8717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8718 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8719 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8720 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8725 LDKRevokeAndACK this_ptr_conv;
8726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8728 LDKPublicKey val_ref;
8729 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8730 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8731 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8734 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) {
8735 LDKThirtyTwoBytes channel_id_arg_ref;
8736 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8737 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8738 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
8739 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
8740 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
8741 LDKPublicKey next_per_commitment_point_arg_ref;
8742 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8743 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8744 LDKRevokeAndACK ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
8745 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8749 LDKUpdateFee this_ptr_conv;
8750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8751 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8752 UpdateFee_free(this_ptr_conv);
8755 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8756 LDKUpdateFee orig_conv;
8757 orig_conv.inner = (void*)(orig & (~1));
8758 orig_conv.is_owned = (orig & 1) || (orig == 0);
8759 LDKUpdateFee ret = UpdateFee_clone(&orig_conv);
8760 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8763 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8764 LDKUpdateFee this_ptr_conv;
8765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8766 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8767 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8768 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
8772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8773 LDKUpdateFee this_ptr_conv;
8774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8776 LDKThirtyTwoBytes val_ref;
8777 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8778 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8779 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
8782 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
8783 LDKUpdateFee this_ptr_conv;
8784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8785 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8786 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
8790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8791 LDKUpdateFee this_ptr_conv;
8792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8793 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8794 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
8797 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
8798 LDKThirtyTwoBytes channel_id_arg_ref;
8799 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8800 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8801 LDKUpdateFee ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
8802 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8806 LDKDataLossProtect this_ptr_conv;
8807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8808 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8809 DataLossProtect_free(this_ptr_conv);
8812 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8813 LDKDataLossProtect orig_conv;
8814 orig_conv.inner = (void*)(orig & (~1));
8815 orig_conv.is_owned = (orig & 1) || (orig == 0);
8816 LDKDataLossProtect ret = DataLossProtect_clone(&orig_conv);
8817 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8820 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
8821 LDKDataLossProtect this_ptr_conv;
8822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8823 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8824 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8825 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
8829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8830 LDKDataLossProtect this_ptr_conv;
8831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8832 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8833 LDKThirtyTwoBytes val_ref;
8834 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8835 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8836 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
8839 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8840 LDKDataLossProtect this_ptr_conv;
8841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8842 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8843 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8844 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
8848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8849 LDKDataLossProtect this_ptr_conv;
8850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8851 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8852 LDKPublicKey val_ref;
8853 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8854 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8855 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
8858 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) {
8859 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
8860 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
8861 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
8862 LDKPublicKey my_current_per_commitment_point_arg_ref;
8863 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
8864 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
8865 LDKDataLossProtect ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
8866 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8870 LDKChannelReestablish this_ptr_conv;
8871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8872 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8873 ChannelReestablish_free(this_ptr_conv);
8876 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8877 LDKChannelReestablish orig_conv;
8878 orig_conv.inner = (void*)(orig & (~1));
8879 orig_conv.is_owned = (orig & 1) || (orig == 0);
8880 LDKChannelReestablish ret = ChannelReestablish_clone(&orig_conv);
8881 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8884 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8885 LDKChannelReestablish this_ptr_conv;
8886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8887 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8888 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8889 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
8893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8894 LDKChannelReestablish this_ptr_conv;
8895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8896 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8897 LDKThirtyTwoBytes val_ref;
8898 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8899 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8900 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
8903 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8904 LDKChannelReestablish this_ptr_conv;
8905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8906 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8907 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
8911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8912 LDKChannelReestablish this_ptr_conv;
8913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8914 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8915 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
8918 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8919 LDKChannelReestablish this_ptr_conv;
8920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8921 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8922 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
8926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8927 LDKChannelReestablish this_ptr_conv;
8928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8929 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8930 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
8933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8934 LDKAnnouncementSignatures this_ptr_conv;
8935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8936 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8937 AnnouncementSignatures_free(this_ptr_conv);
8940 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8941 LDKAnnouncementSignatures orig_conv;
8942 orig_conv.inner = (void*)(orig & (~1));
8943 orig_conv.is_owned = (orig & 1) || (orig == 0);
8944 LDKAnnouncementSignatures ret = AnnouncementSignatures_clone(&orig_conv);
8945 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8948 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8949 LDKAnnouncementSignatures this_ptr_conv;
8950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8951 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8952 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8953 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
8957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8958 LDKAnnouncementSignatures this_ptr_conv;
8959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8961 LDKThirtyTwoBytes val_ref;
8962 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8963 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8964 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
8967 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8968 LDKAnnouncementSignatures this_ptr_conv;
8969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8970 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8971 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
8975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8976 LDKAnnouncementSignatures this_ptr_conv;
8977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8978 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8979 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
8982 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8983 LDKAnnouncementSignatures this_ptr_conv;
8984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8985 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8986 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8987 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
8991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8992 LDKAnnouncementSignatures this_ptr_conv;
8993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8994 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8995 LDKSignature val_ref;
8996 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8997 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8998 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
9001 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9002 LDKAnnouncementSignatures this_ptr_conv;
9003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9004 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9005 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9006 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
9010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9011 LDKAnnouncementSignatures this_ptr_conv;
9012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9013 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9014 LDKSignature val_ref;
9015 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9016 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9017 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
9020 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) {
9021 LDKThirtyTwoBytes channel_id_arg_ref;
9022 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9023 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9024 LDKSignature node_signature_arg_ref;
9025 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
9026 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
9027 LDKSignature bitcoin_signature_arg_ref;
9028 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
9029 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
9030 LDKAnnouncementSignatures ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
9031 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9035 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
9036 FREE((void*)this_ptr);
9037 NetAddress_free(this_ptr_conv);
9040 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9041 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
9042 LDKNetAddress* ret = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9043 *ret = NetAddress_clone(orig_conv);
9047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9048 LDKUnsignedNodeAnnouncement this_ptr_conv;
9049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9051 UnsignedNodeAnnouncement_free(this_ptr_conv);
9054 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9055 LDKUnsignedNodeAnnouncement orig_conv;
9056 orig_conv.inner = (void*)(orig & (~1));
9057 orig_conv.is_owned = (orig & 1) || (orig == 0);
9058 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_clone(&orig_conv);
9059 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9062 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9063 LDKUnsignedNodeAnnouncement this_ptr_conv;
9064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9066 LDKNodeFeatures ret = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9067 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9071 LDKUnsignedNodeAnnouncement this_ptr_conv;
9072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9073 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9074 LDKNodeFeatures val_conv;
9075 val_conv.inner = (void*)(val & (~1));
9076 val_conv.is_owned = (val & 1) || (val == 0);
9077 // Warning: we may need a move here but can't clone!
9078 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9081 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9082 LDKUnsignedNodeAnnouncement this_ptr_conv;
9083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9084 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9085 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9090 LDKUnsignedNodeAnnouncement this_ptr_conv;
9091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9092 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9093 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9096 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9097 LDKUnsignedNodeAnnouncement this_ptr_conv;
9098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9099 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9100 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9101 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
9105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9106 LDKUnsignedNodeAnnouncement this_ptr_conv;
9107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9109 LDKPublicKey val_ref;
9110 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9111 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9112 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
9115 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
9116 LDKUnsignedNodeAnnouncement this_ptr_conv;
9117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9118 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9119 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
9120 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
9124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9125 LDKUnsignedNodeAnnouncement this_ptr_conv;
9126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9127 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9128 LDKThreeBytes val_ref;
9129 CHECK((*_env)->GetArrayLength (_env, val) == 3);
9130 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
9131 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
9134 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
9135 LDKUnsignedNodeAnnouncement this_ptr_conv;
9136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9137 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9138 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9139 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
9143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9144 LDKUnsignedNodeAnnouncement this_ptr_conv;
9145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9146 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9147 LDKThirtyTwoBytes val_ref;
9148 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9149 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9150 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
9153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9154 LDKUnsignedNodeAnnouncement this_ptr_conv;
9155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9156 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9157 LDKCVec_NetAddressZ val_constr;
9158 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9159 if (val_constr.datalen > 0)
9160 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9162 val_constr.data = NULL;
9163 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9164 for (size_t m = 0; m < val_constr.datalen; m++) {
9165 long arr_conv_12 = val_vals[m];
9166 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9167 FREE((void*)arr_conv_12);
9168 val_constr.data[m] = arr_conv_12_conv;
9170 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9171 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
9174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9175 LDKNodeAnnouncement this_ptr_conv;
9176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9177 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9178 NodeAnnouncement_free(this_ptr_conv);
9181 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9182 LDKNodeAnnouncement orig_conv;
9183 orig_conv.inner = (void*)(orig & (~1));
9184 orig_conv.is_owned = (orig & 1) || (orig == 0);
9185 LDKNodeAnnouncement ret = NodeAnnouncement_clone(&orig_conv);
9186 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9189 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9190 LDKNodeAnnouncement this_ptr_conv;
9191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9192 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9193 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9194 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
9198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9199 LDKNodeAnnouncement this_ptr_conv;
9200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9201 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9202 LDKSignature val_ref;
9203 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9204 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9205 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
9208 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9209 LDKNodeAnnouncement this_ptr_conv;
9210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9211 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9212 LDKUnsignedNodeAnnouncement ret = NodeAnnouncement_get_contents(&this_ptr_conv);
9213 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9217 LDKNodeAnnouncement this_ptr_conv;
9218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9219 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9220 LDKUnsignedNodeAnnouncement val_conv;
9221 val_conv.inner = (void*)(val & (~1));
9222 val_conv.is_owned = (val & 1) || (val == 0);
9223 if (val_conv.inner != NULL)
9224 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
9225 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
9228 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9229 LDKSignature signature_arg_ref;
9230 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9231 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9232 LDKUnsignedNodeAnnouncement contents_arg_conv;
9233 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9234 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9235 if (contents_arg_conv.inner != NULL)
9236 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
9237 LDKNodeAnnouncement ret = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
9238 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9242 LDKUnsignedChannelAnnouncement this_ptr_conv;
9243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9244 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9245 UnsignedChannelAnnouncement_free(this_ptr_conv);
9248 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9249 LDKUnsignedChannelAnnouncement orig_conv;
9250 orig_conv.inner = (void*)(orig & (~1));
9251 orig_conv.is_owned = (orig & 1) || (orig == 0);
9252 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_clone(&orig_conv);
9253 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9256 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9257 LDKUnsignedChannelAnnouncement this_ptr_conv;
9258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9259 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9260 LDKChannelFeatures ret = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
9261 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9265 LDKUnsignedChannelAnnouncement this_ptr_conv;
9266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9268 LDKChannelFeatures val_conv;
9269 val_conv.inner = (void*)(val & (~1));
9270 val_conv.is_owned = (val & 1) || (val == 0);
9271 // Warning: we may need a move here but can't clone!
9272 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
9275 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9276 LDKUnsignedChannelAnnouncement this_ptr_conv;
9277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9278 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9279 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9280 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
9284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9285 LDKUnsignedChannelAnnouncement this_ptr_conv;
9286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9288 LDKThirtyTwoBytes val_ref;
9289 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9290 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9291 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
9294 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9295 LDKUnsignedChannelAnnouncement this_ptr_conv;
9296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9297 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9298 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
9302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9303 LDKUnsignedChannelAnnouncement this_ptr_conv;
9304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9305 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9306 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
9309 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9310 LDKUnsignedChannelAnnouncement this_ptr_conv;
9311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9312 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9313 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9314 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
9318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9319 LDKUnsignedChannelAnnouncement this_ptr_conv;
9320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9321 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9322 LDKPublicKey val_ref;
9323 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9324 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9325 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
9328 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9329 LDKUnsignedChannelAnnouncement this_ptr_conv;
9330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9331 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9332 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9333 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
9337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9338 LDKUnsignedChannelAnnouncement this_ptr_conv;
9339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9340 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9341 LDKPublicKey val_ref;
9342 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9343 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9344 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
9347 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9348 LDKUnsignedChannelAnnouncement this_ptr_conv;
9349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9351 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9352 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
9356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9357 LDKUnsignedChannelAnnouncement this_ptr_conv;
9358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9359 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9360 LDKPublicKey val_ref;
9361 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9362 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9363 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
9366 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9367 LDKUnsignedChannelAnnouncement this_ptr_conv;
9368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9369 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9370 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9371 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
9375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9376 LDKUnsignedChannelAnnouncement this_ptr_conv;
9377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9378 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9379 LDKPublicKey val_ref;
9380 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9381 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9382 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
9385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9386 LDKChannelAnnouncement this_ptr_conv;
9387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9388 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9389 ChannelAnnouncement_free(this_ptr_conv);
9392 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9393 LDKChannelAnnouncement orig_conv;
9394 orig_conv.inner = (void*)(orig & (~1));
9395 orig_conv.is_owned = (orig & 1) || (orig == 0);
9396 LDKChannelAnnouncement ret = ChannelAnnouncement_clone(&orig_conv);
9397 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9400 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9401 LDKChannelAnnouncement this_ptr_conv;
9402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9404 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9405 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
9409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9410 LDKChannelAnnouncement this_ptr_conv;
9411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9412 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9413 LDKSignature val_ref;
9414 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9415 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9416 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
9419 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9420 LDKChannelAnnouncement this_ptr_conv;
9421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9422 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9423 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9424 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
9428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9429 LDKChannelAnnouncement this_ptr_conv;
9430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9431 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9432 LDKSignature val_ref;
9433 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9434 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9435 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
9438 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9439 LDKChannelAnnouncement this_ptr_conv;
9440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9441 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9442 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9443 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
9447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9448 LDKChannelAnnouncement this_ptr_conv;
9449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9450 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9451 LDKSignature val_ref;
9452 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9453 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9454 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
9457 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9458 LDKChannelAnnouncement this_ptr_conv;
9459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9460 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9461 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9462 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
9466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9467 LDKChannelAnnouncement this_ptr_conv;
9468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9469 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9470 LDKSignature val_ref;
9471 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9472 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9473 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
9476 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9477 LDKChannelAnnouncement this_ptr_conv;
9478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9479 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9480 LDKUnsignedChannelAnnouncement ret = ChannelAnnouncement_get_contents(&this_ptr_conv);
9481 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9485 LDKChannelAnnouncement this_ptr_conv;
9486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9487 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9488 LDKUnsignedChannelAnnouncement val_conv;
9489 val_conv.inner = (void*)(val & (~1));
9490 val_conv.is_owned = (val & 1) || (val == 0);
9491 if (val_conv.inner != NULL)
9492 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
9493 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
9496 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) {
9497 LDKSignature node_signature_1_arg_ref;
9498 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
9499 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
9500 LDKSignature node_signature_2_arg_ref;
9501 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
9502 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
9503 LDKSignature bitcoin_signature_1_arg_ref;
9504 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
9505 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
9506 LDKSignature bitcoin_signature_2_arg_ref;
9507 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
9508 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
9509 LDKUnsignedChannelAnnouncement contents_arg_conv;
9510 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9511 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9512 if (contents_arg_conv.inner != NULL)
9513 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
9514 LDKChannelAnnouncement ret = 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);
9515 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9519 LDKUnsignedChannelUpdate this_ptr_conv;
9520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9521 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9522 UnsignedChannelUpdate_free(this_ptr_conv);
9525 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9526 LDKUnsignedChannelUpdate orig_conv;
9527 orig_conv.inner = (void*)(orig & (~1));
9528 orig_conv.is_owned = (orig & 1) || (orig == 0);
9529 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_clone(&orig_conv);
9530 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9533 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9534 LDKUnsignedChannelUpdate this_ptr_conv;
9535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9536 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9537 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9538 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
9542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9543 LDKUnsignedChannelUpdate this_ptr_conv;
9544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9545 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9546 LDKThirtyTwoBytes val_ref;
9547 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9548 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9549 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
9552 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9553 LDKUnsignedChannelUpdate this_ptr_conv;
9554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9555 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9556 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
9560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9561 LDKUnsignedChannelUpdate this_ptr_conv;
9562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9563 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9564 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
9567 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9568 LDKUnsignedChannelUpdate this_ptr_conv;
9569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9570 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9571 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
9575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9576 LDKUnsignedChannelUpdate this_ptr_conv;
9577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9579 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
9582 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
9583 LDKUnsignedChannelUpdate this_ptr_conv;
9584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9585 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9586 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
9590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
9591 LDKUnsignedChannelUpdate this_ptr_conv;
9592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9593 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9594 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
9597 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
9598 LDKUnsignedChannelUpdate this_ptr_conv;
9599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9600 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9601 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
9605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9606 LDKUnsignedChannelUpdate this_ptr_conv;
9607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9608 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9609 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
9612 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9613 LDKUnsignedChannelUpdate this_ptr_conv;
9614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9615 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9616 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
9620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9621 LDKUnsignedChannelUpdate this_ptr_conv;
9622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9623 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9624 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
9627 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9628 LDKUnsignedChannelUpdate this_ptr_conv;
9629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9630 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9631 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
9635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9636 LDKUnsignedChannelUpdate this_ptr_conv;
9637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9639 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
9642 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
9643 LDKUnsignedChannelUpdate this_ptr_conv;
9644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9645 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9646 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
9650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9651 LDKUnsignedChannelUpdate 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 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
9657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9658 LDKChannelUpdate this_ptr_conv;
9659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9660 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9661 ChannelUpdate_free(this_ptr_conv);
9664 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9665 LDKChannelUpdate orig_conv;
9666 orig_conv.inner = (void*)(orig & (~1));
9667 orig_conv.is_owned = (orig & 1) || (orig == 0);
9668 LDKChannelUpdate ret = ChannelUpdate_clone(&orig_conv);
9669 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9672 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9673 LDKChannelUpdate this_ptr_conv;
9674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9675 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9676 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9677 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
9681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9682 LDKChannelUpdate this_ptr_conv;
9683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9684 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9685 LDKSignature val_ref;
9686 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9687 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9688 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
9691 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9692 LDKChannelUpdate this_ptr_conv;
9693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9694 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9695 LDKUnsignedChannelUpdate ret = ChannelUpdate_get_contents(&this_ptr_conv);
9696 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9700 LDKChannelUpdate this_ptr_conv;
9701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9702 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9703 LDKUnsignedChannelUpdate val_conv;
9704 val_conv.inner = (void*)(val & (~1));
9705 val_conv.is_owned = (val & 1) || (val == 0);
9706 if (val_conv.inner != NULL)
9707 val_conv = UnsignedChannelUpdate_clone(&val_conv);
9708 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
9711 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9712 LDKSignature signature_arg_ref;
9713 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9714 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9715 LDKUnsignedChannelUpdate contents_arg_conv;
9716 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9717 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9718 if (contents_arg_conv.inner != NULL)
9719 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
9720 LDKChannelUpdate ret = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
9721 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9725 LDKQueryChannelRange this_ptr_conv;
9726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9728 QueryChannelRange_free(this_ptr_conv);
9731 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9732 LDKQueryChannelRange orig_conv;
9733 orig_conv.inner = (void*)(orig & (~1));
9734 orig_conv.is_owned = (orig & 1) || (orig == 0);
9735 LDKQueryChannelRange ret = QueryChannelRange_clone(&orig_conv);
9736 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9739 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9740 LDKQueryChannelRange this_ptr_conv;
9741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9742 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9743 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9744 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
9748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9749 LDKQueryChannelRange this_ptr_conv;
9750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9751 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9752 LDKThirtyTwoBytes val_ref;
9753 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9754 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9755 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9758 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9759 LDKQueryChannelRange this_ptr_conv;
9760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9761 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9762 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
9766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9767 LDKQueryChannelRange this_ptr_conv;
9768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9769 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9770 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
9773 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9774 LDKQueryChannelRange this_ptr_conv;
9775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9776 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9777 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
9781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9782 LDKQueryChannelRange 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 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9788 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) {
9789 LDKThirtyTwoBytes chain_hash_arg_ref;
9790 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9791 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9792 LDKQueryChannelRange ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
9793 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9797 LDKReplyChannelRange this_ptr_conv;
9798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9799 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9800 ReplyChannelRange_free(this_ptr_conv);
9803 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9804 LDKReplyChannelRange orig_conv;
9805 orig_conv.inner = (void*)(orig & (~1));
9806 orig_conv.is_owned = (orig & 1) || (orig == 0);
9807 LDKReplyChannelRange ret = ReplyChannelRange_clone(&orig_conv);
9808 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9811 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9812 LDKReplyChannelRange this_ptr_conv;
9813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9814 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9815 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9816 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
9820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9821 LDKReplyChannelRange this_ptr_conv;
9822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9823 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9824 LDKThirtyTwoBytes val_ref;
9825 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9826 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9827 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9830 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9831 LDKReplyChannelRange this_ptr_conv;
9832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9834 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
9838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9839 LDKReplyChannelRange this_ptr_conv;
9840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9841 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9842 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
9845 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9846 LDKReplyChannelRange this_ptr_conv;
9847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9848 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9849 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
9853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9854 LDKReplyChannelRange 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 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9860 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9861 LDKReplyChannelRange this_ptr_conv;
9862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9863 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9864 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
9868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9869 LDKReplyChannelRange this_ptr_conv;
9870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9871 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9872 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
9875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9876 LDKReplyChannelRange this_ptr_conv;
9877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9879 LDKCVec_u64Z val_constr;
9880 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9881 if (val_constr.datalen > 0)
9882 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9884 val_constr.data = NULL;
9885 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9886 for (size_t g = 0; g < val_constr.datalen; g++) {
9887 long arr_conv_6 = val_vals[g];
9888 val_constr.data[g] = arr_conv_6;
9890 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9891 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
9894 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) {
9895 LDKThirtyTwoBytes chain_hash_arg_ref;
9896 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9897 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9898 LDKCVec_u64Z short_channel_ids_arg_constr;
9899 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
9900 if (short_channel_ids_arg_constr.datalen > 0)
9901 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9903 short_channel_ids_arg_constr.data = NULL;
9904 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
9905 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
9906 long arr_conv_6 = short_channel_ids_arg_vals[g];
9907 short_channel_ids_arg_constr.data[g] = arr_conv_6;
9909 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
9910 LDKReplyChannelRange ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
9911 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9915 LDKQueryShortChannelIds this_ptr_conv;
9916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9917 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9918 QueryShortChannelIds_free(this_ptr_conv);
9921 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9922 LDKQueryShortChannelIds orig_conv;
9923 orig_conv.inner = (void*)(orig & (~1));
9924 orig_conv.is_owned = (orig & 1) || (orig == 0);
9925 LDKQueryShortChannelIds ret = QueryShortChannelIds_clone(&orig_conv);
9926 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9929 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9930 LDKQueryShortChannelIds this_ptr_conv;
9931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9932 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9933 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9934 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
9938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9939 LDKQueryShortChannelIds this_ptr_conv;
9940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9941 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9942 LDKThirtyTwoBytes val_ref;
9943 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9944 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9945 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
9948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9949 LDKQueryShortChannelIds this_ptr_conv;
9950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9951 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9952 LDKCVec_u64Z val_constr;
9953 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9954 if (val_constr.datalen > 0)
9955 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9957 val_constr.data = NULL;
9958 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9959 for (size_t g = 0; g < val_constr.datalen; g++) {
9960 long arr_conv_6 = val_vals[g];
9961 val_constr.data[g] = arr_conv_6;
9963 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9964 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
9967 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
9968 LDKThirtyTwoBytes chain_hash_arg_ref;
9969 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9970 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9971 LDKCVec_u64Z short_channel_ids_arg_constr;
9972 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
9973 if (short_channel_ids_arg_constr.datalen > 0)
9974 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9976 short_channel_ids_arg_constr.data = NULL;
9977 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
9978 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
9979 long arr_conv_6 = short_channel_ids_arg_vals[g];
9980 short_channel_ids_arg_constr.data[g] = arr_conv_6;
9982 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
9983 LDKQueryShortChannelIds ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
9984 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9988 LDKReplyShortChannelIdsEnd this_ptr_conv;
9989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9990 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9991 ReplyShortChannelIdsEnd_free(this_ptr_conv);
9994 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9995 LDKReplyShortChannelIdsEnd orig_conv;
9996 orig_conv.inner = (void*)(orig & (~1));
9997 orig_conv.is_owned = (orig & 1) || (orig == 0);
9998 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_clone(&orig_conv);
9999 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10002 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10003 LDKReplyShortChannelIdsEnd 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10007 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
10011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10012 LDKReplyShortChannelIdsEnd this_ptr_conv;
10013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10014 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10015 LDKThirtyTwoBytes val_ref;
10016 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10017 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10018 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
10021 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10022 LDKReplyShortChannelIdsEnd this_ptr_conv;
10023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10024 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10025 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
10029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10030 LDKReplyShortChannelIdsEnd this_ptr_conv;
10031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10032 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10033 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
10036 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
10037 LDKThirtyTwoBytes chain_hash_arg_ref;
10038 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10039 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10040 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
10041 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10045 LDKGossipTimestampFilter this_ptr_conv;
10046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10047 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10048 GossipTimestampFilter_free(this_ptr_conv);
10051 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10052 LDKGossipTimestampFilter orig_conv;
10053 orig_conv.inner = (void*)(orig & (~1));
10054 orig_conv.is_owned = (orig & 1) || (orig == 0);
10055 LDKGossipTimestampFilter ret = GossipTimestampFilter_clone(&orig_conv);
10056 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10059 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10060 LDKGossipTimestampFilter this_ptr_conv;
10061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10062 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10063 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10064 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
10068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10069 LDKGossipTimestampFilter this_ptr_conv;
10070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10072 LDKThirtyTwoBytes val_ref;
10073 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10074 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10075 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
10078 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10079 LDKGossipTimestampFilter this_ptr_conv;
10080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10081 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10082 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
10086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10087 LDKGossipTimestampFilter this_ptr_conv;
10088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10089 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10090 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
10093 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
10094 LDKGossipTimestampFilter this_ptr_conv;
10095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10096 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10097 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
10101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10102 LDKGossipTimestampFilter this_ptr_conv;
10103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10104 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10105 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
10108 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) {
10109 LDKThirtyTwoBytes chain_hash_arg_ref;
10110 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10111 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10112 LDKGossipTimestampFilter ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
10113 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10117 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
10118 FREE((void*)this_ptr);
10119 ErrorAction_free(this_ptr_conv);
10122 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10123 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
10124 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10125 *ret = ErrorAction_clone(orig_conv);
10129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10130 LDKLightningError this_ptr_conv;
10131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10132 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10133 LightningError_free(this_ptr_conv);
10136 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
10137 LDKLightningError this_ptr_conv;
10138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10139 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10140 LDKStr _str = LightningError_get_err(&this_ptr_conv);
10141 char* _buf = MALLOC(_str.len + 1, "str conv buf");
10142 memcpy(_buf, _str.chars, _str.len);
10143 _buf[_str.len] = 0;
10144 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
10149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10150 LDKLightningError this_ptr_conv;
10151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10152 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10153 LDKCVec_u8Z val_ref;
10154 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
10155 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
10156 LightningError_set_err(&this_ptr_conv, val_ref);
10157 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
10160 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
10161 LDKLightningError this_ptr_conv;
10162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10163 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10164 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10165 *ret = LightningError_get_action(&this_ptr_conv);
10169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10170 LDKLightningError this_ptr_conv;
10171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10172 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10173 LDKErrorAction val_conv = *(LDKErrorAction*)val;
10175 LightningError_set_action(&this_ptr_conv, val_conv);
10178 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
10179 LDKCVec_u8Z err_arg_ref;
10180 err_arg_ref.data = (*_env)->GetByteArrayElements (_env, err_arg, NULL);
10181 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
10182 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
10183 FREE((void*)action_arg);
10184 LDKLightningError ret = LightningError_new(err_arg_ref, action_arg_conv);
10185 (*_env)->ReleaseByteArrayElements(_env, err_arg, (int8_t*)err_arg_ref.data, 0);
10186 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10190 LDKCommitmentUpdate this_ptr_conv;
10191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10192 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10193 CommitmentUpdate_free(this_ptr_conv);
10196 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10197 LDKCommitmentUpdate orig_conv;
10198 orig_conv.inner = (void*)(orig & (~1));
10199 orig_conv.is_owned = (orig & 1) || (orig == 0);
10200 LDKCommitmentUpdate ret = CommitmentUpdate_clone(&orig_conv);
10201 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10205 LDKCommitmentUpdate this_ptr_conv;
10206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10207 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10208 LDKCVec_UpdateAddHTLCZ val_constr;
10209 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10210 if (val_constr.datalen > 0)
10211 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10213 val_constr.data = NULL;
10214 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10215 for (size_t p = 0; p < val_constr.datalen; p++) {
10216 long arr_conv_15 = val_vals[p];
10217 LDKUpdateAddHTLC arr_conv_15_conv;
10218 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10219 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10220 if (arr_conv_15_conv.inner != NULL)
10221 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10222 val_constr.data[p] = arr_conv_15_conv;
10224 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10225 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
10228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10229 LDKCommitmentUpdate this_ptr_conv;
10230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10231 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10232 LDKCVec_UpdateFulfillHTLCZ val_constr;
10233 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10234 if (val_constr.datalen > 0)
10235 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10237 val_constr.data = NULL;
10238 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10239 for (size_t t = 0; t < val_constr.datalen; t++) {
10240 long arr_conv_19 = val_vals[t];
10241 LDKUpdateFulfillHTLC arr_conv_19_conv;
10242 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10243 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10244 if (arr_conv_19_conv.inner != NULL)
10245 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10246 val_constr.data[t] = arr_conv_19_conv;
10248 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10249 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
10252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10253 LDKCommitmentUpdate this_ptr_conv;
10254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10255 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10256 LDKCVec_UpdateFailHTLCZ val_constr;
10257 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10258 if (val_constr.datalen > 0)
10259 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10261 val_constr.data = NULL;
10262 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10263 for (size_t q = 0; q < val_constr.datalen; q++) {
10264 long arr_conv_16 = val_vals[q];
10265 LDKUpdateFailHTLC arr_conv_16_conv;
10266 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10267 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10268 if (arr_conv_16_conv.inner != NULL)
10269 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
10270 val_constr.data[q] = arr_conv_16_conv;
10272 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10273 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
10276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10277 LDKCommitmentUpdate this_ptr_conv;
10278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10279 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10280 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
10281 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10282 if (val_constr.datalen > 0)
10283 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10285 val_constr.data = NULL;
10286 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10287 for (size_t z = 0; z < val_constr.datalen; z++) {
10288 long arr_conv_25 = val_vals[z];
10289 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
10290 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
10291 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
10292 if (arr_conv_25_conv.inner != NULL)
10293 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
10294 val_constr.data[z] = arr_conv_25_conv;
10296 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10297 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
10300 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
10301 LDKCommitmentUpdate this_ptr_conv;
10302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10303 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10304 LDKUpdateFee ret = CommitmentUpdate_get_update_fee(&this_ptr_conv);
10305 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10309 LDKCommitmentUpdate this_ptr_conv;
10310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10311 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10312 LDKUpdateFee val_conv;
10313 val_conv.inner = (void*)(val & (~1));
10314 val_conv.is_owned = (val & 1) || (val == 0);
10315 if (val_conv.inner != NULL)
10316 val_conv = UpdateFee_clone(&val_conv);
10317 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
10320 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
10321 LDKCommitmentUpdate 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 LDKCommitmentSigned ret = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
10325 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10329 LDKCommitmentUpdate this_ptr_conv;
10330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10331 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10332 LDKCommitmentSigned val_conv;
10333 val_conv.inner = (void*)(val & (~1));
10334 val_conv.is_owned = (val & 1) || (val == 0);
10335 if (val_conv.inner != NULL)
10336 val_conv = CommitmentSigned_clone(&val_conv);
10337 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
10340 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) {
10341 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
10342 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
10343 if (update_add_htlcs_arg_constr.datalen > 0)
10344 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10346 update_add_htlcs_arg_constr.data = NULL;
10347 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
10348 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
10349 long arr_conv_15 = update_add_htlcs_arg_vals[p];
10350 LDKUpdateAddHTLC arr_conv_15_conv;
10351 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10352 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10353 if (arr_conv_15_conv.inner != NULL)
10354 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10355 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
10357 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
10358 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
10359 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
10360 if (update_fulfill_htlcs_arg_constr.datalen > 0)
10361 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10363 update_fulfill_htlcs_arg_constr.data = NULL;
10364 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
10365 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
10366 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
10367 LDKUpdateFulfillHTLC arr_conv_19_conv;
10368 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10369 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10370 if (arr_conv_19_conv.inner != NULL)
10371 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10372 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
10374 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
10375 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
10376 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
10377 if (update_fail_htlcs_arg_constr.datalen > 0)
10378 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10380 update_fail_htlcs_arg_constr.data = NULL;
10381 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
10382 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
10383 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
10384 LDKUpdateFailHTLC arr_conv_16_conv;
10385 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10386 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10387 if (arr_conv_16_conv.inner != NULL)
10388 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
10389 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
10391 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
10392 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
10393 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
10394 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
10395 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10397 update_fail_malformed_htlcs_arg_constr.data = NULL;
10398 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
10399 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
10400 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
10401 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
10402 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
10403 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
10404 if (arr_conv_25_conv.inner != NULL)
10405 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
10406 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
10408 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
10409 LDKUpdateFee update_fee_arg_conv;
10410 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
10411 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
10412 if (update_fee_arg_conv.inner != NULL)
10413 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
10414 LDKCommitmentSigned commitment_signed_arg_conv;
10415 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
10416 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
10417 if (commitment_signed_arg_conv.inner != NULL)
10418 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
10419 LDKCommitmentUpdate ret = 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);
10420 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10424 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
10425 FREE((void*)this_ptr);
10426 HTLCFailChannelUpdate_free(this_ptr_conv);
10429 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10430 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
10431 LDKHTLCFailChannelUpdate* ret = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
10432 *ret = HTLCFailChannelUpdate_clone(orig_conv);
10436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10437 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
10438 FREE((void*)this_ptr);
10439 ChannelMessageHandler_free(this_ptr_conv);
10442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10443 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
10444 FREE((void*)this_ptr);
10445 RoutingMessageHandler_free(this_ptr_conv);
10448 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
10449 LDKAcceptChannel obj_conv;
10450 obj_conv.inner = (void*)(obj & (~1));
10451 obj_conv.is_owned = (obj & 1) || (obj == 0);
10452 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
10453 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10454 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10455 CVec_u8Z_free(arg_var);
10459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10460 LDKu8slice ser_ref;
10461 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10462 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10463 LDKAcceptChannel ret = AcceptChannel_read(ser_ref);
10464 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10465 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10468 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
10469 LDKAnnouncementSignatures obj_conv;
10470 obj_conv.inner = (void*)(obj & (~1));
10471 obj_conv.is_owned = (obj & 1) || (obj == 0);
10472 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
10473 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10474 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10475 CVec_u8Z_free(arg_var);
10479 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10480 LDKu8slice ser_ref;
10481 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10482 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10483 LDKAnnouncementSignatures ret = AnnouncementSignatures_read(ser_ref);
10484 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10485 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10488 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
10489 LDKChannelReestablish obj_conv;
10490 obj_conv.inner = (void*)(obj & (~1));
10491 obj_conv.is_owned = (obj & 1) || (obj == 0);
10492 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
10493 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10494 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10495 CVec_u8Z_free(arg_var);
10499 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10500 LDKu8slice ser_ref;
10501 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10502 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10503 LDKChannelReestablish ret = ChannelReestablish_read(ser_ref);
10504 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10505 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10508 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10509 LDKClosingSigned obj_conv;
10510 obj_conv.inner = (void*)(obj & (~1));
10511 obj_conv.is_owned = (obj & 1) || (obj == 0);
10512 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
10513 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10514 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10515 CVec_u8Z_free(arg_var);
10519 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10520 LDKu8slice ser_ref;
10521 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10522 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10523 LDKClosingSigned ret = ClosingSigned_read(ser_ref);
10524 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10525 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10528 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10529 LDKCommitmentSigned obj_conv;
10530 obj_conv.inner = (void*)(obj & (~1));
10531 obj_conv.is_owned = (obj & 1) || (obj == 0);
10532 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
10533 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10534 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10535 CVec_u8Z_free(arg_var);
10539 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10540 LDKu8slice ser_ref;
10541 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10542 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10543 LDKCommitmentSigned ret = CommitmentSigned_read(ser_ref);
10544 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10545 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10548 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
10549 LDKFundingCreated obj_conv;
10550 obj_conv.inner = (void*)(obj & (~1));
10551 obj_conv.is_owned = (obj & 1) || (obj == 0);
10552 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
10553 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10554 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10555 CVec_u8Z_free(arg_var);
10559 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10560 LDKu8slice ser_ref;
10561 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10562 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10563 LDKFundingCreated ret = FundingCreated_read(ser_ref);
10564 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10565 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10568 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10569 LDKFundingSigned obj_conv;
10570 obj_conv.inner = (void*)(obj & (~1));
10571 obj_conv.is_owned = (obj & 1) || (obj == 0);
10572 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
10573 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10574 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10575 CVec_u8Z_free(arg_var);
10579 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10580 LDKu8slice ser_ref;
10581 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10582 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10583 LDKFundingSigned ret = FundingSigned_read(ser_ref);
10584 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10585 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10588 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
10589 LDKFundingLocked obj_conv;
10590 obj_conv.inner = (void*)(obj & (~1));
10591 obj_conv.is_owned = (obj & 1) || (obj == 0);
10592 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
10593 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10594 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10595 CVec_u8Z_free(arg_var);
10599 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10600 LDKu8slice ser_ref;
10601 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10602 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10603 LDKFundingLocked ret = FundingLocked_read(ser_ref);
10604 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10605 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10608 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
10610 obj_conv.inner = (void*)(obj & (~1));
10611 obj_conv.is_owned = (obj & 1) || (obj == 0);
10612 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
10613 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10614 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10615 CVec_u8Z_free(arg_var);
10619 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10620 LDKu8slice ser_ref;
10621 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10622 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10623 LDKInit ret = Init_read(ser_ref);
10624 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10625 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10628 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
10629 LDKOpenChannel obj_conv;
10630 obj_conv.inner = (void*)(obj & (~1));
10631 obj_conv.is_owned = (obj & 1) || (obj == 0);
10632 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
10633 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10634 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10635 CVec_u8Z_free(arg_var);
10639 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10640 LDKu8slice ser_ref;
10641 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10642 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10643 LDKOpenChannel ret = OpenChannel_read(ser_ref);
10644 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10645 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10648 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
10649 LDKRevokeAndACK obj_conv;
10650 obj_conv.inner = (void*)(obj & (~1));
10651 obj_conv.is_owned = (obj & 1) || (obj == 0);
10652 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
10653 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10654 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10655 CVec_u8Z_free(arg_var);
10659 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10660 LDKu8slice ser_ref;
10661 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10662 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10663 LDKRevokeAndACK ret = RevokeAndACK_read(ser_ref);
10664 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10665 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10668 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
10669 LDKShutdown obj_conv;
10670 obj_conv.inner = (void*)(obj & (~1));
10671 obj_conv.is_owned = (obj & 1) || (obj == 0);
10672 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
10673 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10674 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10675 CVec_u8Z_free(arg_var);
10679 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10680 LDKu8slice ser_ref;
10681 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10682 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10683 LDKShutdown ret = Shutdown_read(ser_ref);
10684 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10685 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10688 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10689 LDKUpdateFailHTLC obj_conv;
10690 obj_conv.inner = (void*)(obj & (~1));
10691 obj_conv.is_owned = (obj & 1) || (obj == 0);
10692 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
10693 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10694 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10695 CVec_u8Z_free(arg_var);
10699 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10700 LDKu8slice ser_ref;
10701 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10702 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10703 LDKUpdateFailHTLC ret = UpdateFailHTLC_read(ser_ref);
10704 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10705 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10708 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10709 LDKUpdateFailMalformedHTLC obj_conv;
10710 obj_conv.inner = (void*)(obj & (~1));
10711 obj_conv.is_owned = (obj & 1) || (obj == 0);
10712 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
10713 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10714 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10715 CVec_u8Z_free(arg_var);
10719 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10720 LDKu8slice ser_ref;
10721 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10722 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10723 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_read(ser_ref);
10724 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10725 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10728 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
10729 LDKUpdateFee obj_conv;
10730 obj_conv.inner = (void*)(obj & (~1));
10731 obj_conv.is_owned = (obj & 1) || (obj == 0);
10732 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
10733 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10734 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10735 CVec_u8Z_free(arg_var);
10739 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10740 LDKu8slice ser_ref;
10741 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10742 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10743 LDKUpdateFee ret = UpdateFee_read(ser_ref);
10744 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10745 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10748 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10749 LDKUpdateFulfillHTLC obj_conv;
10750 obj_conv.inner = (void*)(obj & (~1));
10751 obj_conv.is_owned = (obj & 1) || (obj == 0);
10752 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
10753 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10754 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10755 CVec_u8Z_free(arg_var);
10759 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10760 LDKu8slice ser_ref;
10761 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10762 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10763 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_read(ser_ref);
10764 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10765 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10768 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10769 LDKUpdateAddHTLC obj_conv;
10770 obj_conv.inner = (void*)(obj & (~1));
10771 obj_conv.is_owned = (obj & 1) || (obj == 0);
10772 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
10773 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10774 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10775 CVec_u8Z_free(arg_var);
10779 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10780 LDKu8slice ser_ref;
10781 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10782 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10783 LDKUpdateAddHTLC ret = UpdateAddHTLC_read(ser_ref);
10784 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10785 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10788 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
10790 obj_conv.inner = (void*)(obj & (~1));
10791 obj_conv.is_owned = (obj & 1) || (obj == 0);
10792 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
10793 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10794 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10795 CVec_u8Z_free(arg_var);
10799 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10800 LDKu8slice ser_ref;
10801 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10802 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10803 LDKPing ret = Ping_read(ser_ref);
10804 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10805 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10808 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
10810 obj_conv.inner = (void*)(obj & (~1));
10811 obj_conv.is_owned = (obj & 1) || (obj == 0);
10812 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
10813 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10814 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10815 CVec_u8Z_free(arg_var);
10819 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10820 LDKu8slice ser_ref;
10821 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10822 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10823 LDKPong ret = Pong_read(ser_ref);
10824 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10825 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10828 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10829 LDKUnsignedChannelAnnouncement obj_conv;
10830 obj_conv.inner = (void*)(obj & (~1));
10831 obj_conv.is_owned = (obj & 1) || (obj == 0);
10832 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
10833 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10834 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10835 CVec_u8Z_free(arg_var);
10839 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10840 LDKu8slice ser_ref;
10841 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10842 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10843 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_read(ser_ref);
10844 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10845 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10848 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10849 LDKChannelAnnouncement obj_conv;
10850 obj_conv.inner = (void*)(obj & (~1));
10851 obj_conv.is_owned = (obj & 1) || (obj == 0);
10852 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
10853 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10854 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10855 CVec_u8Z_free(arg_var);
10859 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10860 LDKu8slice ser_ref;
10861 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10862 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10863 LDKChannelAnnouncement ret = ChannelAnnouncement_read(ser_ref);
10864 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10865 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10868 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
10869 LDKUnsignedChannelUpdate obj_conv;
10870 obj_conv.inner = (void*)(obj & (~1));
10871 obj_conv.is_owned = (obj & 1) || (obj == 0);
10872 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
10873 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10874 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10875 CVec_u8Z_free(arg_var);
10879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10880 LDKu8slice ser_ref;
10881 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10882 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10883 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_read(ser_ref);
10884 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10885 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10888 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
10889 LDKChannelUpdate obj_conv;
10890 obj_conv.inner = (void*)(obj & (~1));
10891 obj_conv.is_owned = (obj & 1) || (obj == 0);
10892 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
10893 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10894 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10895 CVec_u8Z_free(arg_var);
10899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10900 LDKu8slice ser_ref;
10901 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10902 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10903 LDKChannelUpdate ret = ChannelUpdate_read(ser_ref);
10904 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10905 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10908 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
10909 LDKErrorMessage obj_conv;
10910 obj_conv.inner = (void*)(obj & (~1));
10911 obj_conv.is_owned = (obj & 1) || (obj == 0);
10912 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
10913 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10914 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10915 CVec_u8Z_free(arg_var);
10919 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10920 LDKu8slice ser_ref;
10921 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10922 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10923 LDKErrorMessage ret = ErrorMessage_read(ser_ref);
10924 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10925 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10928 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10929 LDKUnsignedNodeAnnouncement obj_conv;
10930 obj_conv.inner = (void*)(obj & (~1));
10931 obj_conv.is_owned = (obj & 1) || (obj == 0);
10932 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
10933 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10934 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10935 CVec_u8Z_free(arg_var);
10939 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10940 LDKu8slice ser_ref;
10941 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10942 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10943 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_read(ser_ref);
10944 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10945 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10948 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10949 LDKNodeAnnouncement obj_conv;
10950 obj_conv.inner = (void*)(obj & (~1));
10951 obj_conv.is_owned = (obj & 1) || (obj == 0);
10952 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
10953 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10954 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10955 CVec_u8Z_free(arg_var);
10959 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10960 LDKu8slice ser_ref;
10961 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10962 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10963 LDKNodeAnnouncement ret = NodeAnnouncement_read(ser_ref);
10964 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10965 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10968 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10969 LDKu8slice ser_ref;
10970 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10971 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10972 LDKQueryShortChannelIds ret = QueryShortChannelIds_read(ser_ref);
10973 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10974 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10977 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
10978 LDKQueryShortChannelIds obj_conv;
10979 obj_conv.inner = (void*)(obj & (~1));
10980 obj_conv.is_owned = (obj & 1) || (obj == 0);
10981 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
10982 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10983 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10984 CVec_u8Z_free(arg_var);
10988 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10989 LDKu8slice ser_ref;
10990 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10991 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10992 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_read(ser_ref);
10993 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10994 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10997 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
10998 LDKReplyShortChannelIdsEnd obj_conv;
10999 obj_conv.inner = (void*)(obj & (~1));
11000 obj_conv.is_owned = (obj & 1) || (obj == 0);
11001 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
11002 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11003 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11004 CVec_u8Z_free(arg_var);
11008 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11009 LDKu8slice ser_ref;
11010 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11011 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11012 LDKQueryChannelRange ret = QueryChannelRange_read(ser_ref);
11013 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11014 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11017 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
11018 LDKQueryChannelRange obj_conv;
11019 obj_conv.inner = (void*)(obj & (~1));
11020 obj_conv.is_owned = (obj & 1) || (obj == 0);
11021 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
11022 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11023 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11024 CVec_u8Z_free(arg_var);
11028 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11029 LDKu8slice ser_ref;
11030 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11031 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11032 LDKReplyChannelRange ret = ReplyChannelRange_read(ser_ref);
11033 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11034 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11037 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
11038 LDKReplyChannelRange obj_conv;
11039 obj_conv.inner = (void*)(obj & (~1));
11040 obj_conv.is_owned = (obj & 1) || (obj == 0);
11041 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
11042 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11043 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11044 CVec_u8Z_free(arg_var);
11048 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11049 LDKu8slice ser_ref;
11050 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11051 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11052 LDKGossipTimestampFilter ret = GossipTimestampFilter_read(ser_ref);
11053 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11054 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11057 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
11058 LDKGossipTimestampFilter obj_conv;
11059 obj_conv.inner = (void*)(obj & (~1));
11060 obj_conv.is_owned = (obj & 1) || (obj == 0);
11061 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
11062 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11063 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11064 CVec_u8Z_free(arg_var);
11068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11069 LDKMessageHandler this_ptr_conv;
11070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11072 MessageHandler_free(this_ptr_conv);
11075 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
11076 LDKMessageHandler this_ptr_conv;
11077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11078 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11079 long ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
11083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11084 LDKMessageHandler this_ptr_conv;
11085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11086 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11087 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
11088 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
11089 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11090 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
11092 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
11095 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
11096 LDKMessageHandler this_ptr_conv;
11097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11098 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11099 long ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
11103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11104 LDKMessageHandler this_ptr_conv;
11105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11106 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11107 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
11108 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
11109 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11110 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
11112 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
11115 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
11116 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
11117 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
11118 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11119 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
11121 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
11122 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
11123 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11124 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
11126 LDKMessageHandler ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
11127 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11131 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
11132 FREE((void*)this_ptr);
11133 SocketDescriptor_free(this_ptr_conv);
11136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11137 LDKPeerHandleError this_ptr_conv;
11138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11139 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11140 PeerHandleError_free(this_ptr_conv);
11143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
11144 LDKPeerHandleError this_ptr_conv;
11145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11146 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11147 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
11151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11152 LDKPeerHandleError this_ptr_conv;
11153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11154 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11155 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
11158 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
11159 LDKPeerHandleError ret = PeerHandleError_new(no_connection_possible_arg);
11160 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11164 LDKPeerManager this_ptr_conv;
11165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11166 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11167 PeerManager_free(this_ptr_conv);
11170 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) {
11171 LDKMessageHandler message_handler_conv;
11172 message_handler_conv.inner = (void*)(message_handler & (~1));
11173 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
11174 // Warning: we may need a move here but can't clone!
11175 LDKSecretKey our_node_secret_ref;
11176 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
11177 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
11178 unsigned char ephemeral_random_data_arr[32];
11179 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
11180 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
11181 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
11182 LDKLogger logger_conv = *(LDKLogger*)logger;
11183 if (logger_conv.free == LDKLogger_JCalls_free) {
11184 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11185 LDKLogger_JCalls_clone(logger_conv.this_arg);
11187 LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
11188 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11191 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
11192 LDKPeerManager this_arg_conv;
11193 this_arg_conv.inner = (void*)(this_arg & (~1));
11194 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11195 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
11196 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, NULL, NULL);
11197 for (size_t i = 0; i < ret_var.datalen; i++) {
11198 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
11199 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
11200 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
11202 CVec_PublicKeyZ_free(ret_var);
11206 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) {
11207 LDKPeerManager this_arg_conv;
11208 this_arg_conv.inner = (void*)(this_arg & (~1));
11209 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11210 LDKPublicKey their_node_id_ref;
11211 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
11212 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11213 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
11214 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
11215 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11216 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
11218 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11219 *ret = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
11223 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
11224 LDKPeerManager this_arg_conv;
11225 this_arg_conv.inner = (void*)(this_arg & (~1));
11226 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11227 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
11228 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
11229 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11230 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
11232 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11233 *ret = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
11237 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
11238 LDKPeerManager this_arg_conv;
11239 this_arg_conv.inner = (void*)(this_arg & (~1));
11240 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11241 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
11242 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11243 *ret = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
11247 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
11248 LDKPeerManager this_arg_conv;
11249 this_arg_conv.inner = (void*)(this_arg & (~1));
11250 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11251 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
11252 LDKu8slice data_ref;
11253 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
11254 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
11255 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11256 *ret = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
11257 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
11261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
11262 LDKPeerManager this_arg_conv;
11263 this_arg_conv.inner = (void*)(this_arg & (~1));
11264 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11265 PeerManager_process_events(&this_arg_conv);
11268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
11269 LDKPeerManager this_arg_conv;
11270 this_arg_conv.inner = (void*)(this_arg & (~1));
11271 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11272 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
11273 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
11276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
11277 LDKPeerManager this_arg_conv;
11278 this_arg_conv.inner = (void*)(this_arg & (~1));
11279 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11280 PeerManager_timer_tick_occured(&this_arg_conv);
11283 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
11284 unsigned char commitment_seed_arr[32];
11285 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
11286 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
11287 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
11288 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
11289 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
11293 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
11294 LDKPublicKey per_commitment_point_ref;
11295 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11296 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11297 unsigned char base_secret_arr[32];
11298 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
11299 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
11300 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
11301 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
11302 *ret = derive_private_key(per_commitment_point_ref, base_secret_ref);
11306 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
11307 LDKPublicKey per_commitment_point_ref;
11308 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11309 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11310 LDKPublicKey base_point_ref;
11311 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
11312 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
11313 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
11314 *ret = derive_public_key(per_commitment_point_ref, base_point_ref);
11318 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) {
11319 unsigned char per_commitment_secret_arr[32];
11320 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
11321 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
11322 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
11323 unsigned char countersignatory_revocation_base_secret_arr[32];
11324 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
11325 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
11326 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
11327 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
11328 *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
11332 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) {
11333 LDKPublicKey per_commitment_point_ref;
11334 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11335 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11336 LDKPublicKey countersignatory_revocation_base_point_ref;
11337 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
11338 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
11339 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
11340 *ret = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
11344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11345 LDKTxCreationKeys this_ptr_conv;
11346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11348 TxCreationKeys_free(this_ptr_conv);
11351 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11352 LDKTxCreationKeys orig_conv;
11353 orig_conv.inner = (void*)(orig & (~1));
11354 orig_conv.is_owned = (orig & 1) || (orig == 0);
11355 LDKTxCreationKeys ret = TxCreationKeys_clone(&orig_conv);
11356 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11359 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
11360 LDKTxCreationKeys this_ptr_conv;
11361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11362 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11363 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11364 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
11368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11369 LDKTxCreationKeys this_ptr_conv;
11370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11371 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11372 LDKPublicKey val_ref;
11373 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11374 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11375 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
11378 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11379 LDKTxCreationKeys this_ptr_conv;
11380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11381 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11382 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11383 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
11387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11388 LDKTxCreationKeys this_ptr_conv;
11389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11390 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11391 LDKPublicKey val_ref;
11392 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11393 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11394 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
11397 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11398 LDKTxCreationKeys this_ptr_conv;
11399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11401 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11402 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
11406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11407 LDKTxCreationKeys this_ptr_conv;
11408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11409 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11410 LDKPublicKey val_ref;
11411 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11412 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11413 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
11416 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11417 LDKTxCreationKeys this_ptr_conv;
11418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11419 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11420 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11421 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
11425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11426 LDKTxCreationKeys this_ptr_conv;
11427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11428 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11429 LDKPublicKey val_ref;
11430 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11431 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11432 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
11435 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11436 LDKTxCreationKeys this_ptr_conv;
11437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11438 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11439 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11440 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
11444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11445 LDKTxCreationKeys this_ptr_conv;
11446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11447 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11448 LDKPublicKey val_ref;
11449 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11450 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11451 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
11454 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) {
11455 LDKPublicKey per_commitment_point_arg_ref;
11456 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
11457 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
11458 LDKPublicKey revocation_key_arg_ref;
11459 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
11460 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
11461 LDKPublicKey broadcaster_htlc_key_arg_ref;
11462 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
11463 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
11464 LDKPublicKey countersignatory_htlc_key_arg_ref;
11465 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
11466 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
11467 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
11468 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
11469 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
11470 LDKTxCreationKeys ret = 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);
11471 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11474 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
11475 LDKTxCreationKeys obj_conv;
11476 obj_conv.inner = (void*)(obj & (~1));
11477 obj_conv.is_owned = (obj & 1) || (obj == 0);
11478 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
11479 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11480 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11481 CVec_u8Z_free(arg_var);
11485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11486 LDKu8slice ser_ref;
11487 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11488 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11489 LDKTxCreationKeys ret = TxCreationKeys_read(ser_ref);
11490 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11491 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11495 LDKPreCalculatedTxCreationKeys this_ptr_conv;
11496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11497 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11498 PreCalculatedTxCreationKeys_free(this_ptr_conv);
11501 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
11502 LDKTxCreationKeys keys_conv;
11503 keys_conv.inner = (void*)(keys & (~1));
11504 keys_conv.is_owned = (keys & 1) || (keys == 0);
11505 if (keys_conv.inner != NULL)
11506 keys_conv = TxCreationKeys_clone(&keys_conv);
11507 LDKPreCalculatedTxCreationKeys ret = PreCalculatedTxCreationKeys_new(keys_conv);
11508 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11511 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
11512 LDKPreCalculatedTxCreationKeys this_arg_conv;
11513 this_arg_conv.inner = (void*)(this_arg & (~1));
11514 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11515 LDKTxCreationKeys ret = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
11516 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11519 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
11520 LDKPreCalculatedTxCreationKeys this_arg_conv;
11521 this_arg_conv.inner = (void*)(this_arg & (~1));
11522 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11523 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11524 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
11528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11529 LDKChannelPublicKeys this_ptr_conv;
11530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11531 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11532 ChannelPublicKeys_free(this_ptr_conv);
11535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11536 LDKChannelPublicKeys orig_conv;
11537 orig_conv.inner = (void*)(orig & (~1));
11538 orig_conv.is_owned = (orig & 1) || (orig == 0);
11539 LDKChannelPublicKeys ret = ChannelPublicKeys_clone(&orig_conv);
11540 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11543 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
11544 LDKChannelPublicKeys this_ptr_conv;
11545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11546 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11547 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11548 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
11552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11553 LDKChannelPublicKeys this_ptr_conv;
11554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11555 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11556 LDKPublicKey val_ref;
11557 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11558 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11559 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
11562 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
11563 LDKChannelPublicKeys this_ptr_conv;
11564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11565 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11566 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11567 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
11571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11572 LDKChannelPublicKeys this_ptr_conv;
11573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11574 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11575 LDKPublicKey val_ref;
11576 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11577 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11578 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
11581 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
11582 LDKChannelPublicKeys this_ptr_conv;
11583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11585 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11586 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
11590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11591 LDKChannelPublicKeys this_ptr_conv;
11592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11593 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11594 LDKPublicKey val_ref;
11595 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11596 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11597 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
11600 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
11601 LDKChannelPublicKeys this_ptr_conv;
11602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11603 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11604 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11605 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
11609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11610 LDKChannelPublicKeys this_ptr_conv;
11611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11612 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11613 LDKPublicKey val_ref;
11614 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11615 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11616 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
11619 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
11620 LDKChannelPublicKeys this_ptr_conv;
11621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11623 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11624 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
11628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11629 LDKChannelPublicKeys this_ptr_conv;
11630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11631 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11632 LDKPublicKey val_ref;
11633 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11634 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11635 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
11638 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) {
11639 LDKPublicKey funding_pubkey_arg_ref;
11640 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
11641 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
11642 LDKPublicKey revocation_basepoint_arg_ref;
11643 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
11644 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
11645 LDKPublicKey payment_point_arg_ref;
11646 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
11647 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
11648 LDKPublicKey delayed_payment_basepoint_arg_ref;
11649 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
11650 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
11651 LDKPublicKey htlc_basepoint_arg_ref;
11652 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
11653 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
11654 LDKChannelPublicKeys ret = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref);
11655 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11658 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
11659 LDKChannelPublicKeys obj_conv;
11660 obj_conv.inner = (void*)(obj & (~1));
11661 obj_conv.is_owned = (obj & 1) || (obj == 0);
11662 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
11663 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11664 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11665 CVec_u8Z_free(arg_var);
11669 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11670 LDKu8slice ser_ref;
11671 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11672 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11673 LDKChannelPublicKeys ret = ChannelPublicKeys_read(ser_ref);
11674 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11675 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11678 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) {
11679 LDKPublicKey per_commitment_point_ref;
11680 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11681 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11682 LDKPublicKey broadcaster_delayed_payment_base_ref;
11683 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
11684 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
11685 LDKPublicKey broadcaster_htlc_base_ref;
11686 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
11687 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
11688 LDKPublicKey countersignatory_revocation_base_ref;
11689 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
11690 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
11691 LDKPublicKey countersignatory_htlc_base_ref;
11692 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
11693 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
11694 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
11695 *ret = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
11699 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) {
11700 LDKPublicKey revocation_key_ref;
11701 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
11702 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
11703 LDKPublicKey broadcaster_delayed_payment_key_ref;
11704 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
11705 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
11706 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
11707 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11708 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11709 CVec_u8Z_free(arg_var);
11713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11714 LDKHTLCOutputInCommitment this_ptr_conv;
11715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11717 HTLCOutputInCommitment_free(this_ptr_conv);
11720 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11721 LDKHTLCOutputInCommitment orig_conv;
11722 orig_conv.inner = (void*)(orig & (~1));
11723 orig_conv.is_owned = (orig & 1) || (orig == 0);
11724 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_clone(&orig_conv);
11725 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11728 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
11729 LDKHTLCOutputInCommitment this_ptr_conv;
11730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11731 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11732 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
11736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11737 LDKHTLCOutputInCommitment this_ptr_conv;
11738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11739 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11740 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
11743 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11744 LDKHTLCOutputInCommitment this_ptr_conv;
11745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11746 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11747 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
11751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11752 LDKHTLCOutputInCommitment this_ptr_conv;
11753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11754 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11755 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
11758 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
11759 LDKHTLCOutputInCommitment this_ptr_conv;
11760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11761 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11762 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
11766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11767 LDKHTLCOutputInCommitment this_ptr_conv;
11768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11769 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11770 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
11773 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
11774 LDKHTLCOutputInCommitment this_ptr_conv;
11775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11776 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11777 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11778 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
11782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11783 LDKHTLCOutputInCommitment this_ptr_conv;
11784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11785 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11786 LDKThirtyTwoBytes val_ref;
11787 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11788 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11789 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
11792 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
11793 LDKHTLCOutputInCommitment obj_conv;
11794 obj_conv.inner = (void*)(obj & (~1));
11795 obj_conv.is_owned = (obj & 1) || (obj == 0);
11796 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
11797 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11798 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11799 CVec_u8Z_free(arg_var);
11803 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11804 LDKu8slice ser_ref;
11805 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11806 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11807 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_read(ser_ref);
11808 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11809 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11812 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
11813 LDKHTLCOutputInCommitment htlc_conv;
11814 htlc_conv.inner = (void*)(htlc & (~1));
11815 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
11816 LDKTxCreationKeys keys_conv;
11817 keys_conv.inner = (void*)(keys & (~1));
11818 keys_conv.is_owned = (keys & 1) || (keys == 0);
11819 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
11820 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11821 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11822 CVec_u8Z_free(arg_var);
11826 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
11827 LDKPublicKey broadcaster_ref;
11828 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
11829 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
11830 LDKPublicKey countersignatory_ref;
11831 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
11832 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
11833 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
11834 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11835 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11836 CVec_u8Z_free(arg_var);
11840 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) {
11841 unsigned char prev_hash_arr[32];
11842 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
11843 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
11844 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
11845 LDKHTLCOutputInCommitment htlc_conv;
11846 htlc_conv.inner = (void*)(htlc & (~1));
11847 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
11848 LDKPublicKey broadcaster_delayed_payment_key_ref;
11849 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
11850 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
11851 LDKPublicKey revocation_key_ref;
11852 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
11853 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
11854 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
11855 *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
11859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11860 LDKHolderCommitmentTransaction this_ptr_conv;
11861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11863 HolderCommitmentTransaction_free(this_ptr_conv);
11866 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11867 LDKHolderCommitmentTransaction orig_conv;
11868 orig_conv.inner = (void*)(orig & (~1));
11869 orig_conv.is_owned = (orig & 1) || (orig == 0);
11870 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_clone(&orig_conv);
11871 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11874 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
11875 LDKHolderCommitmentTransaction this_ptr_conv;
11876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11877 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11878 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
11879 *ret = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
11883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11884 LDKHolderCommitmentTransaction this_ptr_conv;
11885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11886 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11887 LDKTransaction val_conv = *(LDKTransaction*)val;
11888 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
11891 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
11892 LDKHolderCommitmentTransaction this_ptr_conv;
11893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11894 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11895 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
11896 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
11900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11901 LDKHolderCommitmentTransaction this_ptr_conv;
11902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11903 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11904 LDKSignature val_ref;
11905 CHECK((*_env)->GetArrayLength (_env, val) == 64);
11906 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
11907 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
11910 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
11911 LDKHolderCommitmentTransaction 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 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
11918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11919 LDKHolderCommitmentTransaction this_ptr_conv;
11920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11921 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11922 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
11925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11926 LDKHolderCommitmentTransaction this_ptr_conv;
11927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11928 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11929 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_constr;
11930 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11931 if (val_constr.datalen > 0)
11932 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
11934 val_constr.data = NULL;
11935 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11936 for (size_t q = 0; q < val_constr.datalen; q++) {
11937 long arr_conv_42 = val_vals[q];
11938 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
11939 FREE((void*)arr_conv_42);
11940 val_constr.data[q] = arr_conv_42_conv;
11942 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11943 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_constr);
11946 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) {
11947 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
11948 LDKSignature counterparty_sig_ref;
11949 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
11950 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
11951 LDKPublicKey holder_funding_key_ref;
11952 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
11953 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
11954 LDKPublicKey counterparty_funding_key_ref;
11955 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
11956 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
11957 LDKTxCreationKeys keys_conv;
11958 keys_conv.inner = (void*)(keys & (~1));
11959 keys_conv.is_owned = (keys & 1) || (keys == 0);
11960 if (keys_conv.inner != NULL)
11961 keys_conv = TxCreationKeys_clone(&keys_conv);
11962 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_constr;
11963 htlc_data_constr.datalen = (*_env)->GetArrayLength (_env, htlc_data);
11964 if (htlc_data_constr.datalen > 0)
11965 htlc_data_constr.data = MALLOC(htlc_data_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
11967 htlc_data_constr.data = NULL;
11968 long* htlc_data_vals = (*_env)->GetLongArrayElements (_env, htlc_data, NULL);
11969 for (size_t q = 0; q < htlc_data_constr.datalen; q++) {
11970 long arr_conv_42 = htlc_data_vals[q];
11971 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
11972 FREE((void*)arr_conv_42);
11973 htlc_data_constr.data[q] = arr_conv_42_conv;
11975 (*_env)->ReleaseLongArrayElements (_env, htlc_data, htlc_data_vals, 0);
11976 LDKHolderCommitmentTransaction ret = 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);
11977 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11980 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
11981 LDKHolderCommitmentTransaction this_arg_conv;
11982 this_arg_conv.inner = (void*)(this_arg & (~1));
11983 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11984 LDKTxCreationKeys ret = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
11985 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11988 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
11989 LDKHolderCommitmentTransaction this_arg_conv;
11990 this_arg_conv.inner = (void*)(this_arg & (~1));
11991 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11992 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
11993 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
11997 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) {
11998 LDKHolderCommitmentTransaction this_arg_conv;
11999 this_arg_conv.inner = (void*)(this_arg & (~1));
12000 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12001 unsigned char funding_key_arr[32];
12002 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
12003 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
12004 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
12005 LDKu8slice funding_redeemscript_ref;
12006 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
12007 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
12008 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
12009 (*_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);
12010 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
12014 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) {
12015 LDKHolderCommitmentTransaction this_arg_conv;
12016 this_arg_conv.inner = (void*)(this_arg & (~1));
12017 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12018 unsigned char htlc_base_key_arr[32];
12019 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
12020 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
12021 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
12022 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12023 *ret = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
12027 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
12028 LDKHolderCommitmentTransaction obj_conv;
12029 obj_conv.inner = (void*)(obj & (~1));
12030 obj_conv.is_owned = (obj & 1) || (obj == 0);
12031 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
12032 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12033 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12034 CVec_u8Z_free(arg_var);
12038 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12039 LDKu8slice ser_ref;
12040 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12041 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12042 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_read(ser_ref);
12043 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12044 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12048 LDKInitFeatures this_ptr_conv;
12049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12051 InitFeatures_free(this_ptr_conv);
12054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12055 LDKNodeFeatures this_ptr_conv;
12056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12057 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12058 NodeFeatures_free(this_ptr_conv);
12061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12062 LDKChannelFeatures this_ptr_conv;
12063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12064 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12065 ChannelFeatures_free(this_ptr_conv);
12068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12069 LDKRouteHop this_ptr_conv;
12070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12072 RouteHop_free(this_ptr_conv);
12075 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12076 LDKRouteHop orig_conv;
12077 orig_conv.inner = (void*)(orig & (~1));
12078 orig_conv.is_owned = (orig & 1) || (orig == 0);
12079 LDKRouteHop ret = RouteHop_clone(&orig_conv);
12080 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12083 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
12084 LDKRouteHop this_ptr_conv;
12085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12086 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12087 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12088 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
12092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12093 LDKRouteHop this_ptr_conv;
12094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12095 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12096 LDKPublicKey val_ref;
12097 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12098 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12099 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
12102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12103 LDKRouteHop this_ptr_conv;
12104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12105 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12106 LDKNodeFeatures ret = RouteHop_get_node_features(&this_ptr_conv);
12107 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12111 LDKRouteHop this_ptr_conv;
12112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12113 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12114 LDKNodeFeatures val_conv;
12115 val_conv.inner = (void*)(val & (~1));
12116 val_conv.is_owned = (val & 1) || (val == 0);
12117 // Warning: we may need a move here but can't clone!
12118 RouteHop_set_node_features(&this_ptr_conv, val_conv);
12121 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12122 LDKRouteHop this_ptr_conv;
12123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12124 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12125 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
12129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12130 LDKRouteHop this_ptr_conv;
12131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12132 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12133 RouteHop_set_short_channel_id(&this_ptr_conv, val);
12136 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12137 LDKRouteHop this_ptr_conv;
12138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12139 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12140 LDKChannelFeatures ret = RouteHop_get_channel_features(&this_ptr_conv);
12141 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12145 LDKRouteHop this_ptr_conv;
12146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12147 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12148 LDKChannelFeatures val_conv;
12149 val_conv.inner = (void*)(val & (~1));
12150 val_conv.is_owned = (val & 1) || (val == 0);
12151 // Warning: we may need a move here but can't clone!
12152 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
12155 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12156 LDKRouteHop this_ptr_conv;
12157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12158 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12159 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
12163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12164 LDKRouteHop this_ptr_conv;
12165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12166 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12167 RouteHop_set_fee_msat(&this_ptr_conv, val);
12170 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
12171 LDKRouteHop this_ptr_conv;
12172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12173 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12174 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
12178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12179 LDKRouteHop this_ptr_conv;
12180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12181 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12182 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
12185 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) {
12186 LDKPublicKey pubkey_arg_ref;
12187 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
12188 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
12189 LDKNodeFeatures node_features_arg_conv;
12190 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
12191 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
12192 // Warning: we may need a move here but can't clone!
12193 LDKChannelFeatures channel_features_arg_conv;
12194 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
12195 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
12196 // Warning: we may need a move here but can't clone!
12197 LDKRouteHop ret = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg);
12198 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12202 LDKRoute this_ptr_conv;
12203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12204 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12205 Route_free(this_ptr_conv);
12208 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12209 LDKRoute orig_conv;
12210 orig_conv.inner = (void*)(orig & (~1));
12211 orig_conv.is_owned = (orig & 1) || (orig == 0);
12212 LDKRoute ret = Route_clone(&orig_conv);
12213 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
12217 LDKRoute this_ptr_conv;
12218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12219 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12220 LDKCVec_CVec_RouteHopZZ val_constr;
12221 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12222 if (val_constr.datalen > 0)
12223 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12225 val_constr.data = NULL;
12226 for (size_t m = 0; m < val_constr.datalen; m++) {
12227 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
12228 LDKCVec_RouteHopZ arr_conv_12_constr;
12229 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
12230 if (arr_conv_12_constr.datalen > 0)
12231 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12233 arr_conv_12_constr.data = NULL;
12234 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
12235 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
12236 long arr_conv_10 = arr_conv_12_vals[k];
12237 LDKRouteHop arr_conv_10_conv;
12238 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
12239 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
12240 if (arr_conv_10_conv.inner != NULL)
12241 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
12242 arr_conv_12_constr.data[k] = arr_conv_10_conv;
12244 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
12245 val_constr.data[m] = arr_conv_12_constr;
12247 Route_set_paths(&this_ptr_conv, val_constr);
12250 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
12251 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
12252 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
12253 if (paths_arg_constr.datalen > 0)
12254 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12256 paths_arg_constr.data = NULL;
12257 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
12258 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
12259 LDKCVec_RouteHopZ arr_conv_12_constr;
12260 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
12261 if (arr_conv_12_constr.datalen > 0)
12262 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12264 arr_conv_12_constr.data = NULL;
12265 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
12266 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
12267 long arr_conv_10 = arr_conv_12_vals[k];
12268 LDKRouteHop arr_conv_10_conv;
12269 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
12270 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
12271 if (arr_conv_10_conv.inner != NULL)
12272 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
12273 arr_conv_12_constr.data[k] = arr_conv_10_conv;
12275 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
12276 paths_arg_constr.data[m] = arr_conv_12_constr;
12278 LDKRoute ret = Route_new(paths_arg_constr);
12279 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12282 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
12284 obj_conv.inner = (void*)(obj & (~1));
12285 obj_conv.is_owned = (obj & 1) || (obj == 0);
12286 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
12287 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12288 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12289 CVec_u8Z_free(arg_var);
12293 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12294 LDKu8slice ser_ref;
12295 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12296 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12297 LDKRoute ret = Route_read(ser_ref);
12298 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12299 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12303 LDKRouteHint this_ptr_conv;
12304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12305 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12306 RouteHint_free(this_ptr_conv);
12309 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12310 LDKRouteHint orig_conv;
12311 orig_conv.inner = (void*)(orig & (~1));
12312 orig_conv.is_owned = (orig & 1) || (orig == 0);
12313 LDKRouteHint ret = RouteHint_clone(&orig_conv);
12314 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12317 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12318 LDKRouteHint this_ptr_conv;
12319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12320 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12321 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12322 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
12326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12327 LDKRouteHint this_ptr_conv;
12328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12329 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12330 LDKPublicKey val_ref;
12331 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12332 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12333 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
12336 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12337 LDKRouteHint this_ptr_conv;
12338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12339 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12340 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
12344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12345 LDKRouteHint this_ptr_conv;
12346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12348 RouteHint_set_short_channel_id(&this_ptr_conv, val);
12351 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
12352 LDKRouteHint this_ptr_conv;
12353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12354 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12355 LDKRoutingFees ret = RouteHint_get_fees(&this_ptr_conv);
12356 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12360 LDKRouteHint this_ptr_conv;
12361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12362 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12363 LDKRoutingFees val_conv;
12364 val_conv.inner = (void*)(val & (~1));
12365 val_conv.is_owned = (val & 1) || (val == 0);
12366 if (val_conv.inner != NULL)
12367 val_conv = RoutingFees_clone(&val_conv);
12368 RouteHint_set_fees(&this_ptr_conv, val_conv);
12371 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
12372 LDKRouteHint this_ptr_conv;
12373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12374 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12375 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
12379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
12380 LDKRouteHint this_ptr_conv;
12381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12382 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12383 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
12386 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12387 LDKRouteHint this_ptr_conv;
12388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12389 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12390 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
12394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12395 LDKRouteHint this_ptr_conv;
12396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12397 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12398 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
12401 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) {
12402 LDKPublicKey src_node_id_arg_ref;
12403 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
12404 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
12405 LDKRoutingFees fees_arg_conv;
12406 fees_arg_conv.inner = (void*)(fees_arg & (~1));
12407 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
12408 if (fees_arg_conv.inner != NULL)
12409 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
12410 LDKRouteHint ret = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
12411 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12414 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) {
12415 LDKPublicKey our_node_id_ref;
12416 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
12417 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
12418 LDKNetworkGraph network_conv;
12419 network_conv.inner = (void*)(network & (~1));
12420 network_conv.is_owned = (network & 1) || (network == 0);
12421 LDKPublicKey target_ref;
12422 CHECK((*_env)->GetArrayLength (_env, target) == 33);
12423 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
12424 LDKCVec_ChannelDetailsZ first_hops_constr;
12425 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
12426 if (first_hops_constr.datalen > 0)
12427 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12429 first_hops_constr.data = NULL;
12430 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
12431 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
12432 long arr_conv_16 = first_hops_vals[q];
12433 LDKChannelDetails arr_conv_16_conv;
12434 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
12435 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
12436 if (arr_conv_16_conv.inner != NULL)
12437 arr_conv_16_conv = ChannelDetails_clone(&arr_conv_16_conv);
12438 first_hops_constr.data[q] = arr_conv_16_conv;
12440 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
12441 LDKCVec_RouteHintZ last_hops_constr;
12442 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
12443 if (last_hops_constr.datalen > 0)
12444 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12446 last_hops_constr.data = NULL;
12447 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
12448 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
12449 long arr_conv_11 = last_hops_vals[l];
12450 LDKRouteHint arr_conv_11_conv;
12451 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
12452 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
12453 if (arr_conv_11_conv.inner != NULL)
12454 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
12455 last_hops_constr.data[l] = arr_conv_11_conv;
12457 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
12458 LDKLogger logger_conv = *(LDKLogger*)logger;
12459 if (logger_conv.free == LDKLogger_JCalls_free) {
12460 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12461 LDKLogger_JCalls_clone(logger_conv.this_arg);
12463 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12464 *ret = get_route(our_node_id_ref, &network_conv, target_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
12465 FREE(first_hops_constr.data);
12469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12470 LDKNetworkGraph this_ptr_conv;
12471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12472 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12473 NetworkGraph_free(this_ptr_conv);
12476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12477 LDKLockedNetworkGraph this_ptr_conv;
12478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12479 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12480 LockedNetworkGraph_free(this_ptr_conv);
12483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12484 LDKNetGraphMsgHandler this_ptr_conv;
12485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12487 NetGraphMsgHandler_free(this_ptr_conv);
12490 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
12491 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
12492 LDKLogger logger_conv = *(LDKLogger*)logger;
12493 if (logger_conv.free == LDKLogger_JCalls_free) {
12494 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12495 LDKLogger_JCalls_clone(logger_conv.this_arg);
12497 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
12498 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12501 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
12502 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
12503 LDKLogger logger_conv = *(LDKLogger*)logger;
12504 if (logger_conv.free == LDKLogger_JCalls_free) {
12505 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12506 LDKLogger_JCalls_clone(logger_conv.this_arg);
12508 LDKNetworkGraph network_graph_conv;
12509 network_graph_conv.inner = (void*)(network_graph & (~1));
12510 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
12511 // Warning: we may need a move here but can't clone!
12512 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
12513 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
12517 LDKNetGraphMsgHandler this_arg_conv;
12518 this_arg_conv.inner = (void*)(this_arg & (~1));
12519 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12520 LDKLockedNetworkGraph ret = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
12521 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12524 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
12525 LDKLockedNetworkGraph this_arg_conv;
12526 this_arg_conv.inner = (void*)(this_arg & (~1));
12527 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12528 LDKNetworkGraph ret = LockedNetworkGraph_graph(&this_arg_conv);
12529 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
12533 LDKNetGraphMsgHandler this_arg_conv;
12534 this_arg_conv.inner = (void*)(this_arg & (~1));
12535 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12536 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
12537 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
12541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12542 LDKDirectionalChannelInfo this_ptr_conv;
12543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12545 DirectionalChannelInfo_free(this_ptr_conv);
12548 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
12549 LDKDirectionalChannelInfo this_ptr_conv;
12550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12551 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12552 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
12556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12557 LDKDirectionalChannelInfo this_ptr_conv;
12558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12559 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12560 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
12563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
12564 LDKDirectionalChannelInfo this_ptr_conv;
12565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12566 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12567 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
12571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12572 LDKDirectionalChannelInfo this_ptr_conv;
12573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12574 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12575 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
12578 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
12579 LDKDirectionalChannelInfo this_ptr_conv;
12580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12582 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
12586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
12587 LDKDirectionalChannelInfo this_ptr_conv;
12588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12589 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12590 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
12593 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12594 LDKDirectionalChannelInfo this_ptr_conv;
12595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12596 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12597 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
12601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12602 LDKDirectionalChannelInfo this_ptr_conv;
12603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12604 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12605 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
12608 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
12609 LDKDirectionalChannelInfo this_ptr_conv;
12610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12611 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12612 LDKChannelUpdate ret = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
12613 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12617 LDKDirectionalChannelInfo this_ptr_conv;
12618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12619 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12620 LDKChannelUpdate val_conv;
12621 val_conv.inner = (void*)(val & (~1));
12622 val_conv.is_owned = (val & 1) || (val == 0);
12623 if (val_conv.inner != NULL)
12624 val_conv = ChannelUpdate_clone(&val_conv);
12625 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
12628 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12629 LDKDirectionalChannelInfo obj_conv;
12630 obj_conv.inner = (void*)(obj & (~1));
12631 obj_conv.is_owned = (obj & 1) || (obj == 0);
12632 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
12633 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12634 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12635 CVec_u8Z_free(arg_var);
12639 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12640 LDKu8slice ser_ref;
12641 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12642 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12643 LDKDirectionalChannelInfo ret = DirectionalChannelInfo_read(ser_ref);
12644 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12645 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12649 LDKChannelInfo this_ptr_conv;
12650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12651 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12652 ChannelInfo_free(this_ptr_conv);
12655 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12656 LDKChannelInfo this_ptr_conv;
12657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12658 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12659 LDKChannelFeatures ret = ChannelInfo_get_features(&this_ptr_conv);
12660 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12664 LDKChannelInfo this_ptr_conv;
12665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12666 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12667 LDKChannelFeatures val_conv;
12668 val_conv.inner = (void*)(val & (~1));
12669 val_conv.is_owned = (val & 1) || (val == 0);
12670 // Warning: we may need a move here but can't clone!
12671 ChannelInfo_set_features(&this_ptr_conv, val_conv);
12674 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
12675 LDKChannelInfo this_ptr_conv;
12676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12677 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12678 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12679 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
12683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12684 LDKChannelInfo this_ptr_conv;
12685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12686 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12687 LDKPublicKey val_ref;
12688 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12689 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12690 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
12693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
12694 LDKChannelInfo this_ptr_conv;
12695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12696 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12697 LDKDirectionalChannelInfo ret = ChannelInfo_get_one_to_two(&this_ptr_conv);
12698 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12702 LDKChannelInfo this_ptr_conv;
12703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12704 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12705 LDKDirectionalChannelInfo val_conv;
12706 val_conv.inner = (void*)(val & (~1));
12707 val_conv.is_owned = (val & 1) || (val == 0);
12708 // Warning: we may need a move here but can't clone!
12709 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
12712 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
12713 LDKChannelInfo this_ptr_conv;
12714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12715 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12716 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12717 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
12721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12722 LDKChannelInfo this_ptr_conv;
12723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12724 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12725 LDKPublicKey val_ref;
12726 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12727 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12728 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
12731 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
12732 LDKChannelInfo this_ptr_conv;
12733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12734 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12735 LDKDirectionalChannelInfo ret = ChannelInfo_get_two_to_one(&this_ptr_conv);
12736 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12740 LDKChannelInfo this_ptr_conv;
12741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12742 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12743 LDKDirectionalChannelInfo val_conv;
12744 val_conv.inner = (void*)(val & (~1));
12745 val_conv.is_owned = (val & 1) || (val == 0);
12746 // Warning: we may need a move here but can't clone!
12747 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
12750 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
12751 LDKChannelInfo this_ptr_conv;
12752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12753 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12754 LDKChannelAnnouncement ret = ChannelInfo_get_announcement_message(&this_ptr_conv);
12755 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12759 LDKChannelInfo this_ptr_conv;
12760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12761 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12762 LDKChannelAnnouncement val_conv;
12763 val_conv.inner = (void*)(val & (~1));
12764 val_conv.is_owned = (val & 1) || (val == 0);
12765 if (val_conv.inner != NULL)
12766 val_conv = ChannelAnnouncement_clone(&val_conv);
12767 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
12770 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12771 LDKChannelInfo obj_conv;
12772 obj_conv.inner = (void*)(obj & (~1));
12773 obj_conv.is_owned = (obj & 1) || (obj == 0);
12774 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
12775 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12776 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12777 CVec_u8Z_free(arg_var);
12781 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12782 LDKu8slice ser_ref;
12783 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12784 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12785 LDKChannelInfo ret = ChannelInfo_read(ser_ref);
12786 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12787 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12791 LDKRoutingFees this_ptr_conv;
12792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12793 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12794 RoutingFees_free(this_ptr_conv);
12797 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12798 LDKRoutingFees orig_conv;
12799 orig_conv.inner = (void*)(orig & (~1));
12800 orig_conv.is_owned = (orig & 1) || (orig == 0);
12801 LDKRoutingFees ret = RoutingFees_clone(&orig_conv);
12802 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12805 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12806 LDKRoutingFees this_ptr_conv;
12807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12808 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12809 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
12813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12814 LDKRoutingFees 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 RoutingFees_set_base_msat(&this_ptr_conv, val);
12820 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
12821 LDKRoutingFees this_ptr_conv;
12822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12823 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12824 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
12828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12829 LDKRoutingFees this_ptr_conv;
12830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12831 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12832 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
12835 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
12836 LDKRoutingFees ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
12837 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12840 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12841 LDKu8slice ser_ref;
12842 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12843 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12844 LDKRoutingFees ret = RoutingFees_read(ser_ref);
12845 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12846 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12849 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
12850 LDKRoutingFees obj_conv;
12851 obj_conv.inner = (void*)(obj & (~1));
12852 obj_conv.is_owned = (obj & 1) || (obj == 0);
12853 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
12854 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12855 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12856 CVec_u8Z_free(arg_var);
12860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12861 LDKNodeAnnouncementInfo this_ptr_conv;
12862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12863 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12864 NodeAnnouncementInfo_free(this_ptr_conv);
12867 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12868 LDKNodeAnnouncementInfo this_ptr_conv;
12869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12870 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12871 LDKNodeFeatures ret = NodeAnnouncementInfo_get_features(&this_ptr_conv);
12872 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12876 LDKNodeAnnouncementInfo this_ptr_conv;
12877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12879 LDKNodeFeatures val_conv;
12880 val_conv.inner = (void*)(val & (~1));
12881 val_conv.is_owned = (val & 1) || (val == 0);
12882 // Warning: we may need a move here but can't clone!
12883 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
12886 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
12887 LDKNodeAnnouncementInfo this_ptr_conv;
12888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12889 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12890 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
12894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12895 LDKNodeAnnouncementInfo this_ptr_conv;
12896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12898 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
12901 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
12902 LDKNodeAnnouncementInfo this_ptr_conv;
12903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12905 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
12906 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
12910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12911 LDKNodeAnnouncementInfo this_ptr_conv;
12912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12913 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12914 LDKThreeBytes val_ref;
12915 CHECK((*_env)->GetArrayLength (_env, val) == 3);
12916 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
12917 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
12920 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
12921 LDKNodeAnnouncementInfo this_ptr_conv;
12922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12923 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12924 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12925 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
12929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12930 LDKNodeAnnouncementInfo this_ptr_conv;
12931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12932 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12933 LDKThirtyTwoBytes val_ref;
12934 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12935 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12936 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
12939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
12940 LDKNodeAnnouncementInfo this_ptr_conv;
12941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12942 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12943 LDKCVec_NetAddressZ val_constr;
12944 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12945 if (val_constr.datalen > 0)
12946 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12948 val_constr.data = NULL;
12949 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
12950 for (size_t m = 0; m < val_constr.datalen; m++) {
12951 long arr_conv_12 = val_vals[m];
12952 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
12953 FREE((void*)arr_conv_12);
12954 val_constr.data[m] = arr_conv_12_conv;
12956 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
12957 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
12960 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
12961 LDKNodeAnnouncementInfo this_ptr_conv;
12962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12963 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12964 LDKNodeAnnouncement ret = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
12965 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12969 LDKNodeAnnouncementInfo this_ptr_conv;
12970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12971 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12972 LDKNodeAnnouncement val_conv;
12973 val_conv.inner = (void*)(val & (~1));
12974 val_conv.is_owned = (val & 1) || (val == 0);
12975 if (val_conv.inner != NULL)
12976 val_conv = NodeAnnouncement_clone(&val_conv);
12977 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
12980 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) {
12981 LDKNodeFeatures features_arg_conv;
12982 features_arg_conv.inner = (void*)(features_arg & (~1));
12983 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
12984 // Warning: we may need a move here but can't clone!
12985 LDKThreeBytes rgb_arg_ref;
12986 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
12987 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
12988 LDKThirtyTwoBytes alias_arg_ref;
12989 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
12990 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
12991 LDKCVec_NetAddressZ addresses_arg_constr;
12992 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
12993 if (addresses_arg_constr.datalen > 0)
12994 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12996 addresses_arg_constr.data = NULL;
12997 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
12998 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
12999 long arr_conv_12 = addresses_arg_vals[m];
13000 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
13001 FREE((void*)arr_conv_12);
13002 addresses_arg_constr.data[m] = arr_conv_12_conv;
13004 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
13005 LDKNodeAnnouncement announcement_message_arg_conv;
13006 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
13007 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
13008 if (announcement_message_arg_conv.inner != NULL)
13009 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
13010 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
13011 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13014 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13015 LDKNodeAnnouncementInfo obj_conv;
13016 obj_conv.inner = (void*)(obj & (~1));
13017 obj_conv.is_owned = (obj & 1) || (obj == 0);
13018 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
13019 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13020 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13021 CVec_u8Z_free(arg_var);
13025 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13026 LDKu8slice ser_ref;
13027 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13028 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13029 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_read(ser_ref);
13030 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13031 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13035 LDKNodeInfo this_ptr_conv;
13036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13037 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13038 NodeInfo_free(this_ptr_conv);
13041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
13042 LDKNodeInfo this_ptr_conv;
13043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13044 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13045 LDKCVec_u64Z val_constr;
13046 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13047 if (val_constr.datalen > 0)
13048 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
13050 val_constr.data = NULL;
13051 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
13052 for (size_t g = 0; g < val_constr.datalen; g++) {
13053 long arr_conv_6 = val_vals[g];
13054 val_constr.data[g] = arr_conv_6;
13056 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
13057 NodeInfo_set_channels(&this_ptr_conv, val_constr);
13060 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
13061 LDKNodeInfo this_ptr_conv;
13062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13063 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13064 LDKRoutingFees ret = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
13065 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13069 LDKNodeInfo this_ptr_conv;
13070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13072 LDKRoutingFees val_conv;
13073 val_conv.inner = (void*)(val & (~1));
13074 val_conv.is_owned = (val & 1) || (val == 0);
13075 if (val_conv.inner != NULL)
13076 val_conv = RoutingFees_clone(&val_conv);
13077 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
13080 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
13081 LDKNodeInfo this_ptr_conv;
13082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13083 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13084 LDKNodeAnnouncementInfo ret = NodeInfo_get_announcement_info(&this_ptr_conv);
13085 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13089 LDKNodeInfo this_ptr_conv;
13090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13091 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13092 LDKNodeAnnouncementInfo val_conv;
13093 val_conv.inner = (void*)(val & (~1));
13094 val_conv.is_owned = (val & 1) || (val == 0);
13095 // Warning: we may need a move here but can't clone!
13096 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
13099 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) {
13100 LDKCVec_u64Z channels_arg_constr;
13101 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
13102 if (channels_arg_constr.datalen > 0)
13103 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
13105 channels_arg_constr.data = NULL;
13106 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
13107 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
13108 long arr_conv_6 = channels_arg_vals[g];
13109 channels_arg_constr.data[g] = arr_conv_6;
13111 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
13112 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
13113 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
13114 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
13115 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
13116 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
13117 LDKNodeAnnouncementInfo announcement_info_arg_conv;
13118 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
13119 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
13120 // Warning: we may need a move here but can't clone!
13121 LDKNodeInfo ret = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
13122 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13125 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13126 LDKNodeInfo obj_conv;
13127 obj_conv.inner = (void*)(obj & (~1));
13128 obj_conv.is_owned = (obj & 1) || (obj == 0);
13129 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
13130 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13131 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13132 CVec_u8Z_free(arg_var);
13136 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13137 LDKu8slice ser_ref;
13138 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13139 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13140 LDKNodeInfo ret = NodeInfo_read(ser_ref);
13141 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13142 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13145 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
13146 LDKNetworkGraph obj_conv;
13147 obj_conv.inner = (void*)(obj & (~1));
13148 obj_conv.is_owned = (obj & 1) || (obj == 0);
13149 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
13150 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13151 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13152 CVec_u8Z_free(arg_var);
13156 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13157 LDKu8slice ser_ref;
13158 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13159 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13160 LDKNetworkGraph ret = NetworkGraph_read(ser_ref);
13161 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13162 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13165 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
13166 LDKNetworkGraph ret = NetworkGraph_new();
13167 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13170 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) {
13171 LDKNetworkGraph this_arg_conv;
13172 this_arg_conv.inner = (void*)(this_arg & (~1));
13173 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13174 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);