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!\n", ptr);
61 return; // addrsan should catch malloc-unknown and print more info than we have
64 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
65 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
66 DO_ASSERT(it->ptr == ptr);
69 static void FREE(void* ptr) {
70 if ((long)ptr < 1024) return; // Rust loves to create pointers to the NULL page for dummys
75 void* __wrap_malloc(size_t len) {
76 void* res = __real_malloc(len);
77 new_allocation(res, "malloc call");
80 void* __wrap_calloc(size_t nmemb, size_t len) {
81 void* res = __real_calloc(nmemb, len);
82 new_allocation(res, "calloc call");
85 void __wrap_free(void* ptr) {
90 void* __real_realloc(void* ptr, size_t newlen);
91 void* __wrap_realloc(void* ptr, size_t len) {
93 void* res = __real_realloc(ptr, len);
94 new_allocation(res, "realloc call");
97 void __wrap_reallocarray(void* ptr, size_t new_sz) {
98 // Rust doesn't seem to use reallocarray currently
102 void __attribute__((destructor)) check_leaks() {
103 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
104 fprintf(stderr, "%s %p remains:\n", a->struct_name, a->ptr);
105 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
106 fprintf(stderr, "\n\n");
108 DO_ASSERT(allocation_ll == NULL);
111 static jmethodID ordinal_meth = NULL;
112 static jmethodID slicedef_meth = NULL;
113 static jclass slicedef_cls = NULL;
114 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
115 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
116 CHECK(ordinal_meth != NULL);
117 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
118 CHECK(slicedef_meth != NULL);
119 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
120 CHECK(slicedef_cls != NULL);
123 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
124 return *((bool*)ptr);
126 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
127 return *((long*)ptr);
129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
132 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * _env, jclass _b, jlong ptr, jlong len) {
133 jbyteArray ret_arr = (*_env)->NewByteArray(_env, len);
134 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, len, (unsigned char*)ptr);
137 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * _env, jclass _b, jlong slice_ptr) {
138 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
139 jbyteArray ret_arr = (*_env)->NewByteArray(_env, slice->datalen);
140 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, slice->datalen, slice->data);
143 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * _env, jclass _b, jbyteArray bytes) {
144 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
145 vec->datalen = (*_env)->GetArrayLength(_env, bytes);
146 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
147 (*_env)->GetByteArrayRegion (_env, bytes, 0, vec->datalen, vec->data);
150 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
151 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
152 txdata->datalen = (*env)->GetArrayLength(env, bytes);
153 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
154 txdata->data_is_owned = false;
155 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
159 LDKTransaction *tx = (LDKTransaction*)ptr;
160 tx->data_is_owned = true;
161 Transaction_free(*tx);
164 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
165 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
166 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
167 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
168 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
169 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
170 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
171 return (long)vec->datalen;
173 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * _env, jclass _b) {
174 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
175 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
176 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
177 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
178 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
179 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
185 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
186 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
187 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
188 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
190 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
191 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
192 case 0: return LDKAccessError_UnknownChain;
193 case 1: return LDKAccessError_UnknownTx;
197 static jclass LDKAccessError_class = NULL;
198 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
199 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
200 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv * env, jclass clz) {
201 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
202 CHECK(LDKAccessError_class != NULL);
203 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
204 CHECK(LDKAccessError_LDKAccessError_UnknownChain != NULL);
205 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
206 CHECK(LDKAccessError_LDKAccessError_UnknownTx != NULL);
208 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
210 case LDKAccessError_UnknownChain:
211 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
212 case LDKAccessError_UnknownTx:
213 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
218 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
219 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
220 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
221 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
225 static jclass LDKChannelMonitorUpdateErr_class = NULL;
226 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
227 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
228 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv * env, jclass clz) {
229 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
230 CHECK(LDKChannelMonitorUpdateErr_class != NULL);
231 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
232 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
233 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
234 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
236 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
238 case LDKChannelMonitorUpdateErr_TemporaryFailure:
239 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
240 case LDKChannelMonitorUpdateErr_PermanentFailure:
241 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
246 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
247 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
248 case 0: return LDKConfirmationTarget_Background;
249 case 1: return LDKConfirmationTarget_Normal;
250 case 2: return LDKConfirmationTarget_HighPriority;
254 static jclass LDKConfirmationTarget_class = NULL;
255 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
256 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
257 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
258 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv * env, jclass clz) {
259 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
260 CHECK(LDKConfirmationTarget_class != NULL);
261 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
262 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
263 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
264 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
265 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
266 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
268 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
270 case LDKConfirmationTarget_Background:
271 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
272 case LDKConfirmationTarget_Normal:
273 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
274 case LDKConfirmationTarget_HighPriority:
275 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
280 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
281 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
282 case 0: return LDKLevel_Off;
283 case 1: return LDKLevel_Error;
284 case 2: return LDKLevel_Warn;
285 case 3: return LDKLevel_Info;
286 case 4: return LDKLevel_Debug;
287 case 5: return LDKLevel_Trace;
291 static jclass LDKLevel_class = NULL;
292 static jfieldID LDKLevel_LDKLevel_Off = NULL;
293 static jfieldID LDKLevel_LDKLevel_Error = NULL;
294 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
295 static jfieldID LDKLevel_LDKLevel_Info = NULL;
296 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
297 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
298 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv * env, jclass clz) {
299 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
300 CHECK(LDKLevel_class != NULL);
301 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
302 CHECK(LDKLevel_LDKLevel_Off != NULL);
303 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
304 CHECK(LDKLevel_LDKLevel_Error != NULL);
305 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
306 CHECK(LDKLevel_LDKLevel_Warn != NULL);
307 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
308 CHECK(LDKLevel_LDKLevel_Info != NULL);
309 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
310 CHECK(LDKLevel_LDKLevel_Debug != NULL);
311 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
312 CHECK(LDKLevel_LDKLevel_Trace != NULL);
314 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
317 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
319 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
321 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
323 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
325 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
327 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
332 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
333 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
334 case 0: return LDKNetwork_Bitcoin;
335 case 1: return LDKNetwork_Testnet;
336 case 2: return LDKNetwork_Regtest;
340 static jclass LDKNetwork_class = NULL;
341 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
342 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
343 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
344 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv * env, jclass clz) {
345 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
346 CHECK(LDKNetwork_class != NULL);
347 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
348 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
349 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
350 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
351 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
352 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
354 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
356 case LDKNetwork_Bitcoin:
357 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
358 case LDKNetwork_Testnet:
359 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
360 case LDKNetwork_Regtest:
361 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
366 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
367 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
368 case 0: return LDKSecp256k1Error_IncorrectSignature;
369 case 1: return LDKSecp256k1Error_InvalidMessage;
370 case 2: return LDKSecp256k1Error_InvalidPublicKey;
371 case 3: return LDKSecp256k1Error_InvalidSignature;
372 case 4: return LDKSecp256k1Error_InvalidSecretKey;
373 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
374 case 6: return LDKSecp256k1Error_InvalidTweak;
375 case 7: return LDKSecp256k1Error_NotEnoughMemory;
376 case 8: return LDKSecp256k1Error_CallbackPanicked;
380 static jclass LDKSecp256k1Error_class = NULL;
381 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
382 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
383 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
384 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
385 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
386 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
387 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
388 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
389 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
390 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv * env, jclass clz) {
391 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
392 CHECK(LDKSecp256k1Error_class != NULL);
393 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
394 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
395 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
396 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
397 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
398 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
399 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
400 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
401 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
402 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
403 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
404 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
405 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
406 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
407 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
408 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
409 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
410 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
412 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
414 case LDKSecp256k1Error_IncorrectSignature:
415 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
416 case LDKSecp256k1Error_InvalidMessage:
417 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
418 case LDKSecp256k1Error_InvalidPublicKey:
419 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
420 case LDKSecp256k1Error_InvalidSignature:
421 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
422 case LDKSecp256k1Error_InvalidSecretKey:
423 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
424 case LDKSecp256k1Error_InvalidRecoveryId:
425 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
426 case LDKSecp256k1Error_InvalidTweak:
427 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
428 case LDKSecp256k1Error_NotEnoughMemory:
429 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
430 case LDKSecp256k1Error_CallbackPanicked:
431 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
436 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
437 LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr;
438 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
440 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1new(JNIEnv *env, jclass _b, jbyteArray elems){
441 LDKCVecTempl_u8 *ret = MALLOC(sizeof(LDKCVecTempl_u8), "LDKCVecTempl_u8");
442 ret->datalen = (*env)->GetArrayLength(env, elems);
443 if (ret->datalen == 0) {
446 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVecTempl_u8 Data");
447 jbyte *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
448 for (size_t i = 0; i < ret->datalen; i++) {
449 ret->data[i] = java_elems[i];
451 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
455 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
456 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
458 LDKTransaction b_conv = *(LDKTransaction*)b;
462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
463 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
465 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
466 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
467 CHECK(val->result_ok);
468 return *val->contents.result;
470 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
471 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
472 CHECK(!val->result_ok);
473 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(_env, (*val->contents.err));
476 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
477 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
479 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
480 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
481 CHECK(val->result_ok);
482 return *val->contents.result;
484 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
485 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
486 CHECK(!val->result_ok);
487 LDKMonitorUpdateError err_var = (*val->contents.err);
488 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
489 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
490 long err_ref = (long)err_var.inner & ~1;
493 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
494 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
496 a_conv.inner = (void*)(a & (~1));
497 a_conv.is_owned = (a & 1) || (a == 0);
498 if (a_conv.inner != NULL)
499 a_conv = OutPoint_clone(&a_conv);
502 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
503 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
505 //TODO: Really need to call (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0); here
508 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
509 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
510 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
512 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
513 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
514 ret->datalen = (*env)->GetArrayLength(env, elems);
515 if (ret->datalen == 0) {
518 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
519 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
520 for (size_t i = 0; i < ret->datalen; i++) {
521 jlong arr_elem = java_elems[i];
522 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
523 FREE((void*)arr_elem);
524 ret->data[i] = arr_elem_conv;
526 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
530 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlongArray b) {
531 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
532 LDKThirtyTwoBytes a_ref;
533 CHECK((*_env)->GetArrayLength (_env, a) == 32);
534 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
536 LDKCVecTempl_TxOut b_constr;
537 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
538 if (b_constr.datalen > 0)
539 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVecTempl_TxOut Elements");
541 b_constr.data = NULL;
542 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
543 for (size_t h = 0; h < b_constr.datalen; h++) {
544 long arr_conv_7 = b_vals[h];
545 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
546 FREE((void*)arr_conv_7);
547 b_constr.data[h] = arr_conv_7_conv;
549 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
553 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
554 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
559 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
560 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
561 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
563 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jbyteArray a, jobjectArray b) {
564 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
566 CHECK((*_env)->GetArrayLength (_env, a) == 64);
567 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
569 LDKCVecTempl_Signature b_constr;
570 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
571 if (b_constr.datalen > 0)
572 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVecTempl_Signature Elements");
574 b_constr.data = NULL;
575 for (size_t i = 0; i < b_constr.datalen; i++) {
576 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
577 LDKSignature arr_conv_8_ref;
578 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
579 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
580 b_constr.data[i] = arr_conv_8_ref;
585 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
586 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
588 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
589 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
590 CHECK(val->result_ok);
591 long res_ref = (long)&(*val->contents.result);
594 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
595 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
596 CHECK(!val->result_ok);
597 return *val->contents.err;
599 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
600 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
602 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
603 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
604 CHECK(val->result_ok);
605 jbyteArray res_arr = (*_env)->NewByteArray(_env, 64);
606 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 64, (*val->contents.result).compact_form);
609 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
610 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
611 CHECK(!val->result_ok);
612 return *val->contents.err;
614 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
615 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
617 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
618 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
619 CHECK(val->result_ok);
620 LDKCVecTempl_Signature res_var = (*val->contents.result);
621 jobjectArray res_arr = (*_env)->NewObjectArray(_env, res_var.datalen, NULL, NULL);
622 for (size_t i = 0; i < res_var.datalen; i++) {
623 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
624 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
625 (*_env)->SetObjectArrayElement(_env, res_arr, i, arr_conv_8_arr);
629 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
630 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
631 CHECK(!val->result_ok);
632 return *val->contents.err;
634 static jclass LDKAPIError_APIMisuseError_class = NULL;
635 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
636 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
637 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
638 static jclass LDKAPIError_RouteError_class = NULL;
639 static jmethodID LDKAPIError_RouteError_meth = NULL;
640 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
641 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
642 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
643 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
645 LDKAPIError_APIMisuseError_class =
646 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
647 CHECK(LDKAPIError_APIMisuseError_class != NULL);
648 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
649 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
650 LDKAPIError_FeeRateTooHigh_class =
651 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
652 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
653 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
654 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
655 LDKAPIError_RouteError_class =
656 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
657 CHECK(LDKAPIError_RouteError_class != NULL);
658 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
659 CHECK(LDKAPIError_RouteError_meth != NULL);
660 LDKAPIError_ChannelUnavailable_class =
661 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
662 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
663 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
664 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
665 LDKAPIError_MonitorUpdateFailed_class =
666 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
667 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
668 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
669 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
671 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
672 LDKAPIError *obj = (LDKAPIError*)ptr;
674 case LDKAPIError_APIMisuseError: {
675 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
676 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
677 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
678 return (*_env)->NewObject(_env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
680 case LDKAPIError_FeeRateTooHigh: {
681 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
682 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
683 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
684 return (*_env)->NewObject(_env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
686 case LDKAPIError_RouteError: {
687 LDKStr err_str = obj->route_error.err;
688 char* err_buf = MALLOC(err_str.len + 1, "str conv buf");
689 memcpy(err_buf, err_str.chars, err_str.len);
690 err_buf[err_str.len] = 0;
691 jstring err_conv = (*_env)->NewStringUTF(_env, err_str.chars);
693 return (*_env)->NewObject(_env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
695 case LDKAPIError_ChannelUnavailable: {
696 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
697 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
698 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
699 return (*_env)->NewObject(_env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
701 case LDKAPIError_MonitorUpdateFailed: {
702 return (*_env)->NewObject(_env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
707 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
708 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
710 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
711 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
712 CHECK(val->result_ok);
713 return *val->contents.result;
715 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
716 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
717 CHECK(!val->result_ok);
718 long err_ref = (long)&(*val->contents.err);
721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
722 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
724 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
725 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
726 CHECK(val->result_ok);
727 return *val->contents.result;
729 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
730 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
731 CHECK(!val->result_ok);
732 LDKPaymentSendFailure err_var = (*val->contents.err);
733 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
734 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
735 long err_ref = (long)err_var.inner & ~1;
738 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) {
739 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
740 LDKChannelAnnouncement a_conv;
741 a_conv.inner = (void*)(a & (~1));
742 a_conv.is_owned = (a & 1) || (a == 0);
743 if (a_conv.inner != NULL)
744 a_conv = ChannelAnnouncement_clone(&a_conv);
746 LDKChannelUpdate b_conv;
747 b_conv.inner = (void*)(b & (~1));
748 b_conv.is_owned = (b & 1) || (b == 0);
749 if (b_conv.inner != NULL)
750 b_conv = ChannelUpdate_clone(&b_conv);
752 LDKChannelUpdate c_conv;
753 c_conv.inner = (void*)(c & (~1));
754 c_conv.is_owned = (c & 1) || (c == 0);
755 if (c_conv.inner != NULL)
756 c_conv = ChannelUpdate_clone(&c_conv);
760 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
761 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
763 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
764 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
765 CHECK(val->result_ok);
766 return *val->contents.result;
768 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
769 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
770 CHECK(!val->result_ok);
771 LDKPeerHandleError err_var = (*val->contents.err);
772 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
773 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
774 long err_ref = (long)err_var.inner & ~1;
777 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
778 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
779 LDKHTLCOutputInCommitment a_conv;
780 a_conv.inner = (void*)(a & (~1));
781 a_conv.is_owned = (a & 1) || (a == 0);
782 if (a_conv.inner != NULL)
783 a_conv = HTLCOutputInCommitment_clone(&a_conv);
786 CHECK((*_env)->GetArrayLength (_env, b) == 64);
787 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
791 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
792 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
793 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
794 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
795 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
796 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
798 LDKSpendableOutputDescriptor_StaticOutput_class =
799 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
800 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
801 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
802 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
803 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
804 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
805 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
806 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
807 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
808 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
809 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
810 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
811 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
812 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
814 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
815 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
817 case LDKSpendableOutputDescriptor_StaticOutput: {
818 LDKOutPoint outpoint_var = obj->static_output.outpoint;
819 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
820 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
821 long outpoint_ref = (long)outpoint_var.inner & ~1;
822 long output_ref = (long)&obj->static_output.output;
823 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
825 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
826 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
827 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
828 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
829 long outpoint_ref = (long)outpoint_var.inner & ~1;
830 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
831 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
832 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
833 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
834 jbyteArray revocation_pubkey_arr = (*_env)->NewByteArray(_env, 33);
835 (*_env)->SetByteArrayRegion(_env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
836 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);
838 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
839 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
840 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
841 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
842 long outpoint_ref = (long)outpoint_var.inner & ~1;
843 long output_ref = (long)&obj->static_output_counterparty_payment.output;
844 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
845 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
850 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
851 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
852 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
854 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
855 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
856 ret->datalen = (*env)->GetArrayLength(env, elems);
857 if (ret->datalen == 0) {
860 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
861 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
862 for (size_t i = 0; i < ret->datalen; i++) {
863 jlong arr_elem = java_elems[i];
864 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
865 FREE((void*)arr_elem);
866 ret->data[i] = arr_elem_conv;
868 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
872 static jclass LDKEvent_FundingGenerationReady_class = NULL;
873 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
874 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
875 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
876 static jclass LDKEvent_PaymentReceived_class = NULL;
877 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
878 static jclass LDKEvent_PaymentSent_class = NULL;
879 static jmethodID LDKEvent_PaymentSent_meth = NULL;
880 static jclass LDKEvent_PaymentFailed_class = NULL;
881 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
882 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
883 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
884 static jclass LDKEvent_SpendableOutputs_class = NULL;
885 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
887 LDKEvent_FundingGenerationReady_class =
888 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
889 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
890 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
891 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
892 LDKEvent_FundingBroadcastSafe_class =
893 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
894 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
895 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
896 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
897 LDKEvent_PaymentReceived_class =
898 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
899 CHECK(LDKEvent_PaymentReceived_class != NULL);
900 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
901 CHECK(LDKEvent_PaymentReceived_meth != NULL);
902 LDKEvent_PaymentSent_class =
903 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
904 CHECK(LDKEvent_PaymentSent_class != NULL);
905 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
906 CHECK(LDKEvent_PaymentSent_meth != NULL);
907 LDKEvent_PaymentFailed_class =
908 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
909 CHECK(LDKEvent_PaymentFailed_class != NULL);
910 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
911 CHECK(LDKEvent_PaymentFailed_meth != NULL);
912 LDKEvent_PendingHTLCsForwardable_class =
913 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
914 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
915 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
916 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
917 LDKEvent_SpendableOutputs_class =
918 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
919 CHECK(LDKEvent_SpendableOutputs_class != NULL);
920 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
921 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
923 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
924 LDKEvent *obj = (LDKEvent*)ptr;
926 case LDKEvent_FundingGenerationReady: {
927 jbyteArray temporary_channel_id_arr = (*_env)->NewByteArray(_env, 32);
928 (*_env)->SetByteArrayRegion(_env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
929 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
930 jbyteArray output_script_arr = (*_env)->NewByteArray(_env, output_script_var.datalen);
931 (*_env)->SetByteArrayRegion(_env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
932 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);
934 case LDKEvent_FundingBroadcastSafe: {
935 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
936 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
937 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
938 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
939 return (*_env)->NewObject(_env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
941 case LDKEvent_PaymentReceived: {
942 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
943 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
944 jbyteArray payment_secret_arr = (*_env)->NewByteArray(_env, 32);
945 (*_env)->SetByteArrayRegion(_env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
946 return (*_env)->NewObject(_env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
948 case LDKEvent_PaymentSent: {
949 jbyteArray payment_preimage_arr = (*_env)->NewByteArray(_env, 32);
950 (*_env)->SetByteArrayRegion(_env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
951 return (*_env)->NewObject(_env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
953 case LDKEvent_PaymentFailed: {
954 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
955 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
956 return (*_env)->NewObject(_env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
958 case LDKEvent_PendingHTLCsForwardable: {
959 return (*_env)->NewObject(_env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
961 case LDKEvent_SpendableOutputs: {
962 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
963 jlongArray outputs_arr = (*_env)->NewLongArray(_env, outputs_var.datalen);
964 jlong *outputs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, outputs_arr, NULL);
965 for (size_t b = 0; b < outputs_var.datalen; b++) {
966 long arr_conv_27_ref = (long)&outputs_var.data[b];
967 outputs_arr_ptr[b] = arr_conv_27_ref;
969 (*_env)->ReleasePrimitiveArrayCritical(_env, outputs_arr, outputs_arr_ptr, 0);
970 return (*_env)->NewObject(_env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
975 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
976 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
977 static jclass LDKErrorAction_IgnoreError_class = NULL;
978 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
979 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
980 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
982 LDKErrorAction_DisconnectPeer_class =
983 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
984 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
985 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
986 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
987 LDKErrorAction_IgnoreError_class =
988 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
989 CHECK(LDKErrorAction_IgnoreError_class != NULL);
990 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
991 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
992 LDKErrorAction_SendErrorMessage_class =
993 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
994 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
995 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
996 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
998 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
999 LDKErrorAction *obj = (LDKErrorAction*)ptr;
1001 case LDKErrorAction_DisconnectPeer: {
1002 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1003 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1004 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1005 long msg_ref = (long)msg_var.inner & ~1;
1006 return (*_env)->NewObject(_env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1008 case LDKErrorAction_IgnoreError: {
1009 return (*_env)->NewObject(_env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1011 case LDKErrorAction_SendErrorMessage: {
1012 LDKErrorMessage msg_var = obj->send_error_message.msg;
1013 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1014 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1015 long msg_ref = (long)msg_var.inner & ~1;
1016 return (*_env)->NewObject(_env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1021 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1022 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1023 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1024 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1025 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1026 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
1028 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1029 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1030 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1031 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1032 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1033 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1034 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1035 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1036 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1037 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1038 LDKHTLCFailChannelUpdate_NodeFailure_class =
1039 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1040 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1041 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1042 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1044 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1045 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
1047 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1048 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1049 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1050 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1051 long msg_ref = (long)msg_var.inner & ~1;
1052 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1054 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1055 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1057 case LDKHTLCFailChannelUpdate_NodeFailure: {
1058 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1059 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1060 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1065 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1066 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1067 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1068 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1069 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1070 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1071 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1072 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1073 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1074 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1075 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1076 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1077 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1078 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1079 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1080 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1081 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1082 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1083 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1084 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1085 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1086 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1087 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1088 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1089 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1090 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1091 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1092 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1093 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1094 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1095 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1096 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1098 LDKMessageSendEvent_SendAcceptChannel_class =
1099 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1100 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1101 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1102 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1103 LDKMessageSendEvent_SendOpenChannel_class =
1104 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1105 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1106 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1107 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1108 LDKMessageSendEvent_SendFundingCreated_class =
1109 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1110 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1111 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1112 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1113 LDKMessageSendEvent_SendFundingSigned_class =
1114 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1115 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1116 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1117 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1118 LDKMessageSendEvent_SendFundingLocked_class =
1119 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1120 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1121 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1122 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1123 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1124 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1125 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1126 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1127 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1128 LDKMessageSendEvent_UpdateHTLCs_class =
1129 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1130 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1131 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1132 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1133 LDKMessageSendEvent_SendRevokeAndACK_class =
1134 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1135 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1136 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1137 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1138 LDKMessageSendEvent_SendClosingSigned_class =
1139 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1140 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1141 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1142 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1143 LDKMessageSendEvent_SendShutdown_class =
1144 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1145 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1146 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1147 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1148 LDKMessageSendEvent_SendChannelReestablish_class =
1149 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1150 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1151 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1152 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1153 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1154 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1155 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1156 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1157 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1158 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1159 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1160 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1161 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1162 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1163 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1164 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1165 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1166 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1167 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1168 LDKMessageSendEvent_HandleError_class =
1169 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1170 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1171 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1172 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1173 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1174 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1175 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1176 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1177 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1179 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1180 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1182 case LDKMessageSendEvent_SendAcceptChannel: {
1183 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1184 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1185 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1186 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1187 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1188 long msg_ref = (long)msg_var.inner & ~1;
1189 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1191 case LDKMessageSendEvent_SendOpenChannel: {
1192 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1193 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1194 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1195 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1196 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1197 long msg_ref = (long)msg_var.inner & ~1;
1198 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1200 case LDKMessageSendEvent_SendFundingCreated: {
1201 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1202 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1203 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1204 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1205 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1206 long msg_ref = (long)msg_var.inner & ~1;
1207 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1209 case LDKMessageSendEvent_SendFundingSigned: {
1210 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1211 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1212 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1213 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1214 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1215 long msg_ref = (long)msg_var.inner & ~1;
1216 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1218 case LDKMessageSendEvent_SendFundingLocked: {
1219 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1220 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1221 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1222 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1223 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1224 long msg_ref = (long)msg_var.inner & ~1;
1225 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1227 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1228 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1229 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1230 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1231 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1232 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1233 long msg_ref = (long)msg_var.inner & ~1;
1234 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1236 case LDKMessageSendEvent_UpdateHTLCs: {
1237 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1238 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1239 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1240 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1241 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1242 long updates_ref = (long)updates_var.inner & ~1;
1243 return (*_env)->NewObject(_env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1245 case LDKMessageSendEvent_SendRevokeAndACK: {
1246 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1247 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1248 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1249 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1250 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1251 long msg_ref = (long)msg_var.inner & ~1;
1252 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1254 case LDKMessageSendEvent_SendClosingSigned: {
1255 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1256 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1257 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1258 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1259 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1260 long msg_ref = (long)msg_var.inner & ~1;
1261 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1263 case LDKMessageSendEvent_SendShutdown: {
1264 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1265 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1266 LDKShutdown msg_var = obj->send_shutdown.msg;
1267 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1268 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1269 long msg_ref = (long)msg_var.inner & ~1;
1270 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1272 case LDKMessageSendEvent_SendChannelReestablish: {
1273 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1274 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1275 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1276 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1277 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1278 long msg_ref = (long)msg_var.inner & ~1;
1279 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1281 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1282 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1283 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1284 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1285 long msg_ref = (long)msg_var.inner & ~1;
1286 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1287 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1288 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1289 long update_msg_ref = (long)update_msg_var.inner & ~1;
1290 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1292 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1293 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1294 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1295 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1296 long msg_ref = (long)msg_var.inner & ~1;
1297 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1299 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1300 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1301 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1302 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1303 long msg_ref = (long)msg_var.inner & ~1;
1304 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1306 case LDKMessageSendEvent_HandleError: {
1307 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1308 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1309 long action_ref = (long)&obj->handle_error.action;
1310 return (*_env)->NewObject(_env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1312 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1313 long update_ref = (long)&obj->payment_failure_network_update.update;
1314 return (*_env)->NewObject(_env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1319 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1320 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1321 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1323 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1324 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1325 ret->datalen = (*env)->GetArrayLength(env, elems);
1326 if (ret->datalen == 0) {
1329 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1330 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1331 for (size_t i = 0; i < ret->datalen; i++) {
1332 jlong arr_elem = java_elems[i];
1333 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1334 FREE((void*)arr_elem);
1335 ret->data[i] = arr_elem_conv;
1337 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1341 typedef struct LDKMessageSendEventsProvider_JCalls {
1342 atomic_size_t refcnt;
1345 jmethodID get_and_clear_pending_msg_events_meth;
1346 } LDKMessageSendEventsProvider_JCalls;
1347 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1348 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1350 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1351 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1353 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1354 LDKCVec_MessageSendEventZ ret_constr;
1355 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
1356 if (ret_constr.datalen > 0)
1357 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
1359 ret_constr.data = NULL;
1360 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
1361 for (size_t s = 0; s < ret_constr.datalen; s++) {
1362 long arr_conv_18 = ret_vals[s];
1363 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
1364 FREE((void*)arr_conv_18);
1365 ret_constr.data[s] = arr_conv_18_conv;
1367 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
1370 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1371 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1372 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1374 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1375 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1379 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1380 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1381 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1382 return (void*) this_arg;
1384 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1385 jclass c = (*env)->GetObjectClass(env, o);
1387 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1388 atomic_init(&calls->refcnt, 1);
1389 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1390 calls->o = (*env)->NewWeakGlobalRef(env, o);
1391 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
1392 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
1394 LDKMessageSendEventsProvider ret = {
1395 .this_arg = (void*) calls,
1396 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1397 .free = LDKMessageSendEventsProvider_JCalls_free,
1401 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1402 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1403 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1404 return (long)res_ptr;
1406 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1407 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1411 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1412 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1413 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1414 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1415 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1416 for (size_t s = 0; s < ret_var.datalen; s++) {
1417 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
1418 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
1419 long arr_conv_18_ref = (long)arr_conv_18_copy;
1420 ret_arr_ptr[s] = arr_conv_18_ref;
1422 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1423 CVec_MessageSendEventZ_free(ret_var);
1427 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1428 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1429 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1431 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1432 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1433 ret->datalen = (*env)->GetArrayLength(env, elems);
1434 if (ret->datalen == 0) {
1437 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1438 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1439 for (size_t i = 0; i < ret->datalen; i++) {
1440 jlong arr_elem = java_elems[i];
1441 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1442 FREE((void*)arr_elem);
1443 ret->data[i] = arr_elem_conv;
1445 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1449 typedef struct LDKEventsProvider_JCalls {
1450 atomic_size_t refcnt;
1453 jmethodID get_and_clear_pending_events_meth;
1454 } LDKEventsProvider_JCalls;
1455 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1456 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1458 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1459 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1461 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_events_meth);
1462 LDKCVec_EventZ ret_constr;
1463 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
1464 if (ret_constr.datalen > 0)
1465 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
1467 ret_constr.data = NULL;
1468 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
1469 for (size_t h = 0; h < ret_constr.datalen; h++) {
1470 long arr_conv_7 = ret_vals[h];
1471 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
1472 FREE((void*)arr_conv_7);
1473 ret_constr.data[h] = arr_conv_7_conv;
1475 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
1478 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1479 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1480 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1482 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1483 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1487 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1488 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1489 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1490 return (void*) this_arg;
1492 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1493 jclass c = (*env)->GetObjectClass(env, o);
1495 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1496 atomic_init(&calls->refcnt, 1);
1497 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1498 calls->o = (*env)->NewWeakGlobalRef(env, o);
1499 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
1500 CHECK(calls->get_and_clear_pending_events_meth != NULL);
1502 LDKEventsProvider ret = {
1503 .this_arg = (void*) calls,
1504 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1505 .free = LDKEventsProvider_JCalls_free,
1509 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1510 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1511 *res_ptr = LDKEventsProvider_init(env, _a, o);
1512 return (long)res_ptr;
1514 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1515 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1519 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1520 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1521 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1522 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1523 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1524 for (size_t h = 0; h < ret_var.datalen; h++) {
1525 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
1526 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
1527 long arr_conv_7_ref = (long)arr_conv_7_copy;
1528 ret_arr_ptr[h] = arr_conv_7_ref;
1530 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1531 CVec_EventZ_free(ret_var);
1535 typedef struct LDKLogger_JCalls {
1536 atomic_size_t refcnt;
1541 void log_jcall(const void* this_arg, const char *record) {
1542 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1544 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1545 jstring record_conv = (*_env)->NewStringUTF(_env, record);
1546 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1548 return (*_env)->CallVoidMethod(_env, obj, j_calls->log_meth, record_conv);
1550 static void LDKLogger_JCalls_free(void* this_arg) {
1551 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1552 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1554 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1555 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1559 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1560 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1561 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1562 return (void*) this_arg;
1564 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1565 jclass c = (*env)->GetObjectClass(env, o);
1567 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1568 atomic_init(&calls->refcnt, 1);
1569 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1570 calls->o = (*env)->NewWeakGlobalRef(env, o);
1571 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1572 CHECK(calls->log_meth != NULL);
1575 .this_arg = (void*) calls,
1577 .free = LDKLogger_JCalls_free,
1581 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1582 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1583 *res_ptr = LDKLogger_init(env, _a, o);
1584 return (long)res_ptr;
1586 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1587 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1591 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1592 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1594 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1595 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1596 CHECK(val->result_ok);
1597 long res_ref = (long)&(*val->contents.result);
1600 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1601 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1602 CHECK(!val->result_ok);
1603 jclass err_conv = LDKAccessError_to_java(_env, (*val->contents.err));
1606 typedef struct LDKAccess_JCalls {
1607 atomic_size_t refcnt;
1610 jmethodID get_utxo_meth;
1612 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1613 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1615 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1616 jbyteArray genesis_hash_arr = (*_env)->NewByteArray(_env, 32);
1617 (*_env)->SetByteArrayRegion(_env, genesis_hash_arr, 0, 32, *genesis_hash);
1618 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1620 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1621 LDKCResult_TxOutAccessErrorZ res = *ret;
1625 static void LDKAccess_JCalls_free(void* this_arg) {
1626 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1627 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1629 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1630 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1634 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1635 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1636 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1637 return (void*) this_arg;
1639 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1640 jclass c = (*env)->GetObjectClass(env, o);
1642 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1643 atomic_init(&calls->refcnt, 1);
1644 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1645 calls->o = (*env)->NewWeakGlobalRef(env, o);
1646 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1647 CHECK(calls->get_utxo_meth != NULL);
1650 .this_arg = (void*) calls,
1651 .get_utxo = get_utxo_jcall,
1652 .free = LDKAccess_JCalls_free,
1656 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1657 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1658 *res_ptr = LDKAccess_init(env, _a, o);
1659 return (long)res_ptr;
1661 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1662 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1666 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) {
1667 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1668 unsigned char genesis_hash_arr[32];
1669 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
1670 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1671 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1672 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1673 *ret = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1677 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1678 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1679 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1680 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1681 for (size_t i = 0; i < vec->datalen; i++) {
1682 CHECK((((long)vec->data[i].inner) & 1) == 0);
1683 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1685 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1688 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1689 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1690 ret->datalen = (*env)->GetArrayLength(env, elems);
1691 if (ret->datalen == 0) {
1694 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1695 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1696 for (size_t i = 0; i < ret->datalen; i++) {
1697 jlong arr_elem = java_elems[i];
1698 LDKHTLCOutputInCommitment arr_elem_conv;
1699 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1700 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1701 if (arr_elem_conv.inner != NULL)
1702 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1703 ret->data[i] = arr_elem_conv;
1705 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1709 typedef struct LDKChannelKeys_JCalls {
1710 atomic_size_t refcnt;
1713 jmethodID get_per_commitment_point_meth;
1714 jmethodID release_commitment_secret_meth;
1715 jmethodID key_derivation_params_meth;
1716 jmethodID sign_counterparty_commitment_meth;
1717 jmethodID sign_holder_commitment_meth;
1718 jmethodID sign_holder_commitment_htlc_transactions_meth;
1719 jmethodID sign_justice_transaction_meth;
1720 jmethodID sign_counterparty_htlc_transaction_meth;
1721 jmethodID sign_closing_transaction_meth;
1722 jmethodID sign_channel_announcement_meth;
1723 jmethodID on_accept_meth;
1724 } LDKChannelKeys_JCalls;
1725 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1726 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1728 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1729 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1731 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_per_commitment_point_meth, idx);
1732 LDKPublicKey ret_ref;
1733 CHECK((*_env)->GetArrayLength (_env, ret) == 33);
1734 (*_env)->GetByteArrayRegion (_env, ret, 0, 33, ret_ref.compressed_form);
1737 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1738 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1740 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1741 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1743 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->release_commitment_secret_meth, idx);
1744 LDKThirtyTwoBytes ret_ref;
1745 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
1746 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.data);
1749 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1750 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1752 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1753 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1755 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*_env)->CallLongMethod(_env, obj, j_calls->key_derivation_params_meth);
1756 LDKC2Tuple_u64u64Z res = *ret;
1760 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) {
1761 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1763 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1764 LDKTransaction *commitment_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1765 *commitment_tx_copy = commitment_tx;
1766 long commitment_tx_ref = (long)commitment_tx_copy;
1767 LDKCVec_HTLCOutputInCommitmentZ htlcs_var = htlcs;
1768 jlongArray htlcs_arr = (*_env)->NewLongArray(_env, htlcs_var.datalen);
1769 jlong *htlcs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, htlcs_arr, NULL);
1770 for (size_t y = 0; y < htlcs_var.datalen; y++) {
1771 LDKHTLCOutputInCommitment arr_conv_24_var = htlcs_var.data[y];
1772 CHECK((((long)arr_conv_24_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1773 CHECK((((long)&arr_conv_24_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1774 long arr_conv_24_ref;
1775 if (arr_conv_24_var.is_owned) {
1776 arr_conv_24_ref = (long)arr_conv_24_var.inner | 1;
1778 arr_conv_24_ref = (long)arr_conv_24_var.inner & ~1;
1780 htlcs_arr_ptr[y] = arr_conv_24_ref;
1782 (*_env)->ReleasePrimitiveArrayCritical(_env, htlcs_arr, htlcs_arr_ptr, 0);
1783 FREE(htlcs_var.data);
1784 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1786 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);
1787 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
1791 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1792 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1794 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1795 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1797 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx);
1798 LDKCResult_SignatureNoneZ res = *ret;
1802 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1803 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1805 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1806 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1808 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx);
1809 LDKCResult_CVec_SignatureZNoneZ res = *ret;
1813 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) {
1814 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1816 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1817 LDKTransaction *justice_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1818 *justice_tx_copy = justice_tx;
1819 long justice_tx_ref = (long)justice_tx_copy;
1820 jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32);
1821 (*_env)->SetByteArrayRegion(_env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1822 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1824 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);
1825 LDKCResult_SignatureNoneZ res = *ret;
1829 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) {
1830 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1832 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1833 LDKTransaction *htlc_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1834 *htlc_tx_copy = htlc_tx;
1835 long htlc_tx_ref = (long)htlc_tx_copy;
1836 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
1837 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1838 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1840 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);
1841 LDKCResult_SignatureNoneZ res = *ret;
1845 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1846 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1848 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1849 LDKTransaction *closing_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1850 *closing_tx_copy = closing_tx;
1851 long closing_tx_ref = (long)closing_tx_copy;
1852 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1854 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1855 LDKCResult_SignatureNoneZ res = *ret;
1859 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1860 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1862 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1863 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1865 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, msg);
1866 LDKCResult_SignatureNoneZ res = *ret;
1870 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1871 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1873 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1874 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1876 return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
1878 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1879 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1880 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1882 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1883 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1887 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1888 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1889 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1890 return (void*) this_arg;
1892 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o) {
1893 jclass c = (*env)->GetObjectClass(env, o);
1895 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1896 atomic_init(&calls->refcnt, 1);
1897 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1898 calls->o = (*env)->NewWeakGlobalRef(env, o);
1899 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1900 CHECK(calls->get_per_commitment_point_meth != NULL);
1901 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1902 CHECK(calls->release_commitment_secret_meth != NULL);
1903 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1904 CHECK(calls->key_derivation_params_meth != NULL);
1905 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJ[J)J");
1906 CHECK(calls->sign_counterparty_commitment_meth != NULL);
1907 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1908 CHECK(calls->sign_holder_commitment_meth != NULL);
1909 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1910 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1911 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
1912 CHECK(calls->sign_justice_transaction_meth != NULL);
1913 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
1914 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
1915 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
1916 CHECK(calls->sign_closing_transaction_meth != NULL);
1917 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1918 CHECK(calls->sign_channel_announcement_meth != NULL);
1919 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
1920 CHECK(calls->on_accept_meth != NULL);
1922 LDKChannelKeys ret = {
1923 .this_arg = (void*) calls,
1924 .get_per_commitment_point = get_per_commitment_point_jcall,
1925 .release_commitment_secret = release_commitment_secret_jcall,
1926 .key_derivation_params = key_derivation_params_jcall,
1927 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1928 .sign_holder_commitment = sign_holder_commitment_jcall,
1929 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1930 .sign_justice_transaction = sign_justice_transaction_jcall,
1931 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1932 .sign_closing_transaction = sign_closing_transaction_jcall,
1933 .sign_channel_announcement = sign_channel_announcement_jcall,
1934 .on_accept = on_accept_jcall,
1935 .clone = LDKChannelKeys_JCalls_clone,
1936 .free = LDKChannelKeys_JCalls_free,
1940 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) {
1941 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1942 *res_ptr = LDKChannelKeys_init(env, _a, o);
1943 return (long)res_ptr;
1945 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1946 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
1950 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1951 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1952 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
1953 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
1957 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1958 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1959 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
1960 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
1964 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
1965 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1966 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1967 *ret = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1971 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) {
1972 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1973 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
1974 LDKPreCalculatedTxCreationKeys keys_conv;
1975 keys_conv.inner = (void*)(keys & (~1));
1976 keys_conv.is_owned = (keys & 1) || (keys == 0);
1977 LDKCVec_HTLCOutputInCommitmentZ htlcs_constr;
1978 htlcs_constr.datalen = (*_env)->GetArrayLength (_env, htlcs);
1979 if (htlcs_constr.datalen > 0)
1980 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
1982 htlcs_constr.data = NULL;
1983 long* htlcs_vals = (*_env)->GetLongArrayElements (_env, htlcs, NULL);
1984 for (size_t y = 0; y < htlcs_constr.datalen; y++) {
1985 long arr_conv_24 = htlcs_vals[y];
1986 LDKHTLCOutputInCommitment arr_conv_24_conv;
1987 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
1988 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
1989 if (arr_conv_24_conv.inner != NULL)
1990 arr_conv_24_conv = HTLCOutputInCommitment_clone(&arr_conv_24_conv);
1991 htlcs_constr.data[y] = arr_conv_24_conv;
1993 (*_env)->ReleaseLongArrayElements (_env, htlcs, htlcs_vals, 0);
1994 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1995 *ret = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_constr);
1999 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
2000 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2001 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2002 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2003 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
2004 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2005 *ret = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2009 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) {
2010 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2011 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2012 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2013 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
2014 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
2015 *ret = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2019 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) {
2020 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2021 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
2022 unsigned char per_commitment_key_arr[32];
2023 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
2024 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
2025 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2026 LDKHTLCOutputInCommitment htlc_conv;
2027 htlc_conv.inner = (void*)(htlc & (~1));
2028 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2029 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2030 *ret = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
2034 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) {
2035 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2036 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
2037 LDKPublicKey per_commitment_point_ref;
2038 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
2039 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2040 LDKHTLCOutputInCommitment htlc_conv;
2041 htlc_conv.inner = (void*)(htlc & (~1));
2042 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2043 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2044 *ret = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv);
2048 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) {
2049 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2050 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
2051 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2052 *ret = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv);
2056 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
2057 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2058 LDKUnsignedChannelAnnouncement msg_conv;
2059 msg_conv.inner = (void*)(msg & (~1));
2060 msg_conv.is_owned = (msg & 1) || (msg == 0);
2061 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2062 *ret = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2066 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) {
2067 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2068 LDKChannelPublicKeys channel_points_conv;
2069 channel_points_conv.inner = (void*)(channel_points & (~1));
2070 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2071 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2074 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2075 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2076 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2077 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2078 for (size_t i = 0; i < vec->datalen; i++) {
2079 CHECK((((long)vec->data[i].inner) & 1) == 0);
2080 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2082 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2085 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2086 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2087 ret->datalen = (*env)->GetArrayLength(env, elems);
2088 if (ret->datalen == 0) {
2091 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2092 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2093 for (size_t i = 0; i < ret->datalen; i++) {
2094 jlong arr_elem = java_elems[i];
2095 LDKMonitorEvent arr_elem_conv;
2096 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2097 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2098 // Warning: we may need a move here but can't clone!
2099 ret->data[i] = arr_elem_conv;
2101 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2105 typedef struct LDKWatch_JCalls {
2106 atomic_size_t refcnt;
2109 jmethodID watch_channel_meth;
2110 jmethodID update_channel_meth;
2111 jmethodID release_pending_monitor_events_meth;
2113 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2114 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2116 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2117 LDKOutPoint funding_txo_var = funding_txo;
2118 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2119 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2120 long funding_txo_ref;
2121 if (funding_txo_var.is_owned) {
2122 funding_txo_ref = (long)funding_txo_var.inner | 1;
2124 funding_txo_ref = (long)funding_txo_var.inner & ~1;
2126 LDKChannelMonitor monitor_var = monitor;
2127 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2128 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2130 if (monitor_var.is_owned) {
2131 monitor_ref = (long)monitor_var.inner | 1;
2133 monitor_ref = (long)monitor_var.inner & ~1;
2135 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2137 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2138 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2142 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2143 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2145 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2146 LDKOutPoint funding_txo_var = funding_txo;
2147 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2148 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2149 long funding_txo_ref;
2150 if (funding_txo_var.is_owned) {
2151 funding_txo_ref = (long)funding_txo_var.inner | 1;
2153 funding_txo_ref = (long)funding_txo_var.inner & ~1;
2155 LDKChannelMonitorUpdate update_var = update;
2156 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2157 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2159 if (update_var.is_owned) {
2160 update_ref = (long)update_var.inner | 1;
2162 update_ref = (long)update_var.inner & ~1;
2164 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2166 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2167 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2171 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2172 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2174 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2175 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2177 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->release_pending_monitor_events_meth);
2178 LDKCVec_MonitorEventZ ret_constr;
2179 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
2180 if (ret_constr.datalen > 0)
2181 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2183 ret_constr.data = NULL;
2184 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
2185 for (size_t o = 0; o < ret_constr.datalen; o++) {
2186 long arr_conv_14 = ret_vals[o];
2187 LDKMonitorEvent arr_conv_14_conv;
2188 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2189 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2190 // Warning: we may need a move here but can't clone!
2191 ret_constr.data[o] = arr_conv_14_conv;
2193 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
2196 static void LDKWatch_JCalls_free(void* this_arg) {
2197 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2198 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2200 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2201 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2205 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2206 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2207 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2208 return (void*) this_arg;
2210 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2211 jclass c = (*env)->GetObjectClass(env, o);
2213 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2214 atomic_init(&calls->refcnt, 1);
2215 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2216 calls->o = (*env)->NewWeakGlobalRef(env, o);
2217 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2218 CHECK(calls->watch_channel_meth != NULL);
2219 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2220 CHECK(calls->update_channel_meth != NULL);
2221 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2222 CHECK(calls->release_pending_monitor_events_meth != NULL);
2225 .this_arg = (void*) calls,
2226 .watch_channel = watch_channel_jcall,
2227 .update_channel = update_channel_jcall,
2228 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2229 .free = LDKWatch_JCalls_free,
2233 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2234 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2235 *res_ptr = LDKWatch_init(env, _a, o);
2236 return (long)res_ptr;
2238 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2239 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2243 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2244 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2245 LDKOutPoint funding_txo_conv;
2246 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2247 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2248 if (funding_txo_conv.inner != NULL)
2249 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2250 LDKChannelMonitor monitor_conv;
2251 monitor_conv.inner = (void*)(monitor & (~1));
2252 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2253 // Warning: we may need a move here but can't clone!
2254 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2255 *ret = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2259 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2260 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2261 LDKOutPoint funding_txo_conv;
2262 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2263 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2264 if (funding_txo_conv.inner != NULL)
2265 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2266 LDKChannelMonitorUpdate update_conv;
2267 update_conv.inner = (void*)(update & (~1));
2268 update_conv.is_owned = (update & 1) || (update == 0);
2269 if (update_conv.inner != NULL)
2270 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2271 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2272 *ret = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2276 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2277 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2278 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2279 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
2280 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
2281 for (size_t o = 0; o < ret_var.datalen; o++) {
2282 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2283 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2284 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2285 long arr_conv_14_ref;
2286 if (arr_conv_14_var.is_owned) {
2287 arr_conv_14_ref = (long)arr_conv_14_var.inner | 1;
2289 arr_conv_14_ref = (long)arr_conv_14_var.inner & ~1;
2291 ret_arr_ptr[o] = arr_conv_14_ref;
2293 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
2298 typedef struct LDKFilter_JCalls {
2299 atomic_size_t refcnt;
2302 jmethodID register_tx_meth;
2303 jmethodID register_output_meth;
2305 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2306 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2308 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2309 jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
2310 (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
2311 LDKu8slice script_pubkey_var = script_pubkey;
2312 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2313 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2314 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2316 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2318 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2319 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2321 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2322 LDKu8slice script_pubkey_var = script_pubkey;
2323 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2324 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2325 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2327 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, outpoint, script_pubkey_arr);
2329 static void LDKFilter_JCalls_free(void* this_arg) {
2330 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2331 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2333 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2334 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2338 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2339 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2340 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2341 return (void*) this_arg;
2343 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2344 jclass c = (*env)->GetObjectClass(env, o);
2346 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2347 atomic_init(&calls->refcnt, 1);
2348 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2349 calls->o = (*env)->NewWeakGlobalRef(env, o);
2350 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2351 CHECK(calls->register_tx_meth != NULL);
2352 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2353 CHECK(calls->register_output_meth != NULL);
2356 .this_arg = (void*) calls,
2357 .register_tx = register_tx_jcall,
2358 .register_output = register_output_jcall,
2359 .free = LDKFilter_JCalls_free,
2363 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2364 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2365 *res_ptr = LDKFilter_init(env, _a, o);
2366 return (long)res_ptr;
2368 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2369 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2374 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2375 unsigned char txid_arr[32];
2376 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2377 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2378 unsigned char (*txid_ref)[32] = &txid_arr;
2379 LDKu8slice script_pubkey_ref;
2380 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2381 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2382 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2383 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2387 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2388 LDKOutPoint outpoint_conv;
2389 outpoint_conv.inner = (void*)(outpoint & (~1));
2390 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2391 LDKu8slice script_pubkey_ref;
2392 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2393 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2394 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2395 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2398 typedef struct LDKBroadcasterInterface_JCalls {
2399 atomic_size_t refcnt;
2402 jmethodID broadcast_transaction_meth;
2403 } LDKBroadcasterInterface_JCalls;
2404 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2405 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2407 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2408 LDKTransaction *tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
2410 long tx_ref = (long)tx_copy;
2411 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2413 return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2415 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2416 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2417 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2419 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2420 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2424 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2425 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2426 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2427 return (void*) this_arg;
2429 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2430 jclass c = (*env)->GetObjectClass(env, o);
2432 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2433 atomic_init(&calls->refcnt, 1);
2434 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2435 calls->o = (*env)->NewWeakGlobalRef(env, o);
2436 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2437 CHECK(calls->broadcast_transaction_meth != NULL);
2439 LDKBroadcasterInterface ret = {
2440 .this_arg = (void*) calls,
2441 .broadcast_transaction = broadcast_transaction_jcall,
2442 .free = LDKBroadcasterInterface_JCalls_free,
2446 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2447 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2448 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2449 return (long)res_ptr;
2451 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2452 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2457 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2458 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2459 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv);
2462 typedef struct LDKFeeEstimator_JCalls {
2463 atomic_size_t refcnt;
2466 jmethodID get_est_sat_per_1000_weight_meth;
2467 } LDKFeeEstimator_JCalls;
2468 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2469 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2471 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2472 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target);
2473 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2475 return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2477 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2478 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2479 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2481 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2482 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2486 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2487 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2488 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2489 return (void*) this_arg;
2491 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2492 jclass c = (*env)->GetObjectClass(env, o);
2494 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2495 atomic_init(&calls->refcnt, 1);
2496 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2497 calls->o = (*env)->NewWeakGlobalRef(env, o);
2498 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2499 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2501 LDKFeeEstimator ret = {
2502 .this_arg = (void*) calls,
2503 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2504 .free = LDKFeeEstimator_JCalls_free,
2508 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2509 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2510 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2511 return (long)res_ptr;
2513 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2514 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2518 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) {
2519 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2520 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2521 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2525 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2526 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2527 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2529 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2530 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2531 ret->datalen = (*env)->GetArrayLength(env, elems);
2532 if (ret->datalen == 0) {
2535 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2536 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2537 for (size_t i = 0; i < ret->datalen; i++) {
2538 jlong arr_elem = java_elems[i];
2539 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2540 FREE((void*)arr_elem);
2541 ret->data[i] = arr_elem_conv;
2543 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2547 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2548 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2549 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2551 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2552 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2553 ret->datalen = (*env)->GetArrayLength(env, elems);
2554 if (ret->datalen == 0) {
2557 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2558 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2559 for (size_t i = 0; i < ret->datalen; i++) {
2560 jlong arr_elem = java_elems[i];
2561 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2562 ret->data[i] = arr_elem_conv;
2564 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2568 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2569 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2570 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2572 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2573 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2574 ret->datalen = (*env)->GetArrayLength(env, elems);
2575 if (ret->datalen == 0) {
2578 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2579 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2580 for (size_t i = 0; i < ret->datalen; i++) {
2581 jlong arr_elem = java_elems[i];
2582 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2583 FREE((void*)arr_elem);
2584 ret->data[i] = arr_elem_conv;
2586 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2590 typedef struct LDKKeysInterface_JCalls {
2591 atomic_size_t refcnt;
2594 jmethodID get_node_secret_meth;
2595 jmethodID get_destination_script_meth;
2596 jmethodID get_shutdown_pubkey_meth;
2597 jmethodID get_channel_keys_meth;
2598 jmethodID get_secure_random_bytes_meth;
2599 } LDKKeysInterface_JCalls;
2600 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2601 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2603 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2604 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2606 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth);
2607 LDKSecretKey ret_ref;
2608 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
2609 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.bytes);
2612 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2613 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2615 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2616 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2618 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_destination_script_meth);
2619 LDKCVec_u8Z ret_ref;
2620 ret_ref.data = (*_env)->GetByteArrayElements (_env, ret, NULL);
2621 ret_ref.datalen = (*_env)->GetArrayLength (_env, ret);
2624 LDKPublicKey get_shutdown_pubkey_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_shutdown_pubkey_meth);
2631 LDKPublicKey ret_ref;
2632 CHECK((*_env)->GetArrayLength (_env, ret) == 33);
2633 (*_env)->GetByteArrayRegion (_env, ret, 0, 33, ret_ref.compressed_form);
2636 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
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 LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2643 LDKChannelKeys res = *ret;
2647 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2648 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2650 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2651 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2653 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth);
2654 LDKThirtyTwoBytes ret_ref;
2655 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
2656 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.data);
2659 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2660 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2661 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2663 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2664 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2668 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2669 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2670 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2671 return (void*) this_arg;
2673 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2674 jclass c = (*env)->GetObjectClass(env, o);
2676 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2677 atomic_init(&calls->refcnt, 1);
2678 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2679 calls->o = (*env)->NewWeakGlobalRef(env, o);
2680 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2681 CHECK(calls->get_node_secret_meth != NULL);
2682 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2683 CHECK(calls->get_destination_script_meth != NULL);
2684 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2685 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2686 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2687 CHECK(calls->get_channel_keys_meth != NULL);
2688 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2689 CHECK(calls->get_secure_random_bytes_meth != NULL);
2691 LDKKeysInterface ret = {
2692 .this_arg = (void*) calls,
2693 .get_node_secret = get_node_secret_jcall,
2694 .get_destination_script = get_destination_script_jcall,
2695 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2696 .get_channel_keys = get_channel_keys_jcall,
2697 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2698 .free = LDKKeysInterface_JCalls_free,
2702 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2703 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2704 *res_ptr = LDKKeysInterface_init(env, _a, o);
2705 return (long)res_ptr;
2707 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2708 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2712 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2713 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2714 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2715 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2719 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2720 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2721 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2722 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2723 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2724 CVec_u8Z_free(arg_var);
2728 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2729 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2730 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2731 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2735 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) {
2736 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2737 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2738 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2742 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2743 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2744 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2745 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2749 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2750 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2751 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2752 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2753 for (size_t i = 0; i < vec->datalen; i++) {
2754 CHECK((((long)vec->data[i].inner) & 1) == 0);
2755 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2757 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2760 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2761 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2762 ret->datalen = (*env)->GetArrayLength(env, elems);
2763 if (ret->datalen == 0) {
2766 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2767 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2768 for (size_t i = 0; i < ret->datalen; i++) {
2769 jlong arr_elem = java_elems[i];
2770 LDKChannelDetails arr_elem_conv;
2771 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2772 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2773 if (arr_elem_conv.inner != NULL)
2774 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2775 ret->data[i] = arr_elem_conv;
2777 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2781 static jclass LDKNetAddress_IPv4_class = NULL;
2782 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2783 static jclass LDKNetAddress_IPv6_class = NULL;
2784 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2785 static jclass LDKNetAddress_OnionV2_class = NULL;
2786 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2787 static jclass LDKNetAddress_OnionV3_class = NULL;
2788 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2790 LDKNetAddress_IPv4_class =
2791 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2792 CHECK(LDKNetAddress_IPv4_class != NULL);
2793 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2794 CHECK(LDKNetAddress_IPv4_meth != NULL);
2795 LDKNetAddress_IPv6_class =
2796 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2797 CHECK(LDKNetAddress_IPv6_class != NULL);
2798 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2799 CHECK(LDKNetAddress_IPv6_meth != NULL);
2800 LDKNetAddress_OnionV2_class =
2801 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2802 CHECK(LDKNetAddress_OnionV2_class != NULL);
2803 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2804 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2805 LDKNetAddress_OnionV3_class =
2806 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2807 CHECK(LDKNetAddress_OnionV3_class != NULL);
2808 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2809 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2811 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
2812 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2814 case LDKNetAddress_IPv4: {
2815 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 4);
2816 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 4, obj->i_pv4.addr.data);
2817 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
2819 case LDKNetAddress_IPv6: {
2820 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 16);
2821 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 16, obj->i_pv6.addr.data);
2822 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
2824 case LDKNetAddress_OnionV2: {
2825 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 10);
2826 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 10, obj->onion_v2.addr.data);
2827 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
2829 case LDKNetAddress_OnionV3: {
2830 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
2831 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2832 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);
2837 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2838 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2839 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2841 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2842 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2843 ret->datalen = (*env)->GetArrayLength(env, elems);
2844 if (ret->datalen == 0) {
2847 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2848 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2849 for (size_t i = 0; i < ret->datalen; i++) {
2850 jlong arr_elem = java_elems[i];
2851 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2852 FREE((void*)arr_elem);
2853 ret->data[i] = arr_elem_conv;
2855 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2859 typedef struct LDKChannelMessageHandler_JCalls {
2860 atomic_size_t refcnt;
2863 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2864 jmethodID handle_open_channel_meth;
2865 jmethodID handle_accept_channel_meth;
2866 jmethodID handle_funding_created_meth;
2867 jmethodID handle_funding_signed_meth;
2868 jmethodID handle_funding_locked_meth;
2869 jmethodID handle_shutdown_meth;
2870 jmethodID handle_closing_signed_meth;
2871 jmethodID handle_update_add_htlc_meth;
2872 jmethodID handle_update_fulfill_htlc_meth;
2873 jmethodID handle_update_fail_htlc_meth;
2874 jmethodID handle_update_fail_malformed_htlc_meth;
2875 jmethodID handle_commitment_signed_meth;
2876 jmethodID handle_revoke_and_ack_meth;
2877 jmethodID handle_update_fee_meth;
2878 jmethodID handle_announcement_signatures_meth;
2879 jmethodID peer_disconnected_meth;
2880 jmethodID peer_connected_meth;
2881 jmethodID handle_channel_reestablish_meth;
2882 jmethodID handle_error_meth;
2883 } LDKChannelMessageHandler_JCalls;
2884 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
2885 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2887 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2888 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2889 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2890 LDKInitFeatures their_features_var = their_features;
2891 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2892 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2893 long their_features_ref;
2894 if (their_features_var.is_owned) {
2895 their_features_ref = (long)their_features_var.inner | 1;
2897 their_features_ref = (long)their_features_var.inner & ~1;
2899 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2901 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg);
2903 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
2904 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2906 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2907 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2908 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2909 LDKInitFeatures their_features_var = their_features;
2910 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2911 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2912 long their_features_ref;
2913 if (their_features_var.is_owned) {
2914 their_features_ref = (long)their_features_var.inner | 1;
2916 their_features_ref = (long)their_features_var.inner & ~1;
2918 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2920 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg);
2922 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
2923 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2925 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2926 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2927 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2928 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2930 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg);
2932 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
2933 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2935 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2936 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2937 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2938 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2940 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg);
2942 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
2943 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2945 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2946 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2947 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2948 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2950 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg);
2952 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
2953 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2955 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2956 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2957 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2958 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2960 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg);
2962 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
2963 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2965 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2966 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2967 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2968 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2970 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg);
2972 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
2973 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2975 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2976 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2977 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2978 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2980 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg);
2982 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
2983 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2985 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2986 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2987 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2988 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2990 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg);
2992 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
2993 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2995 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2996 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2997 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2998 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3000 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg);
3002 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
3003 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3005 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3006 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3007 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3008 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3010 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg);
3012 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
3013 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3015 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3016 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3017 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3018 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3020 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg);
3022 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
3023 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3025 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3026 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3027 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3028 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3030 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg);
3032 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
3033 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3035 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3036 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3037 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3038 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3040 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg);
3042 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
3043 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3045 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3046 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3047 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3048 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3050 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg);
3052 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3053 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3055 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3056 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3057 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3058 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3060 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
3062 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
3063 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3065 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3066 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3067 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3068 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3070 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg);
3072 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3073 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3075 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3076 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3077 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3078 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3080 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg);
3082 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
3083 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3085 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3086 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3087 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3088 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3090 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, msg);
3092 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3093 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3094 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3096 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3097 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3101 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3102 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3103 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3104 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3105 return (void*) this_arg;
3107 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3108 jclass c = (*env)->GetObjectClass(env, o);
3110 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3111 atomic_init(&calls->refcnt, 1);
3112 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3113 calls->o = (*env)->NewWeakGlobalRef(env, o);
3114 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3115 CHECK(calls->handle_open_channel_meth != NULL);
3116 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3117 CHECK(calls->handle_accept_channel_meth != NULL);
3118 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3119 CHECK(calls->handle_funding_created_meth != NULL);
3120 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3121 CHECK(calls->handle_funding_signed_meth != NULL);
3122 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3123 CHECK(calls->handle_funding_locked_meth != NULL);
3124 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3125 CHECK(calls->handle_shutdown_meth != NULL);
3126 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3127 CHECK(calls->handle_closing_signed_meth != NULL);
3128 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3129 CHECK(calls->handle_update_add_htlc_meth != NULL);
3130 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3131 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3132 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3133 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3134 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3135 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3136 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3137 CHECK(calls->handle_commitment_signed_meth != NULL);
3138 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3139 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3140 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3141 CHECK(calls->handle_update_fee_meth != NULL);
3142 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3143 CHECK(calls->handle_announcement_signatures_meth != NULL);
3144 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3145 CHECK(calls->peer_disconnected_meth != NULL);
3146 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3147 CHECK(calls->peer_connected_meth != NULL);
3148 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3149 CHECK(calls->handle_channel_reestablish_meth != NULL);
3150 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3151 CHECK(calls->handle_error_meth != NULL);
3153 LDKChannelMessageHandler ret = {
3154 .this_arg = (void*) calls,
3155 .handle_open_channel = handle_open_channel_jcall,
3156 .handle_accept_channel = handle_accept_channel_jcall,
3157 .handle_funding_created = handle_funding_created_jcall,
3158 .handle_funding_signed = handle_funding_signed_jcall,
3159 .handle_funding_locked = handle_funding_locked_jcall,
3160 .handle_shutdown = handle_shutdown_jcall,
3161 .handle_closing_signed = handle_closing_signed_jcall,
3162 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3163 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3164 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3165 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3166 .handle_commitment_signed = handle_commitment_signed_jcall,
3167 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3168 .handle_update_fee = handle_update_fee_jcall,
3169 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3170 .peer_disconnected = peer_disconnected_jcall,
3171 .peer_connected = peer_connected_jcall,
3172 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3173 .handle_error = handle_error_jcall,
3174 .free = LDKChannelMessageHandler_JCalls_free,
3175 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3177 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3180 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3181 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3182 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3183 return (long)res_ptr;
3185 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3186 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3190 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) {
3191 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3192 LDKPublicKey their_node_id_ref;
3193 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3194 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3195 LDKInitFeatures their_features_conv;
3196 their_features_conv.inner = (void*)(their_features & (~1));
3197 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3198 // Warning: we may need a move here but can't clone!
3199 LDKOpenChannel msg_conv;
3200 msg_conv.inner = (void*)(msg & (~1));
3201 msg_conv.is_owned = (msg & 1) || (msg == 0);
3202 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3205 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) {
3206 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3207 LDKPublicKey their_node_id_ref;
3208 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3209 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3210 LDKInitFeatures their_features_conv;
3211 their_features_conv.inner = (void*)(their_features & (~1));
3212 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3213 // Warning: we may need a move here but can't clone!
3214 LDKAcceptChannel msg_conv;
3215 msg_conv.inner = (void*)(msg & (~1));
3216 msg_conv.is_owned = (msg & 1) || (msg == 0);
3217 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3220 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) {
3221 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3222 LDKPublicKey their_node_id_ref;
3223 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3224 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3225 LDKFundingCreated msg_conv;
3226 msg_conv.inner = (void*)(msg & (~1));
3227 msg_conv.is_owned = (msg & 1) || (msg == 0);
3228 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3231 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) {
3232 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3233 LDKPublicKey their_node_id_ref;
3234 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3235 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3236 LDKFundingSigned msg_conv;
3237 msg_conv.inner = (void*)(msg & (~1));
3238 msg_conv.is_owned = (msg & 1) || (msg == 0);
3239 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3242 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) {
3243 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3244 LDKPublicKey their_node_id_ref;
3245 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3246 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3247 LDKFundingLocked msg_conv;
3248 msg_conv.inner = (void*)(msg & (~1));
3249 msg_conv.is_owned = (msg & 1) || (msg == 0);
3250 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3254 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3255 LDKPublicKey their_node_id_ref;
3256 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3257 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3258 LDKShutdown msg_conv;
3259 msg_conv.inner = (void*)(msg & (~1));
3260 msg_conv.is_owned = (msg & 1) || (msg == 0);
3261 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3264 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) {
3265 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3266 LDKPublicKey their_node_id_ref;
3267 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3268 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3269 LDKClosingSigned msg_conv;
3270 msg_conv.inner = (void*)(msg & (~1));
3271 msg_conv.is_owned = (msg & 1) || (msg == 0);
3272 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3275 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) {
3276 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3277 LDKPublicKey their_node_id_ref;
3278 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3279 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3280 LDKUpdateAddHTLC msg_conv;
3281 msg_conv.inner = (void*)(msg & (~1));
3282 msg_conv.is_owned = (msg & 1) || (msg == 0);
3283 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3286 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) {
3287 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3288 LDKPublicKey their_node_id_ref;
3289 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3290 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3291 LDKUpdateFulfillHTLC msg_conv;
3292 msg_conv.inner = (void*)(msg & (~1));
3293 msg_conv.is_owned = (msg & 1) || (msg == 0);
3294 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3297 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) {
3298 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3299 LDKPublicKey their_node_id_ref;
3300 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3301 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3302 LDKUpdateFailHTLC msg_conv;
3303 msg_conv.inner = (void*)(msg & (~1));
3304 msg_conv.is_owned = (msg & 1) || (msg == 0);
3305 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3308 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) {
3309 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3310 LDKPublicKey their_node_id_ref;
3311 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3312 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3313 LDKUpdateFailMalformedHTLC msg_conv;
3314 msg_conv.inner = (void*)(msg & (~1));
3315 msg_conv.is_owned = (msg & 1) || (msg == 0);
3316 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3319 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) {
3320 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3321 LDKPublicKey their_node_id_ref;
3322 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3323 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3324 LDKCommitmentSigned msg_conv;
3325 msg_conv.inner = (void*)(msg & (~1));
3326 msg_conv.is_owned = (msg & 1) || (msg == 0);
3327 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3330 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) {
3331 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3332 LDKPublicKey their_node_id_ref;
3333 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3334 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3335 LDKRevokeAndACK msg_conv;
3336 msg_conv.inner = (void*)(msg & (~1));
3337 msg_conv.is_owned = (msg & 1) || (msg == 0);
3338 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3341 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) {
3342 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3343 LDKPublicKey their_node_id_ref;
3344 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3345 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3346 LDKUpdateFee msg_conv;
3347 msg_conv.inner = (void*)(msg & (~1));
3348 msg_conv.is_owned = (msg & 1) || (msg == 0);
3349 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3352 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) {
3353 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3354 LDKPublicKey their_node_id_ref;
3355 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3356 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3357 LDKAnnouncementSignatures msg_conv;
3358 msg_conv.inner = (void*)(msg & (~1));
3359 msg_conv.is_owned = (msg & 1) || (msg == 0);
3360 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3363 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) {
3364 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3365 LDKPublicKey their_node_id_ref;
3366 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3367 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3368 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3372 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3373 LDKPublicKey their_node_id_ref;
3374 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3375 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3377 msg_conv.inner = (void*)(msg & (~1));
3378 msg_conv.is_owned = (msg & 1) || (msg == 0);
3379 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3382 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) {
3383 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3384 LDKPublicKey their_node_id_ref;
3385 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3386 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3387 LDKChannelReestablish msg_conv;
3388 msg_conv.inner = (void*)(msg & (~1));
3389 msg_conv.is_owned = (msg & 1) || (msg == 0);
3390 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3394 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3395 LDKPublicKey their_node_id_ref;
3396 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3397 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3398 LDKErrorMessage msg_conv;
3399 msg_conv.inner = (void*)(msg & (~1));
3400 msg_conv.is_owned = (msg & 1) || (msg == 0);
3401 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3404 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3405 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3406 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3407 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3408 for (size_t i = 0; i < vec->datalen; i++) {
3409 CHECK((((long)vec->data[i].inner) & 1) == 0);
3410 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3412 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3415 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3416 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3417 ret->datalen = (*env)->GetArrayLength(env, elems);
3418 if (ret->datalen == 0) {
3421 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3422 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3423 for (size_t i = 0; i < ret->datalen; i++) {
3424 jlong arr_elem = java_elems[i];
3425 LDKChannelMonitor arr_elem_conv;
3426 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3427 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3428 // Warning: we may need a move here but can't clone!
3429 ret->data[i] = arr_elem_conv;
3431 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3435 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3436 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3437 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3439 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3440 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3441 ret->datalen = (*env)->GetArrayLength(env, elems);
3442 if (ret->datalen == 0) {
3445 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3446 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3447 for (size_t i = 0; i < ret->datalen; i++) {
3448 ret->data[i] = java_elems[i];
3450 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3454 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3455 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3456 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3457 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3458 for (size_t i = 0; i < vec->datalen; i++) {
3459 CHECK((((long)vec->data[i].inner) & 1) == 0);
3460 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3462 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3465 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3466 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3467 ret->datalen = (*env)->GetArrayLength(env, elems);
3468 if (ret->datalen == 0) {
3471 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3472 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3473 for (size_t i = 0; i < ret->datalen; i++) {
3474 jlong arr_elem = java_elems[i];
3475 LDKUpdateAddHTLC arr_elem_conv;
3476 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3477 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3478 if (arr_elem_conv.inner != NULL)
3479 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3480 ret->data[i] = arr_elem_conv;
3482 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3486 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3487 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3488 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3489 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3490 for (size_t i = 0; i < vec->datalen; i++) {
3491 CHECK((((long)vec->data[i].inner) & 1) == 0);
3492 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3494 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3497 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3498 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3499 ret->datalen = (*env)->GetArrayLength(env, elems);
3500 if (ret->datalen == 0) {
3503 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3504 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3505 for (size_t i = 0; i < ret->datalen; i++) {
3506 jlong arr_elem = java_elems[i];
3507 LDKUpdateFulfillHTLC arr_elem_conv;
3508 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3509 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3510 if (arr_elem_conv.inner != NULL)
3511 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3512 ret->data[i] = arr_elem_conv;
3514 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3518 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3519 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3520 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3521 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3522 for (size_t i = 0; i < vec->datalen; i++) {
3523 CHECK((((long)vec->data[i].inner) & 1) == 0);
3524 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3526 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3529 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3530 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3531 ret->datalen = (*env)->GetArrayLength(env, elems);
3532 if (ret->datalen == 0) {
3535 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3536 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3537 for (size_t i = 0; i < ret->datalen; i++) {
3538 jlong arr_elem = java_elems[i];
3539 LDKUpdateFailHTLC arr_elem_conv;
3540 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3541 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3542 if (arr_elem_conv.inner != NULL)
3543 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3544 ret->data[i] = arr_elem_conv;
3546 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3550 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3551 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3552 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3553 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3554 for (size_t i = 0; i < vec->datalen; i++) {
3555 CHECK((((long)vec->data[i].inner) & 1) == 0);
3556 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3558 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3561 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3562 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3563 ret->datalen = (*env)->GetArrayLength(env, elems);
3564 if (ret->datalen == 0) {
3567 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3568 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3569 for (size_t i = 0; i < ret->datalen; i++) {
3570 jlong arr_elem = java_elems[i];
3571 LDKUpdateFailMalformedHTLC arr_elem_conv;
3572 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3573 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3574 if (arr_elem_conv.inner != NULL)
3575 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3576 ret->data[i] = arr_elem_conv;
3578 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3582 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3583 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3585 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3586 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3587 CHECK(val->result_ok);
3588 return *val->contents.result;
3590 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3591 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3592 CHECK(!val->result_ok);
3593 LDKLightningError err_var = (*val->contents.err);
3594 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3595 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3596 long err_ref = (long)err_var.inner & ~1;
3599 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3600 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3601 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3603 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3604 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3605 ret->datalen = (*env)->GetArrayLength(env, elems);
3606 if (ret->datalen == 0) {
3609 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3610 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3611 for (size_t i = 0; i < ret->datalen; i++) {
3612 jlong arr_elem = java_elems[i];
3613 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3614 FREE((void*)arr_elem);
3615 ret->data[i] = arr_elem_conv;
3617 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3621 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3622 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3623 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3624 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3625 for (size_t i = 0; i < vec->datalen; i++) {
3626 CHECK((((long)vec->data[i].inner) & 1) == 0);
3627 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3629 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3632 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3633 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3634 ret->datalen = (*env)->GetArrayLength(env, elems);
3635 if (ret->datalen == 0) {
3638 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3639 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3640 for (size_t i = 0; i < ret->datalen; i++) {
3641 jlong arr_elem = java_elems[i];
3642 LDKNodeAnnouncement arr_elem_conv;
3643 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3644 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3645 if (arr_elem_conv.inner != NULL)
3646 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3647 ret->data[i] = arr_elem_conv;
3649 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3653 typedef struct LDKRoutingMessageHandler_JCalls {
3654 atomic_size_t refcnt;
3657 jmethodID handle_node_announcement_meth;
3658 jmethodID handle_channel_announcement_meth;
3659 jmethodID handle_channel_update_meth;
3660 jmethodID handle_htlc_fail_channel_update_meth;
3661 jmethodID get_next_channel_announcements_meth;
3662 jmethodID get_next_node_announcements_meth;
3663 jmethodID should_request_full_sync_meth;
3664 } LDKRoutingMessageHandler_JCalls;
3665 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3666 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3668 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3669 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3671 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, msg);
3672 LDKCResult_boolLightningErrorZ res = *ret;
3676 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3677 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3679 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3680 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3682 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, msg);
3683 LDKCResult_boolLightningErrorZ res = *ret;
3687 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3688 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3690 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3691 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3693 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, msg);
3694 LDKCResult_boolLightningErrorZ res = *ret;
3698 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3699 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3701 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3702 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3704 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, update);
3706 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3707 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3709 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3710 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3712 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3713 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
3714 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
3715 if (ret_constr.datalen > 0)
3716 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
3718 ret_constr.data = NULL;
3719 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
3720 for (size_t l = 0; l < ret_constr.datalen; l++) {
3721 long arr_conv_63 = ret_vals[l];
3722 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
3723 FREE((void*)arr_conv_63);
3724 ret_constr.data[l] = arr_conv_63_conv;
3726 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
3729 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3730 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3732 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3733 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
3734 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
3735 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3737 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3738 LDKCVec_NodeAnnouncementZ ret_constr;
3739 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
3740 if (ret_constr.datalen > 0)
3741 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
3743 ret_constr.data = NULL;
3744 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
3745 for (size_t s = 0; s < ret_constr.datalen; s++) {
3746 long arr_conv_18 = ret_vals[s];
3747 LDKNodeAnnouncement arr_conv_18_conv;
3748 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
3749 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
3750 if (arr_conv_18_conv.inner != NULL)
3751 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
3752 ret_constr.data[s] = arr_conv_18_conv;
3754 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
3757 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3758 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3760 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3761 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
3762 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form);
3763 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3765 return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3767 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3768 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3769 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3771 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3772 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3776 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3777 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3778 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3779 return (void*) this_arg;
3781 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3782 jclass c = (*env)->GetObjectClass(env, o);
3784 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3785 atomic_init(&calls->refcnt, 1);
3786 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3787 calls->o = (*env)->NewWeakGlobalRef(env, o);
3788 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3789 CHECK(calls->handle_node_announcement_meth != NULL);
3790 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3791 CHECK(calls->handle_channel_announcement_meth != NULL);
3792 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3793 CHECK(calls->handle_channel_update_meth != NULL);
3794 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3795 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
3796 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
3797 CHECK(calls->get_next_channel_announcements_meth != NULL);
3798 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
3799 CHECK(calls->get_next_node_announcements_meth != NULL);
3800 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3801 CHECK(calls->should_request_full_sync_meth != NULL);
3803 LDKRoutingMessageHandler ret = {
3804 .this_arg = (void*) calls,
3805 .handle_node_announcement = handle_node_announcement_jcall,
3806 .handle_channel_announcement = handle_channel_announcement_jcall,
3807 .handle_channel_update = handle_channel_update_jcall,
3808 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3809 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3810 .get_next_node_announcements = get_next_node_announcements_jcall,
3811 .should_request_full_sync = should_request_full_sync_jcall,
3812 .free = LDKRoutingMessageHandler_JCalls_free,
3816 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3817 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3818 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3819 return (long)res_ptr;
3821 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3822 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3826 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3827 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3828 LDKNodeAnnouncement msg_conv;
3829 msg_conv.inner = (void*)(msg & (~1));
3830 msg_conv.is_owned = (msg & 1) || (msg == 0);
3831 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3832 *ret = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
3836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3837 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3838 LDKChannelAnnouncement msg_conv;
3839 msg_conv.inner = (void*)(msg & (~1));
3840 msg_conv.is_owned = (msg & 1) || (msg == 0);
3841 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3842 *ret = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3846 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3847 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3848 LDKChannelUpdate msg_conv;
3849 msg_conv.inner = (void*)(msg & (~1));
3850 msg_conv.is_owned = (msg & 1) || (msg == 0);
3851 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3852 *ret = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
3856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
3857 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3858 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3859 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
3862 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) {
3863 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3864 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
3865 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
3866 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
3867 for (size_t l = 0; l < ret_var.datalen; l++) {
3868 /*XXX False */long arr_conv_63_ref = (long)&ret_var.data[l];
3869 ret_arr_ptr[l] = arr_conv_63_ref;
3871 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
3872 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(ret_var);
3876 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) {
3877 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3878 LDKPublicKey starting_point_ref;
3879 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
3880 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
3881 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
3882 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
3883 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
3884 for (size_t s = 0; s < ret_var.datalen; s++) {
3885 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
3886 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3887 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3888 long arr_conv_18_ref;
3889 if (arr_conv_18_var.is_owned) {
3890 arr_conv_18_ref = (long)arr_conv_18_var.inner | 1;
3892 arr_conv_18_ref = (long)arr_conv_18_var.inner & ~1;
3894 ret_arr_ptr[s] = arr_conv_18_ref;
3896 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
3901 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
3902 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3903 LDKPublicKey node_id_ref;
3904 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
3905 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
3906 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
3910 typedef struct LDKSocketDescriptor_JCalls {
3911 atomic_size_t refcnt;
3914 jmethodID send_data_meth;
3915 jmethodID disconnect_socket_meth;
3917 jmethodID hash_meth;
3918 } LDKSocketDescriptor_JCalls;
3919 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
3920 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3922 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3923 LDKu8slice data_var = data;
3924 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
3925 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
3926 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3928 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
3930 void disconnect_socket_jcall(void* this_arg) {
3931 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3933 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3934 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3936 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
3938 bool eq_jcall(const void* this_arg, const void *other_arg) {
3939 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3941 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3942 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3944 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, other_arg);
3946 uint64_t hash_jcall(const void* this_arg) {
3947 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3949 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3950 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3952 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
3954 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
3955 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3956 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3958 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3959 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3963 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
3964 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3965 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3966 return (void*) this_arg;
3968 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
3969 jclass c = (*env)->GetObjectClass(env, o);
3971 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
3972 atomic_init(&calls->refcnt, 1);
3973 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3974 calls->o = (*env)->NewWeakGlobalRef(env, o);
3975 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
3976 CHECK(calls->send_data_meth != NULL);
3977 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
3978 CHECK(calls->disconnect_socket_meth != NULL);
3979 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
3980 CHECK(calls->eq_meth != NULL);
3981 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
3982 CHECK(calls->hash_meth != NULL);
3984 LDKSocketDescriptor ret = {
3985 .this_arg = (void*) calls,
3986 .send_data = send_data_jcall,
3987 .disconnect_socket = disconnect_socket_jcall,
3990 .clone = LDKSocketDescriptor_JCalls_clone,
3991 .free = LDKSocketDescriptor_JCalls_free,
3995 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
3996 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
3997 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
3998 return (long)res_ptr;
4000 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4001 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
4005 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
4006 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4007 LDKu8slice data_ref;
4008 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
4009 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
4010 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4011 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
4015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
4016 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4017 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4020 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
4021 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4022 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4026 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4027 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
4028 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
4030 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4031 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4033 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4034 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4035 CHECK(val->result_ok);
4036 LDKCVecTempl_u8 res_var = (*val->contents.result);
4037 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
4038 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
4041 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4042 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4043 CHECK(!val->result_ok);
4044 LDKPeerHandleError err_var = (*val->contents.err);
4045 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4046 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4047 long err_ref = (long)err_var.inner & ~1;
4050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4051 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4054 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4055 CHECK(val->result_ok);
4056 return *val->contents.result;
4058 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4059 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4060 CHECK(!val->result_ok);
4061 LDKPeerHandleError err_var = (*val->contents.err);
4062 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4063 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4064 long err_ref = (long)err_var.inner & ~1;
4067 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4068 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
4070 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4071 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4072 CHECK(val->result_ok);
4073 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
4074 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
4077 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4078 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4079 CHECK(!val->result_ok);
4080 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4084 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
4086 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4087 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4088 CHECK(val->result_ok);
4089 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
4090 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
4093 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4094 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4095 CHECK(!val->result_ok);
4096 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4100 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
4102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4103 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4104 CHECK(val->result_ok);
4105 LDKTxCreationKeys res_var = (*val->contents.result);
4106 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4107 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4108 long res_ref = (long)res_var.inner & ~1;
4111 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4112 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4113 CHECK(!val->result_ok);
4114 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4117 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4118 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4119 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4121 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4122 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4123 ret->datalen = (*env)->GetArrayLength(env, elems);
4124 if (ret->datalen == 0) {
4127 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4128 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4129 for (size_t i = 0; i < ret->datalen; i++) {
4130 jlong arr_elem = java_elems[i];
4131 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4132 FREE((void*)arr_elem);
4133 ret->data[i] = arr_elem_conv;
4135 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4139 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4140 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4141 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4142 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4143 for (size_t i = 0; i < vec->datalen; i++) {
4144 CHECK((((long)vec->data[i].inner) & 1) == 0);
4145 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4147 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4150 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4151 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4152 ret->datalen = (*env)->GetArrayLength(env, elems);
4153 if (ret->datalen == 0) {
4156 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4157 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4158 for (size_t i = 0; i < ret->datalen; i++) {
4159 jlong arr_elem = java_elems[i];
4160 LDKRouteHop arr_elem_conv;
4161 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4162 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4163 if (arr_elem_conv.inner != NULL)
4164 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4165 ret->data[i] = arr_elem_conv;
4167 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4171 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4172 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4173 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4176 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4178 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4179 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4180 CHECK(val->result_ok);
4181 LDKRoute res_var = (*val->contents.result);
4182 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4183 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4184 long res_ref = (long)res_var.inner & ~1;
4187 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4188 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4189 CHECK(!val->result_ok);
4190 LDKLightningError err_var = (*val->contents.err);
4191 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4192 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4193 long err_ref = (long)err_var.inner & ~1;
4196 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4197 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4198 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4199 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4200 for (size_t i = 0; i < vec->datalen; i++) {
4201 CHECK((((long)vec->data[i].inner) & 1) == 0);
4202 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4204 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4207 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4208 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4209 ret->datalen = (*env)->GetArrayLength(env, elems);
4210 if (ret->datalen == 0) {
4213 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4214 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4215 for (size_t i = 0; i < ret->datalen; i++) {
4216 jlong arr_elem = java_elems[i];
4217 LDKRouteHint arr_elem_conv;
4218 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4219 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4220 if (arr_elem_conv.inner != NULL)
4221 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4222 ret->data[i] = arr_elem_conv;
4224 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4229 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4231 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4235 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4237 C2Tuple_OutPointScriptZ_free(arg_conv);
4240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4241 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4243 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4247 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4249 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4253 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4255 C2Tuple_u64u64Z_free(arg_conv);
4258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4259 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4261 C2Tuple_usizeTransactionZ_free(arg_conv);
4264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4265 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4267 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4271 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4273 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4276 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4277 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4279 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4280 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4285 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4287 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4290 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray arg) {
4291 LDKCVec_SignatureZ arg_constr;
4292 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4293 if (arg_constr.datalen > 0)
4294 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4296 arg_constr.data = NULL;
4297 for (size_t i = 0; i < arg_constr.datalen; i++) {
4298 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4299 LDKSignature arr_conv_8_ref;
4300 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4301 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4302 arg_constr.data[i] = arr_conv_8_ref;
4304 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4305 *ret = CResult_CVec_SignatureZNoneZ_ok(arg_constr);
4309 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4310 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4312 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4313 *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4318 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4320 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4323 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4324 LDKCVec_u8Z arg_ref;
4325 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
4326 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4327 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4328 *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4329 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
4333 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4334 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4336 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4337 *ret = CResult_NoneAPIErrorZ_err(arg_conv);
4341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4342 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4344 CResult_NoneAPIErrorZ_free(arg_conv);
4347 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4348 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4350 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4351 *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4356 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4358 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4361 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4362 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4364 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4365 *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4370 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4372 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4375 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4376 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4378 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4379 *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
4383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4384 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4386 CResult_NonePaymentSendFailureZ_free(arg_conv);
4389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4390 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4392 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4393 *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
4397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4398 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4400 CResult_NonePeerHandleErrorZ_free(arg_conv);
4403 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4404 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4406 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4407 *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
4411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4412 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4414 CResult_PublicKeySecpErrorZ_free(arg_conv);
4417 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4418 LDKPublicKey arg_ref;
4419 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4420 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4421 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4422 *ret = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4426 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4427 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4429 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4430 *ret = CResult_RouteLightningErrorZ_err(arg_conv);
4434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4435 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4437 CResult_RouteLightningErrorZ_free(arg_conv);
4440 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4441 LDKRoute arg_conv = *(LDKRoute*)arg;
4443 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4444 *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
4448 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4449 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4451 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4452 *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
4456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4457 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4459 CResult_SecretKeySecpErrorZ_free(arg_conv);
4462 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4463 LDKSecretKey arg_ref;
4464 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4465 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4466 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4467 *ret = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4472 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4474 CResult_SignatureNoneZ_free(arg_conv);
4477 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4478 LDKSignature arg_ref;
4479 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4480 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4481 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4482 *ret = CResult_SignatureNoneZ_ok(arg_ref);
4486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4487 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4489 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4490 *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4495 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4497 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4500 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4501 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4503 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4504 *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4508 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4509 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4511 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4512 *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
4516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4517 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4519 CResult_TxOutAccessErrorZ_free(arg_conv);
4522 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4523 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4525 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4526 *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
4530 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4531 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4533 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4534 *ret = CResult_boolLightningErrorZ_err(arg_conv);
4538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4539 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4541 CResult_boolLightningErrorZ_free(arg_conv);
4544 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4545 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4546 *ret = CResult_boolLightningErrorZ_ok(arg);
4550 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4551 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4553 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4554 *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
4558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4559 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4561 CResult_boolPeerHandleErrorZ_free(arg_conv);
4564 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4565 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4566 *ret = CResult_boolPeerHandleErrorZ_ok(arg);
4570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4571 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_constr;
4572 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4573 if (arg_constr.datalen > 0)
4574 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
4576 arg_constr.data = NULL;
4577 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4578 for (size_t q = 0; q < arg_constr.datalen; q++) {
4579 long arr_conv_42 = arg_vals[q];
4580 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
4581 FREE((void*)arr_conv_42);
4582 arg_constr.data[q] = arr_conv_42_conv;
4584 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4585 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_constr);
4588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4589 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_constr;
4590 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4591 if (arg_constr.datalen > 0)
4592 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ Elements");
4594 arg_constr.data = NULL;
4595 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4596 for (size_t b = 0; b < arg_constr.datalen; b++) {
4597 long arr_conv_27 = arg_vals[b];
4598 LDKC2Tuple_TxidCVec_TxOutZZ arr_conv_27_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arr_conv_27;
4599 FREE((void*)arr_conv_27);
4600 arg_constr.data[b] = arr_conv_27_conv;
4602 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4603 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_constr);
4606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4607 LDKCVec_C2Tuple_usizeTransactionZZ arg_constr;
4608 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4609 if (arg_constr.datalen > 0)
4610 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
4612 arg_constr.data = NULL;
4613 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4614 for (size_t d = 0; d < arg_constr.datalen; d++) {
4615 long arr_conv_29 = arg_vals[d];
4616 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
4617 FREE((void*)arr_conv_29);
4618 arg_constr.data[d] = arr_conv_29_conv;
4620 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4621 CVec_C2Tuple_usizeTransactionZZ_free(arg_constr);
4624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4625 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4626 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4627 if (arg_constr.datalen > 0)
4628 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4630 arg_constr.data = NULL;
4631 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4632 for (size_t l = 0; l < arg_constr.datalen; l++) {
4633 long arr_conv_63 = arg_vals[l];
4634 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4635 FREE((void*)arr_conv_63);
4636 arg_constr.data[l] = arr_conv_63_conv;
4638 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4639 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_constr);
4642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4643 LDKCVec_CVec_RouteHopZZ arg_constr;
4644 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4645 if (arg_constr.datalen > 0)
4646 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
4648 arg_constr.data = NULL;
4649 for (size_t m = 0; m < arg_constr.datalen; m++) {
4650 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, arg, m);
4651 LDKCVec_RouteHopZ arr_conv_12_constr;
4652 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
4653 if (arr_conv_12_constr.datalen > 0)
4654 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4656 arr_conv_12_constr.data = NULL;
4657 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
4658 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
4659 long arr_conv_10 = arr_conv_12_vals[k];
4660 LDKRouteHop arr_conv_10_conv;
4661 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4662 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4663 arr_conv_12_constr.data[k] = arr_conv_10_conv;
4665 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
4666 arg_constr.data[m] = arr_conv_12_constr;
4668 CVec_CVec_RouteHopZZ_free(arg_constr);
4671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4672 LDKCVec_ChannelDetailsZ arg_constr;
4673 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4674 if (arg_constr.datalen > 0)
4675 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
4677 arg_constr.data = NULL;
4678 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4679 for (size_t q = 0; q < arg_constr.datalen; q++) {
4680 long arr_conv_16 = arg_vals[q];
4681 LDKChannelDetails arr_conv_16_conv;
4682 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4683 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4684 arg_constr.data[q] = arr_conv_16_conv;
4686 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4687 CVec_ChannelDetailsZ_free(arg_constr);
4690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4691 LDKCVec_ChannelMonitorZ arg_constr;
4692 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4693 if (arg_constr.datalen > 0)
4694 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
4696 arg_constr.data = NULL;
4697 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4698 for (size_t q = 0; q < arg_constr.datalen; q++) {
4699 long arr_conv_16 = arg_vals[q];
4700 LDKChannelMonitor arr_conv_16_conv;
4701 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4702 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4703 arg_constr.data[q] = arr_conv_16_conv;
4705 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4706 CVec_ChannelMonitorZ_free(arg_constr);
4709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4710 LDKCVec_EventZ arg_constr;
4711 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4712 if (arg_constr.datalen > 0)
4713 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4715 arg_constr.data = NULL;
4716 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4717 for (size_t h = 0; h < arg_constr.datalen; h++) {
4718 long arr_conv_7 = arg_vals[h];
4719 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
4720 FREE((void*)arr_conv_7);
4721 arg_constr.data[h] = arr_conv_7_conv;
4723 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4724 CVec_EventZ_free(arg_constr);
4727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4728 LDKCVec_HTLCOutputInCommitmentZ arg_constr;
4729 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4730 if (arg_constr.datalen > 0)
4731 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
4733 arg_constr.data = NULL;
4734 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4735 for (size_t y = 0; y < arg_constr.datalen; y++) {
4736 long arr_conv_24 = arg_vals[y];
4737 LDKHTLCOutputInCommitment arr_conv_24_conv;
4738 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
4739 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
4740 arg_constr.data[y] = arr_conv_24_conv;
4742 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4743 CVec_HTLCOutputInCommitmentZ_free(arg_constr);
4746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4747 LDKCVec_MessageSendEventZ arg_constr;
4748 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4749 if (arg_constr.datalen > 0)
4750 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4752 arg_constr.data = NULL;
4753 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4754 for (size_t s = 0; s < arg_constr.datalen; s++) {
4755 long arr_conv_18 = arg_vals[s];
4756 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
4757 FREE((void*)arr_conv_18);
4758 arg_constr.data[s] = arr_conv_18_conv;
4760 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4761 CVec_MessageSendEventZ_free(arg_constr);
4764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4765 LDKCVec_MonitorEventZ arg_constr;
4766 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4767 if (arg_constr.datalen > 0)
4768 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
4770 arg_constr.data = NULL;
4771 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4772 for (size_t o = 0; o < arg_constr.datalen; o++) {
4773 long arr_conv_14 = arg_vals[o];
4774 LDKMonitorEvent arr_conv_14_conv;
4775 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
4776 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
4777 arg_constr.data[o] = arr_conv_14_conv;
4779 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4780 CVec_MonitorEventZ_free(arg_constr);
4783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4784 LDKCVec_NetAddressZ arg_constr;
4785 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4786 if (arg_constr.datalen > 0)
4787 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
4789 arg_constr.data = NULL;
4790 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4791 for (size_t m = 0; m < arg_constr.datalen; m++) {
4792 long arr_conv_12 = arg_vals[m];
4793 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
4794 FREE((void*)arr_conv_12);
4795 arg_constr.data[m] = arr_conv_12_conv;
4797 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4798 CVec_NetAddressZ_free(arg_constr);
4801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4802 LDKCVec_NodeAnnouncementZ arg_constr;
4803 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4804 if (arg_constr.datalen > 0)
4805 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4807 arg_constr.data = NULL;
4808 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4809 for (size_t s = 0; s < arg_constr.datalen; s++) {
4810 long arr_conv_18 = arg_vals[s];
4811 LDKNodeAnnouncement arr_conv_18_conv;
4812 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4813 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4814 arg_constr.data[s] = arr_conv_18_conv;
4816 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4817 CVec_NodeAnnouncementZ_free(arg_constr);
4820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4821 LDKCVec_PublicKeyZ arg_constr;
4822 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4823 if (arg_constr.datalen > 0)
4824 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
4826 arg_constr.data = NULL;
4827 for (size_t i = 0; i < arg_constr.datalen; i++) {
4828 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4829 LDKPublicKey arr_conv_8_ref;
4830 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
4831 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
4832 arg_constr.data[i] = arr_conv_8_ref;
4834 CVec_PublicKeyZ_free(arg_constr);
4837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4838 LDKCVec_RouteHintZ arg_constr;
4839 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4840 if (arg_constr.datalen > 0)
4841 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
4843 arg_constr.data = NULL;
4844 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4845 for (size_t l = 0; l < arg_constr.datalen; l++) {
4846 long arr_conv_11 = arg_vals[l];
4847 LDKRouteHint arr_conv_11_conv;
4848 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
4849 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
4850 arg_constr.data[l] = arr_conv_11_conv;
4852 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4853 CVec_RouteHintZ_free(arg_constr);
4856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4857 LDKCVec_RouteHopZ arg_constr;
4858 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4859 if (arg_constr.datalen > 0)
4860 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4862 arg_constr.data = NULL;
4863 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4864 for (size_t k = 0; k < arg_constr.datalen; k++) {
4865 long arr_conv_10 = arg_vals[k];
4866 LDKRouteHop arr_conv_10_conv;
4867 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4868 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4869 arg_constr.data[k] = arr_conv_10_conv;
4871 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4872 CVec_RouteHopZ_free(arg_constr);
4875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4876 LDKCVec_SignatureZ arg_constr;
4877 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4878 if (arg_constr.datalen > 0)
4879 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4881 arg_constr.data = NULL;
4882 for (size_t i = 0; i < arg_constr.datalen; i++) {
4883 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4884 LDKSignature arr_conv_8_ref;
4885 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4886 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4887 arg_constr.data[i] = arr_conv_8_ref;
4889 CVec_SignatureZ_free(arg_constr);
4892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4893 LDKCVec_SpendableOutputDescriptorZ arg_constr;
4894 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4895 if (arg_constr.datalen > 0)
4896 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
4898 arg_constr.data = NULL;
4899 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4900 for (size_t b = 0; b < arg_constr.datalen; b++) {
4901 long arr_conv_27 = arg_vals[b];
4902 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
4903 FREE((void*)arr_conv_27);
4904 arg_constr.data[b] = arr_conv_27_conv;
4906 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4907 CVec_SpendableOutputDescriptorZ_free(arg_constr);
4910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4911 LDKCVec_TransactionZ arg_constr;
4912 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4913 if (arg_constr.datalen > 0)
4914 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
4916 arg_constr.data = NULL;
4917 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4918 for (size_t n = 0; n < arg_constr.datalen; n++) {
4919 long arr_conv_13 = arg_vals[n];
4920 LDKTransaction arr_conv_13_conv = *(LDKTransaction*)arr_conv_13;
4921 arg_constr.data[n] = arr_conv_13_conv;
4923 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4924 CVec_TransactionZ_free(arg_constr);
4927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4928 LDKCVec_TxOutZ arg_constr;
4929 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4930 if (arg_constr.datalen > 0)
4931 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
4933 arg_constr.data = NULL;
4934 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4935 for (size_t h = 0; h < arg_constr.datalen; h++) {
4936 long arr_conv_7 = arg_vals[h];
4937 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
4938 FREE((void*)arr_conv_7);
4939 arg_constr.data[h] = arr_conv_7_conv;
4941 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4942 CVec_TxOutZ_free(arg_constr);
4945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4946 LDKCVec_UpdateAddHTLCZ arg_constr;
4947 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4948 if (arg_constr.datalen > 0)
4949 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
4951 arg_constr.data = NULL;
4952 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4953 for (size_t p = 0; p < arg_constr.datalen; p++) {
4954 long arr_conv_15 = arg_vals[p];
4955 LDKUpdateAddHTLC arr_conv_15_conv;
4956 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
4957 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
4958 arg_constr.data[p] = arr_conv_15_conv;
4960 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4961 CVec_UpdateAddHTLCZ_free(arg_constr);
4964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4965 LDKCVec_UpdateFailHTLCZ arg_constr;
4966 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4967 if (arg_constr.datalen > 0)
4968 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
4970 arg_constr.data = NULL;
4971 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4972 for (size_t q = 0; q < arg_constr.datalen; q++) {
4973 long arr_conv_16 = arg_vals[q];
4974 LDKUpdateFailHTLC arr_conv_16_conv;
4975 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4976 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4977 arg_constr.data[q] = arr_conv_16_conv;
4979 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4980 CVec_UpdateFailHTLCZ_free(arg_constr);
4983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4984 LDKCVec_UpdateFailMalformedHTLCZ arg_constr;
4985 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4986 if (arg_constr.datalen > 0)
4987 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
4989 arg_constr.data = NULL;
4990 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4991 for (size_t z = 0; z < arg_constr.datalen; z++) {
4992 long arr_conv_25 = arg_vals[z];
4993 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
4994 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
4995 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
4996 arg_constr.data[z] = arr_conv_25_conv;
4998 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4999 CVec_UpdateFailMalformedHTLCZ_free(arg_constr);
5002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5003 LDKCVec_UpdateFulfillHTLCZ arg_constr;
5004 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5005 if (arg_constr.datalen > 0)
5006 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
5008 arg_constr.data = NULL;
5009 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5010 for (size_t t = 0; t < arg_constr.datalen; t++) {
5011 long arr_conv_19 = arg_vals[t];
5012 LDKUpdateFulfillHTLC arr_conv_19_conv;
5013 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5014 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5015 arg_constr.data[t] = arr_conv_19_conv;
5017 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5018 CVec_UpdateFulfillHTLCZ_free(arg_constr);
5021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5022 LDKCVec_u64Z arg_constr;
5023 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5024 if (arg_constr.datalen > 0)
5025 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
5027 arg_constr.data = NULL;
5028 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5029 for (size_t g = 0; g < arg_constr.datalen; g++) {
5030 long arr_conv_6 = arg_vals[g];
5031 arg_constr.data[g] = arr_conv_6;
5033 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5034 CVec_u64Z_free(arg_constr);
5037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
5038 LDKCVec_u8Z arg_ref;
5039 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
5040 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
5041 CVec_u8Z_free(arg_ref);
5042 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
5045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
5046 LDKTransaction _res_conv = *(LDKTransaction*)_res;
5047 Transaction_free(_res_conv);
5050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5051 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5053 TxOut_free(_res_conv);
5056 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5057 LDKTransaction b_conv = *(LDKTransaction*)b;
5058 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5059 *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
5063 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5064 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5065 *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
5069 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5070 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5071 *ret = CResult_NoneMonitorUpdateErrorZ_ok();
5075 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5077 a_conv.inner = (void*)(a & (~1));
5078 a_conv.is_owned = (a & 1) || (a == 0);
5079 if (a_conv.inner != NULL)
5080 a_conv = OutPoint_clone(&a_conv);
5082 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
5083 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5084 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5085 *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5086 (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0);
5090 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5091 LDKThirtyTwoBytes a_ref;
5092 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5093 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5094 LDKCVec_TxOutZ b_constr;
5095 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5096 if (b_constr.datalen > 0)
5097 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5099 b_constr.data = NULL;
5100 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5101 for (size_t h = 0; h < b_constr.datalen; h++) {
5102 long arr_conv_7 = b_vals[h];
5103 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5104 FREE((void*)arr_conv_7);
5105 b_constr.data[h] = arr_conv_7_conv;
5107 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5108 LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
5109 *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_constr);
5113 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5114 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5115 *ret = C2Tuple_u64u64Z_new(a, b);
5119 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5121 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5122 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5123 LDKCVec_SignatureZ b_constr;
5124 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5125 if (b_constr.datalen > 0)
5126 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5128 b_constr.data = NULL;
5129 for (size_t i = 0; i < b_constr.datalen; i++) {
5130 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5131 LDKSignature arr_conv_8_ref;
5132 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5133 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5134 b_constr.data[i] = arr_conv_8_ref;
5136 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5137 *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5141 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
5142 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5143 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5147 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
5148 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5149 *ret = CResult_SignatureNoneZ_err();
5153 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
5154 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5155 *ret = CResult_CVec_SignatureZNoneZ_err();
5159 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
5160 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5161 *ret = CResult_NoneAPIErrorZ_ok();
5165 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
5166 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5167 *ret = CResult_NonePaymentSendFailureZ_ok();
5171 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
5172 LDKChannelAnnouncement a_conv;
5173 a_conv.inner = (void*)(a & (~1));
5174 a_conv.is_owned = (a & 1) || (a == 0);
5175 if (a_conv.inner != NULL)
5176 a_conv = ChannelAnnouncement_clone(&a_conv);
5177 LDKChannelUpdate b_conv;
5178 b_conv.inner = (void*)(b & (~1));
5179 b_conv.is_owned = (b & 1) || (b == 0);
5180 if (b_conv.inner != NULL)
5181 b_conv = ChannelUpdate_clone(&b_conv);
5182 LDKChannelUpdate c_conv;
5183 c_conv.inner = (void*)(c & (~1));
5184 c_conv.is_owned = (c & 1) || (c == 0);
5185 if (c_conv.inner != NULL)
5186 c_conv = ChannelUpdate_clone(&c_conv);
5187 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5188 *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
5193 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5194 *ret = CResult_NonePeerHandleErrorZ_ok();
5198 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5199 LDKHTLCOutputInCommitment a_conv;
5200 a_conv.inner = (void*)(a & (~1));
5201 a_conv.is_owned = (a & 1) || (a == 0);
5202 if (a_conv.inner != NULL)
5203 a_conv = HTLCOutputInCommitment_clone(&a_conv);
5205 CHECK((*_env)->GetArrayLength (_env, b) == 64);
5206 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
5207 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
5208 *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
5212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5213 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
5214 FREE((void*)this_ptr);
5215 Event_free(this_ptr_conv);
5218 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5219 LDKEvent* orig_conv = (LDKEvent*)orig;
5220 LDKEvent* ret = MALLOC(sizeof(LDKEvent), "LDKEvent");
5221 *ret = Event_clone(orig_conv);
5225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5226 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
5227 FREE((void*)this_ptr);
5228 MessageSendEvent_free(this_ptr_conv);
5231 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5232 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
5233 LDKMessageSendEvent* ret = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5234 *ret = MessageSendEvent_clone(orig_conv);
5238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5239 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
5240 FREE((void*)this_ptr);
5241 MessageSendEventsProvider_free(this_ptr_conv);
5244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5245 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
5246 FREE((void*)this_ptr);
5247 EventsProvider_free(this_ptr_conv);
5250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5251 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
5252 FREE((void*)this_ptr);
5253 APIError_free(this_ptr_conv);
5256 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5257 LDKAPIError* orig_conv = (LDKAPIError*)orig;
5258 LDKAPIError* ret = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5259 *ret = APIError_clone(orig_conv);
5263 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5264 LDKLevel* orig_conv = (LDKLevel*)orig;
5265 jclass ret = LDKLevel_to_java(_env, Level_clone(orig_conv));
5269 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
5270 jclass ret = LDKLevel_to_java(_env, Level_max());
5274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5275 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
5276 FREE((void*)this_ptr);
5277 Logger_free(this_ptr_conv);
5280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5281 LDKChannelHandshakeConfig this_ptr_conv;
5282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5283 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5284 ChannelHandshakeConfig_free(this_ptr_conv);
5287 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5288 LDKChannelHandshakeConfig orig_conv;
5289 orig_conv.inner = (void*)(orig & (~1));
5290 orig_conv.is_owned = (orig & 1) || (orig == 0);
5291 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_clone(&orig_conv);
5292 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5295 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5296 LDKChannelHandshakeConfig this_ptr_conv;
5297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5298 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5299 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
5303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5304 LDKChannelHandshakeConfig this_ptr_conv;
5305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5306 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5307 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
5310 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5311 LDKChannelHandshakeConfig this_ptr_conv;
5312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5313 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5314 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
5318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5319 LDKChannelHandshakeConfig this_ptr_conv;
5320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5321 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5322 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
5325 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5326 LDKChannelHandshakeConfig this_ptr_conv;
5327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5328 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5329 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
5333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5334 LDKChannelHandshakeConfig this_ptr_conv;
5335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5336 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5337 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
5340 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) {
5341 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
5342 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5345 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
5346 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_default();
5347 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5351 LDKChannelHandshakeLimits this_ptr_conv;
5352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5353 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5354 ChannelHandshakeLimits_free(this_ptr_conv);
5357 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5358 LDKChannelHandshakeLimits orig_conv;
5359 orig_conv.inner = (void*)(orig & (~1));
5360 orig_conv.is_owned = (orig & 1) || (orig == 0);
5361 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_clone(&orig_conv);
5362 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5365 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5366 LDKChannelHandshakeLimits this_ptr_conv;
5367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5368 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5369 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
5373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5374 LDKChannelHandshakeLimits this_ptr_conv;
5375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5376 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5377 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
5380 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5381 LDKChannelHandshakeLimits this_ptr_conv;
5382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5383 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5384 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
5388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5389 LDKChannelHandshakeLimits this_ptr_conv;
5390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5391 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5392 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
5395 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5396 LDKChannelHandshakeLimits this_ptr_conv;
5397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5398 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5399 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
5403 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) {
5404 LDKChannelHandshakeLimits this_ptr_conv;
5405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5406 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5407 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
5410 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5411 LDKChannelHandshakeLimits this_ptr_conv;
5412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5413 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5414 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
5418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5419 LDKChannelHandshakeLimits this_ptr_conv;
5420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5421 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5422 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
5425 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
5426 LDKChannelHandshakeLimits this_ptr_conv;
5427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5428 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5429 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
5433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5434 LDKChannelHandshakeLimits this_ptr_conv;
5435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5436 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5437 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
5440 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5441 LDKChannelHandshakeLimits this_ptr_conv;
5442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5443 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5444 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
5448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5449 LDKChannelHandshakeLimits this_ptr_conv;
5450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5452 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
5455 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5456 LDKChannelHandshakeLimits this_ptr_conv;
5457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5458 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5459 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
5463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5464 LDKChannelHandshakeLimits this_ptr_conv;
5465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5467 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
5470 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5471 LDKChannelHandshakeLimits this_ptr_conv;
5472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5473 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5474 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
5478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5479 LDKChannelHandshakeLimits this_ptr_conv;
5480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5481 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5482 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5485 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
5486 LDKChannelHandshakeLimits this_ptr_conv;
5487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5488 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5489 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5494 LDKChannelHandshakeLimits this_ptr_conv;
5495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5496 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5497 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5500 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5501 LDKChannelHandshakeLimits this_ptr_conv;
5502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5503 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5504 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5509 LDKChannelHandshakeLimits this_ptr_conv;
5510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5511 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5512 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5515 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) {
5516 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);
5517 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5520 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5521 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_default();
5522 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5526 LDKChannelConfig this_ptr_conv;
5527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5528 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5529 ChannelConfig_free(this_ptr_conv);
5532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5533 LDKChannelConfig orig_conv;
5534 orig_conv.inner = (void*)(orig & (~1));
5535 orig_conv.is_owned = (orig & 1) || (orig == 0);
5536 LDKChannelConfig ret = ChannelConfig_clone(&orig_conv);
5537 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5540 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
5541 LDKChannelConfig this_ptr_conv;
5542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5544 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
5548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5549 LDKChannelConfig this_ptr_conv;
5550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5551 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5552 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
5555 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
5556 LDKChannelConfig this_ptr_conv;
5557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5558 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5559 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
5563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5564 LDKChannelConfig this_ptr_conv;
5565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5566 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5567 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5570 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5571 LDKChannelConfig this_ptr_conv;
5572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5573 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5574 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5579 LDKChannelConfig this_ptr_conv;
5580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5582 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5585 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) {
5586 LDKChannelConfig ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5587 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5590 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
5591 LDKChannelConfig ret = ChannelConfig_default();
5592 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5595 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
5596 LDKChannelConfig obj_conv;
5597 obj_conv.inner = (void*)(obj & (~1));
5598 obj_conv.is_owned = (obj & 1) || (obj == 0);
5599 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
5600 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5601 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5602 CVec_u8Z_free(arg_var);
5606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5608 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5609 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5610 LDKChannelConfig ret = ChannelConfig_read(ser_ref);
5611 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5612 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5616 LDKUserConfig this_ptr_conv;
5617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5618 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5619 UserConfig_free(this_ptr_conv);
5622 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5623 LDKUserConfig orig_conv;
5624 orig_conv.inner = (void*)(orig & (~1));
5625 orig_conv.is_owned = (orig & 1) || (orig == 0);
5626 LDKUserConfig ret = UserConfig_clone(&orig_conv);
5627 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
5631 LDKUserConfig this_ptr_conv;
5632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5633 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5634 LDKChannelHandshakeConfig ret = UserConfig_get_own_channel_config(&this_ptr_conv);
5635 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5639 LDKUserConfig this_ptr_conv;
5640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5641 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5642 LDKChannelHandshakeConfig val_conv;
5643 val_conv.inner = (void*)(val & (~1));
5644 val_conv.is_owned = (val & 1) || (val == 0);
5645 if (val_conv.inner != NULL)
5646 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5647 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
5651 LDKUserConfig this_ptr_conv;
5652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5653 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5654 LDKChannelHandshakeLimits ret = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5655 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5659 LDKUserConfig this_ptr_conv;
5660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5661 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5662 LDKChannelHandshakeLimits val_conv;
5663 val_conv.inner = (void*)(val & (~1));
5664 val_conv.is_owned = (val & 1) || (val == 0);
5665 if (val_conv.inner != NULL)
5666 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5667 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5670 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
5671 LDKUserConfig this_ptr_conv;
5672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5673 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5674 LDKChannelConfig ret = UserConfig_get_channel_options(&this_ptr_conv);
5675 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5679 LDKUserConfig this_ptr_conv;
5680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5681 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5682 LDKChannelConfig val_conv;
5683 val_conv.inner = (void*)(val & (~1));
5684 val_conv.is_owned = (val & 1) || (val == 0);
5685 if (val_conv.inner != NULL)
5686 val_conv = ChannelConfig_clone(&val_conv);
5687 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5690 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) {
5691 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5692 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5693 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5694 if (own_channel_config_arg_conv.inner != NULL)
5695 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5696 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5697 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5698 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5699 if (peer_channel_config_limits_arg_conv.inner != NULL)
5700 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5701 LDKChannelConfig channel_options_arg_conv;
5702 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5703 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5704 if (channel_options_arg_conv.inner != NULL)
5705 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5706 LDKUserConfig ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5707 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5710 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5711 LDKUserConfig ret = UserConfig_default();
5712 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5715 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5716 LDKAccessError* orig_conv = (LDKAccessError*)orig;
5717 jclass ret = LDKAccessError_to_java(_env, AccessError_clone(orig_conv));
5721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5722 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5723 FREE((void*)this_ptr);
5724 Access_free(this_ptr_conv);
5727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5728 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5729 FREE((void*)this_ptr);
5730 Watch_free(this_ptr_conv);
5733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5734 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5735 FREE((void*)this_ptr);
5736 Filter_free(this_ptr_conv);
5739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5740 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
5741 FREE((void*)this_ptr);
5742 BroadcasterInterface_free(this_ptr_conv);
5745 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5746 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
5747 jclass ret = LDKConfirmationTarget_to_java(_env, ConfirmationTarget_clone(orig_conv));
5751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5752 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
5753 FREE((void*)this_ptr);
5754 FeeEstimator_free(this_ptr_conv);
5757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5758 LDKChainMonitor this_ptr_conv;
5759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5760 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5761 ChainMonitor_free(this_ptr_conv);
5764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
5765 LDKChainMonitor this_arg_conv;
5766 this_arg_conv.inner = (void*)(this_arg & (~1));
5767 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5768 unsigned char header_arr[80];
5769 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5770 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5771 unsigned char (*header_ref)[80] = &header_arr;
5772 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5773 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
5774 if (txdata_constr.datalen > 0)
5775 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5777 txdata_constr.data = NULL;
5778 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
5779 for (size_t d = 0; d < txdata_constr.datalen; d++) {
5780 long arr_conv_29 = txdata_vals[d];
5781 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
5782 FREE((void*)arr_conv_29);
5783 txdata_constr.data[d] = arr_conv_29_conv;
5785 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
5786 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
5789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
5790 LDKChainMonitor this_arg_conv;
5791 this_arg_conv.inner = (void*)(this_arg & (~1));
5792 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5793 unsigned char header_arr[80];
5794 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5795 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5796 unsigned char (*header_ref)[80] = &header_arr;
5797 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
5800 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
5801 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
5802 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5803 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5804 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5805 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5807 LDKLogger logger_conv = *(LDKLogger*)logger;
5808 if (logger_conv.free == LDKLogger_JCalls_free) {
5809 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5810 LDKLogger_JCalls_clone(logger_conv.this_arg);
5812 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
5813 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
5814 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5815 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
5817 LDKChainMonitor ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
5818 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5821 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
5822 LDKChainMonitor this_arg_conv;
5823 this_arg_conv.inner = (void*)(this_arg & (~1));
5824 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5825 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
5826 *ret = ChainMonitor_as_Watch(&this_arg_conv);
5830 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5831 LDKChainMonitor this_arg_conv;
5832 this_arg_conv.inner = (void*)(this_arg & (~1));
5833 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5834 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5835 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
5839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5840 LDKChannelMonitorUpdate this_ptr_conv;
5841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5842 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5843 ChannelMonitorUpdate_free(this_ptr_conv);
5846 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5847 LDKChannelMonitorUpdate orig_conv;
5848 orig_conv.inner = (void*)(orig & (~1));
5849 orig_conv.is_owned = (orig & 1) || (orig == 0);
5850 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_clone(&orig_conv);
5851 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5854 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5855 LDKChannelMonitorUpdate this_ptr_conv;
5856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5857 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5858 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
5862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5863 LDKChannelMonitorUpdate this_ptr_conv;
5864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5865 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5866 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
5869 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5870 LDKChannelMonitorUpdate obj_conv;
5871 obj_conv.inner = (void*)(obj & (~1));
5872 obj_conv.is_owned = (obj & 1) || (obj == 0);
5873 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
5874 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5875 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5876 CVec_u8Z_free(arg_var);
5880 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5882 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5883 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5884 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_read(ser_ref);
5885 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5886 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5889 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5890 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
5891 jclass ret = LDKChannelMonitorUpdateErr_to_java(_env, ChannelMonitorUpdateErr_clone(orig_conv));
5895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5896 LDKMonitorUpdateError this_ptr_conv;
5897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5898 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5899 MonitorUpdateError_free(this_ptr_conv);
5902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5903 LDKMonitorEvent this_ptr_conv;
5904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5905 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5906 MonitorEvent_free(this_ptr_conv);
5909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5910 LDKHTLCUpdate this_ptr_conv;
5911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5912 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5913 HTLCUpdate_free(this_ptr_conv);
5916 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5917 LDKHTLCUpdate orig_conv;
5918 orig_conv.inner = (void*)(orig & (~1));
5919 orig_conv.is_owned = (orig & 1) || (orig == 0);
5920 LDKHTLCUpdate ret = HTLCUpdate_clone(&orig_conv);
5921 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5924 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5925 LDKHTLCUpdate obj_conv;
5926 obj_conv.inner = (void*)(obj & (~1));
5927 obj_conv.is_owned = (obj & 1) || (obj == 0);
5928 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
5929 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5930 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5931 CVec_u8Z_free(arg_var);
5935 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5937 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5938 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5939 LDKHTLCUpdate ret = HTLCUpdate_read(ser_ref);
5940 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5941 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5945 LDKChannelMonitor this_ptr_conv;
5946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5947 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5948 ChannelMonitor_free(this_ptr_conv);
5951 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
5952 LDKChannelMonitor this_arg_conv;
5953 this_arg_conv.inner = (void*)(this_arg & (~1));
5954 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5955 LDKChannelMonitorUpdate updates_conv;
5956 updates_conv.inner = (void*)(updates & (~1));
5957 updates_conv.is_owned = (updates & 1) || (updates == 0);
5958 if (updates_conv.inner != NULL)
5959 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
5960 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
5961 LDKLogger* logger_conv = (LDKLogger*)logger;
5962 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5963 *ret = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
5967 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5968 LDKChannelMonitor this_arg_conv;
5969 this_arg_conv.inner = (void*)(this_arg & (~1));
5970 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5971 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
5975 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
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 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5980 *ret = ChannelMonitor_get_funding_txo(&this_arg_conv);
5984 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5985 LDKChannelMonitor this_arg_conv;
5986 this_arg_conv.inner = (void*)(this_arg & (~1));
5987 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5988 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
5989 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
5990 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
5991 for (size_t o = 0; o < ret_var.datalen; o++) {
5992 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
5993 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5994 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5995 long arr_conv_14_ref;
5996 if (arr_conv_14_var.is_owned) {
5997 arr_conv_14_ref = (long)arr_conv_14_var.inner | 1;
5999 arr_conv_14_ref = (long)arr_conv_14_var.inner & ~1;
6001 ret_arr_ptr[o] = arr_conv_14_ref;
6003 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6008 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_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_EventZ ret_var = ChannelMonitor_get_and_clear_pending_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 h = 0; h < ret_var.datalen; h++) {
6016 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6017 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
6018 long arr_conv_7_ref = (long)arr_conv_7_copy;
6019 ret_arr_ptr[h] = arr_conv_7_ref;
6021 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6022 CVec_EventZ_free(ret_var);
6026 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
6027 LDKChannelMonitor this_arg_conv;
6028 this_arg_conv.inner = (void*)(this_arg & (~1));
6029 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6030 LDKLogger* logger_conv = (LDKLogger*)logger;
6031 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
6032 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6033 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6034 for (size_t n = 0; n < ret_var.datalen; n++) {
6035 LDKTransaction *arr_conv_13_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
6036 *arr_conv_13_copy = ret_var.data[n];
6037 long arr_conv_13_ref = (long)arr_conv_13_copy;
6038 ret_arr_ptr[n] = arr_conv_13_ref;
6040 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6041 CVec_TransactionZ_free(ret_var);
6045 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) {
6046 LDKChannelMonitor this_arg_conv;
6047 this_arg_conv.inner = (void*)(this_arg & (~1));
6048 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6049 unsigned char header_arr[80];
6050 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6051 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6052 unsigned char (*header_ref)[80] = &header_arr;
6053 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6054 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6055 if (txdata_constr.datalen > 0)
6056 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6058 txdata_constr.data = NULL;
6059 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6060 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6061 long arr_conv_29 = txdata_vals[d];
6062 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6063 FREE((void*)arr_conv_29);
6064 txdata_constr.data[d] = arr_conv_29_conv;
6066 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6067 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6068 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6069 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6070 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6072 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6073 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6074 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6075 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6077 LDKLogger logger_conv = *(LDKLogger*)logger;
6078 if (logger_conv.free == LDKLogger_JCalls_free) {
6079 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6080 LDKLogger_JCalls_clone(logger_conv.this_arg);
6082 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6083 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6084 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6085 for (size_t b = 0; b < ret_var.datalen; b++) {
6086 /*XXX False */long arr_conv_27_ref = (long)&ret_var.data[b];
6087 ret_arr_ptr[b] = arr_conv_27_ref;
6089 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6090 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(ret_var);
6094 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) {
6095 LDKChannelMonitor this_arg_conv;
6096 this_arg_conv.inner = (void*)(this_arg & (~1));
6097 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6098 unsigned char header_arr[80];
6099 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6100 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6101 unsigned char (*header_ref)[80] = &header_arr;
6102 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6103 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6104 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6105 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6107 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6108 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6109 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6110 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6112 LDKLogger logger_conv = *(LDKLogger*)logger;
6113 if (logger_conv.free == LDKLogger_JCalls_free) {
6114 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6115 LDKLogger_JCalls_clone(logger_conv.this_arg);
6117 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6121 LDKOutPoint this_ptr_conv;
6122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6123 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6124 OutPoint_free(this_ptr_conv);
6127 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6128 LDKOutPoint orig_conv;
6129 orig_conv.inner = (void*)(orig & (~1));
6130 orig_conv.is_owned = (orig & 1) || (orig == 0);
6131 LDKOutPoint ret = OutPoint_clone(&orig_conv);
6132 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6135 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6136 LDKOutPoint this_ptr_conv;
6137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6138 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6139 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6140 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
6144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
6149 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6150 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6151 OutPoint_set_txid(&this_ptr_conv, val_ref);
6154 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6155 LDKOutPoint this_ptr_conv;
6156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6157 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6158 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
6162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6163 LDKOutPoint this_ptr_conv;
6164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6165 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6166 OutPoint_set_index(&this_ptr_conv, val);
6169 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
6170 LDKThirtyTwoBytes txid_arg_ref;
6171 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
6172 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
6173 LDKOutPoint ret = OutPoint_new(txid_arg_ref, index_arg);
6174 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6177 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6178 LDKOutPoint this_arg_conv;
6179 this_arg_conv.inner = (void*)(this_arg & (~1));
6180 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6181 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
6182 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
6186 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
6187 LDKOutPoint obj_conv;
6188 obj_conv.inner = (void*)(obj & (~1));
6189 obj_conv.is_owned = (obj & 1) || (obj == 0);
6190 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
6191 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6192 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6193 CVec_u8Z_free(arg_var);
6197 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6199 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6200 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6201 LDKOutPoint ret = OutPoint_read(ser_ref);
6202 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6203 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6207 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
6208 FREE((void*)this_ptr);
6209 SpendableOutputDescriptor_free(this_ptr_conv);
6212 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6213 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
6214 LDKSpendableOutputDescriptor* ret = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
6215 *ret = SpendableOutputDescriptor_clone(orig_conv);
6219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6220 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
6221 FREE((void*)this_ptr);
6222 ChannelKeys_free(this_ptr_conv);
6225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6226 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
6227 FREE((void*)this_ptr);
6228 KeysInterface_free(this_ptr_conv);
6231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6232 LDKInMemoryChannelKeys this_ptr_conv;
6233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6234 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6235 InMemoryChannelKeys_free(this_ptr_conv);
6238 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6239 LDKInMemoryChannelKeys orig_conv;
6240 orig_conv.inner = (void*)(orig & (~1));
6241 orig_conv.is_owned = (orig & 1) || (orig == 0);
6242 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_clone(&orig_conv);
6243 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6246 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6247 LDKInMemoryChannelKeys this_ptr_conv;
6248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6249 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6250 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6251 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
6255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKSecretKey val_ref;
6260 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6261 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6262 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
6265 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6266 LDKInMemoryChannelKeys this_ptr_conv;
6267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6268 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6269 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6270 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
6274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6275 LDKInMemoryChannelKeys this_ptr_conv;
6276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6277 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6278 LDKSecretKey val_ref;
6279 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6280 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6281 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
6284 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6285 LDKInMemoryChannelKeys this_ptr_conv;
6286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6288 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6289 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
6293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6294 LDKInMemoryChannelKeys this_ptr_conv;
6295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6296 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6297 LDKSecretKey val_ref;
6298 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6299 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6300 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
6303 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6304 LDKInMemoryChannelKeys this_ptr_conv;
6305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6306 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6307 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6308 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
6312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6313 LDKInMemoryChannelKeys this_ptr_conv;
6314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6316 LDKSecretKey val_ref;
6317 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6318 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6319 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
6322 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6323 LDKInMemoryChannelKeys this_ptr_conv;
6324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6325 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6326 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6327 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
6331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6332 LDKInMemoryChannelKeys this_ptr_conv;
6333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6334 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6335 LDKSecretKey val_ref;
6336 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6337 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6338 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6341 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
6342 LDKInMemoryChannelKeys this_ptr_conv;
6343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6344 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6345 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6346 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
6350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6351 LDKInMemoryChannelKeys this_ptr_conv;
6352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6353 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6354 LDKThirtyTwoBytes val_ref;
6355 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6356 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6357 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6360 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) {
6361 LDKSecretKey funding_key_ref;
6362 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
6363 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
6364 LDKSecretKey revocation_base_key_ref;
6365 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
6366 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
6367 LDKSecretKey payment_key_ref;
6368 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
6369 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
6370 LDKSecretKey delayed_payment_base_key_ref;
6371 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
6372 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
6373 LDKSecretKey htlc_base_key_ref;
6374 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
6375 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
6376 LDKThirtyTwoBytes commitment_seed_ref;
6377 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
6378 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
6379 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
6380 FREE((void*)key_derivation_params);
6381 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);
6382 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6385 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6386 LDKInMemoryChannelKeys this_arg_conv;
6387 this_arg_conv.inner = (void*)(this_arg & (~1));
6388 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6389 LDKChannelPublicKeys ret = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
6390 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6393 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6394 LDKInMemoryChannelKeys this_arg_conv;
6395 this_arg_conv.inner = (void*)(this_arg & (~1));
6396 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6397 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
6401 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6402 LDKInMemoryChannelKeys this_arg_conv;
6403 this_arg_conv.inner = (void*)(this_arg & (~1));
6404 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6405 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
6409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(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 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6414 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
6418 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
6419 LDKInMemoryChannelKeys obj_conv;
6420 obj_conv.inner = (void*)(obj & (~1));
6421 obj_conv.is_owned = (obj & 1) || (obj == 0);
6422 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
6423 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6424 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6425 CVec_u8Z_free(arg_var);
6429 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6431 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6432 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6433 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_read(ser_ref);
6434 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6435 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6439 LDKKeysManager this_ptr_conv;
6440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6441 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6442 KeysManager_free(this_ptr_conv);
6445 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) {
6446 unsigned char seed_arr[32];
6447 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
6448 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
6449 unsigned char (*seed_ref)[32] = &seed_arr;
6450 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6451 LDKKeysManager ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
6452 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6455 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) {
6456 LDKKeysManager this_arg_conv;
6457 this_arg_conv.inner = (void*)(this_arg & (~1));
6458 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6459 LDKInMemoryChannelKeys ret = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
6460 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6463 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
6464 LDKKeysManager this_arg_conv;
6465 this_arg_conv.inner = (void*)(this_arg & (~1));
6466 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6467 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6468 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
6472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6473 LDKChannelManager this_ptr_conv;
6474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6475 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6476 ChannelManager_free(this_ptr_conv);
6479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6480 LDKChannelDetails this_ptr_conv;
6481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6482 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6483 ChannelDetails_free(this_ptr_conv);
6486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6487 LDKChannelDetails orig_conv;
6488 orig_conv.inner = (void*)(orig & (~1));
6489 orig_conv.is_owned = (orig & 1) || (orig == 0);
6490 LDKChannelDetails ret = ChannelDetails_clone(&orig_conv);
6491 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6494 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6495 LDKChannelDetails this_ptr_conv;
6496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6497 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6498 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6499 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
6503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
6508 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6509 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6510 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
6513 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6514 LDKChannelDetails this_ptr_conv;
6515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6516 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6517 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6518 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
6522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6523 LDKChannelDetails this_ptr_conv;
6524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6525 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6526 LDKPublicKey val_ref;
6527 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6528 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6529 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
6532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
6533 LDKChannelDetails this_ptr_conv;
6534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6536 LDKInitFeatures ret = ChannelDetails_get_counterparty_features(&this_ptr_conv);
6537 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6541 LDKChannelDetails this_ptr_conv;
6542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6544 LDKInitFeatures val_conv;
6545 val_conv.inner = (void*)(val & (~1));
6546 val_conv.is_owned = (val & 1) || (val == 0);
6547 // Warning: we may need a move here but can't clone!
6548 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
6551 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6552 LDKChannelDetails this_ptr_conv;
6553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6554 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6555 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
6559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6560 LDKChannelDetails this_ptr_conv;
6561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6562 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6563 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
6566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6567 LDKChannelDetails this_ptr_conv;
6568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6569 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6570 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
6574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6575 LDKChannelDetails this_ptr_conv;
6576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6577 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6578 ChannelDetails_set_user_id(&this_ptr_conv, val);
6581 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6582 LDKChannelDetails this_ptr_conv;
6583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6585 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
6589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6590 LDKChannelDetails this_ptr_conv;
6591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6592 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6593 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
6596 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6597 LDKChannelDetails this_ptr_conv;
6598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6599 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6600 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
6604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6605 LDKChannelDetails this_ptr_conv;
6606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6607 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6608 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
6611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
6612 LDKChannelDetails this_ptr_conv;
6613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6614 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6615 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
6619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6620 LDKChannelDetails this_ptr_conv;
6621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6623 ChannelDetails_set_is_live(&this_ptr_conv, val);
6626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6627 LDKPaymentSendFailure this_ptr_conv;
6628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6629 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6630 PaymentSendFailure_free(this_ptr_conv);
6633 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) {
6634 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6635 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
6636 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
6637 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6638 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
6640 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6641 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6642 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6643 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6645 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6646 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6647 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6648 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6650 LDKLogger logger_conv = *(LDKLogger*)logger;
6651 if (logger_conv.free == LDKLogger_JCalls_free) {
6652 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6653 LDKLogger_JCalls_clone(logger_conv.this_arg);
6655 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6656 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6657 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6658 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6660 LDKUserConfig config_conv;
6661 config_conv.inner = (void*)(config & (~1));
6662 config_conv.is_owned = (config & 1) || (config == 0);
6663 if (config_conv.inner != NULL)
6664 config_conv = UserConfig_clone(&config_conv);
6665 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);
6666 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6669 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) {
6670 LDKChannelManager this_arg_conv;
6671 this_arg_conv.inner = (void*)(this_arg & (~1));
6672 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6673 LDKPublicKey their_network_key_ref;
6674 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
6675 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
6676 LDKUserConfig override_config_conv;
6677 override_config_conv.inner = (void*)(override_config & (~1));
6678 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
6679 if (override_config_conv.inner != NULL)
6680 override_config_conv = UserConfig_clone(&override_config_conv);
6681 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6682 *ret = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
6686 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6687 LDKChannelManager this_arg_conv;
6688 this_arg_conv.inner = (void*)(this_arg & (~1));
6689 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6690 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
6691 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6692 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6693 for (size_t q = 0; q < ret_var.datalen; q++) {
6694 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
6695 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6696 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6697 long arr_conv_16_ref;
6698 if (arr_conv_16_var.is_owned) {
6699 arr_conv_16_ref = (long)arr_conv_16_var.inner | 1;
6701 arr_conv_16_ref = (long)arr_conv_16_var.inner & ~1;
6703 ret_arr_ptr[q] = arr_conv_16_ref;
6705 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6710 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_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_usable_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 jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
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 unsigned char channel_id_arr[32];
6739 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6740 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6741 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6742 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6743 *ret = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
6747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6748 LDKChannelManager this_arg_conv;
6749 this_arg_conv.inner = (void*)(this_arg & (~1));
6750 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6751 unsigned char channel_id_arr[32];
6752 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6753 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6754 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6755 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
6758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
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 ChannelManager_force_close_all_channels(&this_arg_conv);
6765 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) {
6766 LDKChannelManager this_arg_conv;
6767 this_arg_conv.inner = (void*)(this_arg & (~1));
6768 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6769 LDKRoute route_conv;
6770 route_conv.inner = (void*)(route & (~1));
6771 route_conv.is_owned = (route & 1) || (route == 0);
6772 LDKThirtyTwoBytes payment_hash_ref;
6773 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6774 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
6775 LDKThirtyTwoBytes payment_secret_ref;
6776 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6777 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6778 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6779 *ret = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
6783 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) {
6784 LDKChannelManager this_arg_conv;
6785 this_arg_conv.inner = (void*)(this_arg & (~1));
6786 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6787 unsigned char temporary_channel_id_arr[32];
6788 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
6789 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
6790 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
6791 LDKOutPoint funding_txo_conv;
6792 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6793 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6794 if (funding_txo_conv.inner != NULL)
6795 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6796 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
6799 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) {
6800 LDKChannelManager this_arg_conv;
6801 this_arg_conv.inner = (void*)(this_arg & (~1));
6802 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6803 LDKThreeBytes rgb_ref;
6804 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
6805 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
6806 LDKThirtyTwoBytes alias_ref;
6807 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
6808 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
6809 LDKCVec_NetAddressZ addresses_constr;
6810 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
6811 if (addresses_constr.datalen > 0)
6812 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6814 addresses_constr.data = NULL;
6815 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
6816 for (size_t m = 0; m < addresses_constr.datalen; m++) {
6817 long arr_conv_12 = addresses_vals[m];
6818 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
6819 FREE((void*)arr_conv_12);
6820 addresses_constr.data[m] = arr_conv_12_conv;
6822 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
6823 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
6826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
6827 LDKChannelManager this_arg_conv;
6828 this_arg_conv.inner = (void*)(this_arg & (~1));
6829 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6830 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
6833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
6834 LDKChannelManager this_arg_conv;
6835 this_arg_conv.inner = (void*)(this_arg & (~1));
6836 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6837 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
6840 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) {
6841 LDKChannelManager this_arg_conv;
6842 this_arg_conv.inner = (void*)(this_arg & (~1));
6843 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6844 unsigned char payment_hash_arr[32];
6845 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6846 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
6847 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
6848 LDKThirtyTwoBytes payment_secret_ref;
6849 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6850 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6851 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
6855 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) {
6856 LDKChannelManager this_arg_conv;
6857 this_arg_conv.inner = (void*)(this_arg & (~1));
6858 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6859 LDKThirtyTwoBytes payment_preimage_ref;
6860 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
6861 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
6862 LDKThirtyTwoBytes payment_secret_ref;
6863 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6864 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6865 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
6869 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6870 LDKChannelManager this_arg_conv;
6871 this_arg_conv.inner = (void*)(this_arg & (~1));
6872 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6873 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6874 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
6878 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) {
6879 LDKChannelManager this_arg_conv;
6880 this_arg_conv.inner = (void*)(this_arg & (~1));
6881 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6882 LDKOutPoint funding_txo_conv;
6883 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6884 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6885 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
6888 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6889 LDKChannelManager this_arg_conv;
6890 this_arg_conv.inner = (void*)(this_arg & (~1));
6891 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6892 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6893 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
6897 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6898 LDKChannelManager this_arg_conv;
6899 this_arg_conv.inner = (void*)(this_arg & (~1));
6900 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6901 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6902 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
6906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
6907 LDKChannelManager this_arg_conv;
6908 this_arg_conv.inner = (void*)(this_arg & (~1));
6909 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6910 unsigned char header_arr[80];
6911 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6912 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6913 unsigned char (*header_ref)[80] = &header_arr;
6914 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6915 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6916 if (txdata_constr.datalen > 0)
6917 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6919 txdata_constr.data = NULL;
6920 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6921 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6922 long arr_conv_29 = txdata_vals[d];
6923 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6924 FREE((void*)arr_conv_29);
6925 txdata_constr.data[d] = arr_conv_29_conv;
6927 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6928 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
6932 LDKChannelManager this_arg_conv;
6933 this_arg_conv.inner = (void*)(this_arg & (~1));
6934 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6935 unsigned char header_arr[80];
6936 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6937 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6938 unsigned char (*header_ref)[80] = &header_arr;
6939 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
6942 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
6943 LDKChannelManager this_arg_conv;
6944 this_arg_conv.inner = (void*)(this_arg & (~1));
6945 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6946 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6947 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
6951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6952 LDKChannelManagerReadArgs this_ptr_conv;
6953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6954 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6955 ChannelManagerReadArgs_free(this_ptr_conv);
6958 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
6959 LDKChannelManagerReadArgs this_ptr_conv;
6960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6961 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6962 long ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
6966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6967 LDKChannelManagerReadArgs this_ptr_conv;
6968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6969 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6970 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
6971 if (val_conv.free == LDKKeysInterface_JCalls_free) {
6972 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6973 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
6975 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
6978 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
6979 LDKChannelManagerReadArgs this_ptr_conv;
6980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6981 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6982 long ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
6986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6987 LDKChannelManagerReadArgs this_ptr_conv;
6988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6989 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6990 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
6991 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
6992 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6993 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
6995 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
6998 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
6999 LDKChannelManagerReadArgs this_ptr_conv;
7000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7001 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7002 long ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
7006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7007 LDKChannelManagerReadArgs this_ptr_conv;
7008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7009 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7010 LDKWatch val_conv = *(LDKWatch*)val;
7011 if (val_conv.free == LDKWatch_JCalls_free) {
7012 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7013 LDKWatch_JCalls_clone(val_conv.this_arg);
7015 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
7018 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
7019 LDKChannelManagerReadArgs this_ptr_conv;
7020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7021 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7022 long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
7026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7027 LDKChannelManagerReadArgs this_ptr_conv;
7028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7029 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7030 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
7031 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
7032 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7033 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
7035 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
7038 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
7039 LDKChannelManagerReadArgs this_ptr_conv;
7040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7041 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7042 long ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
7046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7047 LDKChannelManagerReadArgs this_ptr_conv;
7048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7049 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7050 LDKLogger val_conv = *(LDKLogger*)val;
7051 if (val_conv.free == LDKLogger_JCalls_free) {
7052 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7053 LDKLogger_JCalls_clone(val_conv.this_arg);
7055 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
7058 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
7059 LDKChannelManagerReadArgs this_ptr_conv;
7060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7061 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7062 LDKUserConfig ret = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
7063 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7067 LDKChannelManagerReadArgs this_ptr_conv;
7068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7069 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7070 LDKUserConfig val_conv;
7071 val_conv.inner = (void*)(val & (~1));
7072 val_conv.is_owned = (val & 1) || (val == 0);
7073 if (val_conv.inner != NULL)
7074 val_conv = UserConfig_clone(&val_conv);
7075 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
7078 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) {
7079 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7080 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7081 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7082 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7084 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7085 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
7086 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7087 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
7089 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7090 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7091 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7092 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7094 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7095 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7096 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7097 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7099 LDKLogger logger_conv = *(LDKLogger*)logger;
7100 if (logger_conv.free == LDKLogger_JCalls_free) {
7101 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7102 LDKLogger_JCalls_clone(logger_conv.this_arg);
7104 LDKUserConfig default_config_conv;
7105 default_config_conv.inner = (void*)(default_config & (~1));
7106 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
7107 if (default_config_conv.inner != NULL)
7108 default_config_conv = UserConfig_clone(&default_config_conv);
7109 LDKCVec_ChannelMonitorZ channel_monitors_constr;
7110 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
7111 if (channel_monitors_constr.datalen > 0)
7112 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7114 channel_monitors_constr.data = NULL;
7115 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
7116 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
7117 long arr_conv_16 = channel_monitors_vals[q];
7118 LDKChannelMonitor arr_conv_16_conv;
7119 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7120 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7121 // Warning: we may need a move here but can't clone!
7122 channel_monitors_constr.data[q] = arr_conv_16_conv;
7124 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
7125 LDKChannelManagerReadArgs ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr);
7126 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7130 LDKDecodeError this_ptr_conv;
7131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7132 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7133 DecodeError_free(this_ptr_conv);
7136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7137 LDKInit this_ptr_conv;
7138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7139 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7140 Init_free(this_ptr_conv);
7143 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7145 orig_conv.inner = (void*)(orig & (~1));
7146 orig_conv.is_owned = (orig & 1) || (orig == 0);
7147 LDKInit ret = Init_clone(&orig_conv);
7148 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7152 LDKErrorMessage this_ptr_conv;
7153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7154 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7155 ErrorMessage_free(this_ptr_conv);
7158 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7159 LDKErrorMessage orig_conv;
7160 orig_conv.inner = (void*)(orig & (~1));
7161 orig_conv.is_owned = (orig & 1) || (orig == 0);
7162 LDKErrorMessage ret = ErrorMessage_clone(&orig_conv);
7163 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7166 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7167 LDKErrorMessage this_ptr_conv;
7168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7169 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7170 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7171 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
7175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
7180 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7181 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7182 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
7185 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
7186 LDKErrorMessage this_ptr_conv;
7187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7188 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7189 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
7190 char* _buf = MALLOC(_str.len + 1, "str conv buf");
7191 memcpy(_buf, _str.chars, _str.len);
7193 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
7198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7199 LDKErrorMessage this_ptr_conv;
7200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7201 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7202 LDKCVec_u8Z val_ref;
7203 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
7204 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7205 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7206 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
7209 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
7210 LDKThirtyTwoBytes channel_id_arg_ref;
7211 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7212 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7213 LDKCVec_u8Z data_arg_ref;
7214 data_arg_ref.data = (*_env)->GetByteArrayElements (_env, data_arg, NULL);
7215 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
7216 LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7217 (*_env)->ReleaseByteArrayElements(_env, data_arg, (int8_t*)data_arg_ref.data, 0);
7218 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7222 LDKPing this_ptr_conv;
7223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7224 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7225 Ping_free(this_ptr_conv);
7228 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7230 orig_conv.inner = (void*)(orig & (~1));
7231 orig_conv.is_owned = (orig & 1) || (orig == 0);
7232 LDKPing ret = Ping_clone(&orig_conv);
7233 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7236 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7237 LDKPing this_ptr_conv;
7238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7239 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7240 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7245 LDKPing this_ptr_conv;
7246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7247 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7248 Ping_set_ponglen(&this_ptr_conv, val);
7251 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7252 LDKPing this_ptr_conv;
7253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7254 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7255 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7260 LDKPing this_ptr_conv;
7261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7262 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7263 Ping_set_byteslen(&this_ptr_conv, val);
7266 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
7267 LDKPing ret = Ping_new(ponglen_arg, byteslen_arg);
7268 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7272 LDKPong this_ptr_conv;
7273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7274 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7275 Pong_free(this_ptr_conv);
7278 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7280 orig_conv.inner = (void*)(orig & (~1));
7281 orig_conv.is_owned = (orig & 1) || (orig == 0);
7282 LDKPong ret = Pong_clone(&orig_conv);
7283 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7286 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7287 LDKPong this_ptr_conv;
7288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7289 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7290 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
7294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7295 LDKPong this_ptr_conv;
7296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7297 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7298 Pong_set_byteslen(&this_ptr_conv, val);
7301 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
7302 LDKPong ret = Pong_new(byteslen_arg);
7303 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7307 LDKOpenChannel this_ptr_conv;
7308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7309 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7310 OpenChannel_free(this_ptr_conv);
7313 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7314 LDKOpenChannel orig_conv;
7315 orig_conv.inner = (void*)(orig & (~1));
7316 orig_conv.is_owned = (orig & 1) || (orig == 0);
7317 LDKOpenChannel ret = OpenChannel_clone(&orig_conv);
7318 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7321 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7322 LDKOpenChannel this_ptr_conv;
7323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7324 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7325 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7326 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
7330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
7335 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7336 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7337 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
7340 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7341 LDKOpenChannel this_ptr_conv;
7342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7343 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7344 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7345 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
7349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7350 LDKOpenChannel this_ptr_conv;
7351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7352 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7353 LDKThirtyTwoBytes val_ref;
7354 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7355 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7356 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7359 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7360 LDKOpenChannel this_ptr_conv;
7361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7362 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7363 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
7367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7368 LDKOpenChannel this_ptr_conv;
7369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7370 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7371 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
7374 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7375 LDKOpenChannel this_ptr_conv;
7376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7377 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7378 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
7382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7383 LDKOpenChannel this_ptr_conv;
7384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7385 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7386 OpenChannel_set_push_msat(&this_ptr_conv, val);
7389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7390 LDKOpenChannel this_ptr_conv;
7391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7392 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7393 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
7397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7398 LDKOpenChannel this_ptr_conv;
7399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7401 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7404 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7405 LDKOpenChannel this_ptr_conv;
7406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7408 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7412 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) {
7413 LDKOpenChannel this_ptr_conv;
7414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7415 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7416 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7419 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7420 LDKOpenChannel this_ptr_conv;
7421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7422 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7423 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7428 LDKOpenChannel this_ptr_conv;
7429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7431 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7434 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7435 LDKOpenChannel this_ptr_conv;
7436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7437 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7438 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
7442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7443 LDKOpenChannel this_ptr_conv;
7444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7445 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7446 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7449 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7450 LDKOpenChannel this_ptr_conv;
7451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7452 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7453 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
7457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7458 LDKOpenChannel this_ptr_conv;
7459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7460 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7461 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
7464 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7465 LDKOpenChannel this_ptr_conv;
7466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7467 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7468 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
7472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7473 LDKOpenChannel this_ptr_conv;
7474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7475 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7476 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
7479 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7480 LDKOpenChannel this_ptr_conv;
7481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7482 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7483 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
7487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7488 LDKOpenChannel this_ptr_conv;
7489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7491 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7494 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7495 LDKOpenChannel this_ptr_conv;
7496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7497 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7498 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7499 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKPublicKey val_ref;
7508 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7509 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7510 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7513 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7514 LDKOpenChannel this_ptr_conv;
7515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7516 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7517 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7518 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7523 LDKOpenChannel this_ptr_conv;
7524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7525 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7526 LDKPublicKey val_ref;
7527 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7528 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7529 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7532 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7533 LDKOpenChannel this_ptr_conv;
7534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7536 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7537 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
7541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7542 LDKOpenChannel this_ptr_conv;
7543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7545 LDKPublicKey val_ref;
7546 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7547 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7548 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
7551 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7552 LDKOpenChannel this_ptr_conv;
7553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7554 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7555 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7556 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7561 LDKOpenChannel this_ptr_conv;
7562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7563 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7564 LDKPublicKey val_ref;
7565 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7566 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7567 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7570 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7571 LDKOpenChannel this_ptr_conv;
7572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7573 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7574 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7575 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
7579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7580 LDKOpenChannel this_ptr_conv;
7581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7582 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7583 LDKPublicKey val_ref;
7584 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7585 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7586 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7589 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7590 LDKOpenChannel this_ptr_conv;
7591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7592 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7593 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7594 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
7598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7599 LDKOpenChannel this_ptr_conv;
7600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7601 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7602 LDKPublicKey val_ref;
7603 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7604 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7605 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7608 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
7609 LDKOpenChannel this_ptr_conv;
7610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7611 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7612 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
7616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
7617 LDKOpenChannel this_ptr_conv;
7618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7619 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7620 OpenChannel_set_channel_flags(&this_ptr_conv, val);
7623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7624 LDKAcceptChannel this_ptr_conv;
7625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7626 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7627 AcceptChannel_free(this_ptr_conv);
7630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7631 LDKAcceptChannel orig_conv;
7632 orig_conv.inner = (void*)(orig & (~1));
7633 orig_conv.is_owned = (orig & 1) || (orig == 0);
7634 LDKAcceptChannel ret = AcceptChannel_clone(&orig_conv);
7635 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7638 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7639 LDKAcceptChannel this_ptr_conv;
7640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7641 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7642 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7643 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
7647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
7652 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7653 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7654 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7657 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7658 LDKAcceptChannel this_ptr_conv;
7659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7660 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7661 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
7665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7666 LDKAcceptChannel this_ptr_conv;
7667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7668 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7669 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7672 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7673 LDKAcceptChannel this_ptr_conv;
7674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7675 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7676 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7680 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) {
7681 LDKAcceptChannel this_ptr_conv;
7682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7683 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7684 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7687 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7688 LDKAcceptChannel this_ptr_conv;
7689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7690 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7691 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7696 LDKAcceptChannel this_ptr_conv;
7697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7699 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7702 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7703 LDKAcceptChannel this_ptr_conv;
7704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7705 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7706 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
7710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7711 LDKAcceptChannel this_ptr_conv;
7712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7713 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7714 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7717 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
7718 LDKAcceptChannel this_ptr_conv;
7719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7720 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7721 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
7725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7726 LDKAcceptChannel this_ptr_conv;
7727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7728 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7729 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
7732 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7733 LDKAcceptChannel this_ptr_conv;
7734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7735 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7736 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
7740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7741 LDKAcceptChannel this_ptr_conv;
7742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7743 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7744 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
7747 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7748 LDKAcceptChannel this_ptr_conv;
7749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7750 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7751 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
7755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7756 LDKAcceptChannel this_ptr_conv;
7757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7758 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7759 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7762 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7763 LDKAcceptChannel this_ptr_conv;
7764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7765 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7766 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7767 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKPublicKey val_ref;
7776 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7777 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7778 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7781 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7782 LDKAcceptChannel this_ptr_conv;
7783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7784 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7785 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7786 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7791 LDKAcceptChannel this_ptr_conv;
7792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7793 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7794 LDKPublicKey val_ref;
7795 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7796 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7797 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7800 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7801 LDKAcceptChannel this_ptr_conv;
7802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7803 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7804 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7805 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
7809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7810 LDKAcceptChannel this_ptr_conv;
7811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7812 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7813 LDKPublicKey val_ref;
7814 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7815 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7816 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
7819 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7820 LDKAcceptChannel this_ptr_conv;
7821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7822 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7823 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7824 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7829 LDKAcceptChannel this_ptr_conv;
7830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7831 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7832 LDKPublicKey val_ref;
7833 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7834 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7835 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7838 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7839 LDKAcceptChannel this_ptr_conv;
7840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7841 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7842 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7843 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
7847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7848 LDKAcceptChannel this_ptr_conv;
7849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7850 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7851 LDKPublicKey val_ref;
7852 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7853 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7854 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7857 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7858 LDKAcceptChannel this_ptr_conv;
7859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7860 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7861 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7862 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
7866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7867 LDKAcceptChannel this_ptr_conv;
7868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7869 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7870 LDKPublicKey val_ref;
7871 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7872 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7873 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7877 LDKFundingCreated this_ptr_conv;
7878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7879 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7880 FundingCreated_free(this_ptr_conv);
7883 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7884 LDKFundingCreated orig_conv;
7885 orig_conv.inner = (void*)(orig & (~1));
7886 orig_conv.is_owned = (orig & 1) || (orig == 0);
7887 LDKFundingCreated ret = FundingCreated_clone(&orig_conv);
7888 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7891 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7892 LDKFundingCreated this_ptr_conv;
7893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7894 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7895 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7896 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
7900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
7905 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7906 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7907 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
7910 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
7911 LDKFundingCreated this_ptr_conv;
7912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7913 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7914 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7915 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
7919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7920 LDKFundingCreated this_ptr_conv;
7921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7922 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7923 LDKThirtyTwoBytes val_ref;
7924 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7925 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7926 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
7929 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
7930 LDKFundingCreated this_ptr_conv;
7931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7932 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7933 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
7937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7938 LDKFundingCreated this_ptr_conv;
7939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7940 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7941 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
7944 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7945 LDKFundingCreated this_ptr_conv;
7946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7947 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7948 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7949 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
7953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKSignature val_ref;
7958 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7959 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7960 FundingCreated_set_signature(&this_ptr_conv, val_ref);
7963 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) {
7964 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
7965 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
7966 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
7967 LDKThirtyTwoBytes funding_txid_arg_ref;
7968 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
7969 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
7970 LDKSignature signature_arg_ref;
7971 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7972 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7973 LDKFundingCreated ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
7974 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7978 LDKFundingSigned 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 FundingSigned_free(this_ptr_conv);
7984 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7985 LDKFundingSigned orig_conv;
7986 orig_conv.inner = (void*)(orig & (~1));
7987 orig_conv.is_owned = (orig & 1) || (orig == 0);
7988 LDKFundingSigned ret = FundingSigned_clone(&orig_conv);
7989 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7992 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7993 LDKFundingSigned this_ptr_conv;
7994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7995 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7996 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7997 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
8001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8006 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8007 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8008 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
8011 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8012 LDKFundingSigned this_ptr_conv;
8013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8014 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8015 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8016 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
8020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8021 LDKFundingSigned this_ptr_conv;
8022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8023 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8024 LDKSignature val_ref;
8025 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8026 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8027 FundingSigned_set_signature(&this_ptr_conv, val_ref);
8030 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
8031 LDKThirtyTwoBytes channel_id_arg_ref;
8032 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8033 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8034 LDKSignature signature_arg_ref;
8035 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8036 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8037 LDKFundingSigned ret = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
8038 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8042 LDKFundingLocked this_ptr_conv;
8043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8044 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8045 FundingLocked_free(this_ptr_conv);
8048 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8049 LDKFundingLocked orig_conv;
8050 orig_conv.inner = (void*)(orig & (~1));
8051 orig_conv.is_owned = (orig & 1) || (orig == 0);
8052 LDKFundingLocked ret = FundingLocked_clone(&orig_conv);
8053 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8056 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8057 LDKFundingLocked this_ptr_conv;
8058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8059 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8060 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8061 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
8065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8070 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8071 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8072 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
8075 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8076 LDKFundingLocked this_ptr_conv;
8077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8078 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8079 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8080 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8085 LDKFundingLocked this_ptr_conv;
8086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8087 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8088 LDKPublicKey val_ref;
8089 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8090 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8091 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8094 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
8095 LDKThirtyTwoBytes channel_id_arg_ref;
8096 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8097 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8098 LDKPublicKey next_per_commitment_point_arg_ref;
8099 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8100 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8101 LDKFundingLocked ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
8102 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8106 LDKShutdown this_ptr_conv;
8107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8109 Shutdown_free(this_ptr_conv);
8112 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8113 LDKShutdown orig_conv;
8114 orig_conv.inner = (void*)(orig & (~1));
8115 orig_conv.is_owned = (orig & 1) || (orig == 0);
8116 LDKShutdown ret = Shutdown_clone(&orig_conv);
8117 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8120 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8121 LDKShutdown this_ptr_conv;
8122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8123 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8124 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8125 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
8129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8134 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8135 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8136 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8139 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8140 LDKShutdown this_ptr_conv;
8141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8142 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8143 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8144 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8145 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8150 LDKShutdown this_ptr_conv;
8151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8152 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8153 LDKCVec_u8Z val_ref;
8154 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
8155 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
8156 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8157 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
8160 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
8161 LDKThirtyTwoBytes channel_id_arg_ref;
8162 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8163 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8164 LDKCVec_u8Z scriptpubkey_arg_ref;
8165 scriptpubkey_arg_ref.data = (*_env)->GetByteArrayElements (_env, scriptpubkey_arg, NULL);
8166 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
8167 LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8168 (*_env)->ReleaseByteArrayElements(_env, scriptpubkey_arg, (int8_t*)scriptpubkey_arg_ref.data, 0);
8169 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8173 LDKClosingSigned this_ptr_conv;
8174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8175 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8176 ClosingSigned_free(this_ptr_conv);
8179 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8180 LDKClosingSigned orig_conv;
8181 orig_conv.inner = (void*)(orig & (~1));
8182 orig_conv.is_owned = (orig & 1) || (orig == 0);
8183 LDKClosingSigned ret = ClosingSigned_clone(&orig_conv);
8184 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8187 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8188 LDKClosingSigned this_ptr_conv;
8189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8190 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8191 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8192 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
8196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8201 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8202 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8203 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
8206 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8207 LDKClosingSigned this_ptr_conv;
8208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8209 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8210 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
8214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8215 LDKClosingSigned this_ptr_conv;
8216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8217 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8218 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
8221 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8222 LDKClosingSigned this_ptr_conv;
8223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8224 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8225 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8226 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
8230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKSignature val_ref;
8235 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8236 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8237 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
8240 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) {
8241 LDKThirtyTwoBytes channel_id_arg_ref;
8242 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8243 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8244 LDKSignature signature_arg_ref;
8245 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8246 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8247 LDKClosingSigned ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
8248 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8252 LDKUpdateAddHTLC this_ptr_conv;
8253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8254 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8255 UpdateAddHTLC_free(this_ptr_conv);
8258 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8259 LDKUpdateAddHTLC orig_conv;
8260 orig_conv.inner = (void*)(orig & (~1));
8261 orig_conv.is_owned = (orig & 1) || (orig == 0);
8262 LDKUpdateAddHTLC ret = UpdateAddHTLC_clone(&orig_conv);
8263 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8266 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8267 LDKUpdateAddHTLC this_ptr_conv;
8268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8269 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8270 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8271 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
8275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8280 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8281 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8282 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
8285 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8286 LDKUpdateAddHTLC this_ptr_conv;
8287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8288 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8289 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
8293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8294 LDKUpdateAddHTLC this_ptr_conv;
8295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8296 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8297 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
8300 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8301 LDKUpdateAddHTLC this_ptr_conv;
8302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8303 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8304 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
8308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8309 LDKUpdateAddHTLC this_ptr_conv;
8310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8311 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8312 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
8315 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8316 LDKUpdateAddHTLC this_ptr_conv;
8317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8319 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8320 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
8324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8329 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8330 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8331 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
8334 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
8335 LDKUpdateAddHTLC this_ptr_conv;
8336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8337 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8338 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
8342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8343 LDKUpdateAddHTLC this_ptr_conv;
8344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8345 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8346 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
8349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8350 LDKUpdateFulfillHTLC this_ptr_conv;
8351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8352 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8353 UpdateFulfillHTLC_free(this_ptr_conv);
8356 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8357 LDKUpdateFulfillHTLC orig_conv;
8358 orig_conv.inner = (void*)(orig & (~1));
8359 orig_conv.is_owned = (orig & 1) || (orig == 0);
8360 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_clone(&orig_conv);
8361 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8364 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8365 LDKUpdateFulfillHTLC this_ptr_conv;
8366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8367 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8368 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8369 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
8373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8378 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8379 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8380 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
8383 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8384 LDKUpdateFulfillHTLC this_ptr_conv;
8385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8387 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
8391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8392 LDKUpdateFulfillHTLC this_ptr_conv;
8393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8394 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8395 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
8398 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
8399 LDKUpdateFulfillHTLC this_ptr_conv;
8400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8401 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8402 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8403 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
8407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8412 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8413 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8414 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
8417 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) {
8418 LDKThirtyTwoBytes channel_id_arg_ref;
8419 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8420 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8421 LDKThirtyTwoBytes payment_preimage_arg_ref;
8422 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
8423 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
8424 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
8425 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8429 LDKUpdateFailHTLC this_ptr_conv;
8430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8431 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8432 UpdateFailHTLC_free(this_ptr_conv);
8435 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8436 LDKUpdateFailHTLC orig_conv;
8437 orig_conv.inner = (void*)(orig & (~1));
8438 orig_conv.is_owned = (orig & 1) || (orig == 0);
8439 LDKUpdateFailHTLC ret = UpdateFailHTLC_clone(&orig_conv);
8440 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8443 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8444 LDKUpdateFailHTLC this_ptr_conv;
8445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8446 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8447 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8448 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
8452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8457 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8458 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8459 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
8462 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8463 LDKUpdateFailHTLC this_ptr_conv;
8464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8465 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8466 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
8470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8471 LDKUpdateFailHTLC this_ptr_conv;
8472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8473 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8474 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
8477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8478 LDKUpdateFailMalformedHTLC this_ptr_conv;
8479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8480 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8481 UpdateFailMalformedHTLC_free(this_ptr_conv);
8484 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8485 LDKUpdateFailMalformedHTLC orig_conv;
8486 orig_conv.inner = (void*)(orig & (~1));
8487 orig_conv.is_owned = (orig & 1) || (orig == 0);
8488 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_clone(&orig_conv);
8489 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8492 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8493 LDKUpdateFailMalformedHTLC this_ptr_conv;
8494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8495 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8496 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8497 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
8501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8506 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8507 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8508 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
8511 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8512 LDKUpdateFailMalformedHTLC this_ptr_conv;
8513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8514 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8515 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
8519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8520 LDKUpdateFailMalformedHTLC this_ptr_conv;
8521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8523 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
8526 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
8527 LDKUpdateFailMalformedHTLC this_ptr_conv;
8528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8529 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8530 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
8534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8535 LDKUpdateFailMalformedHTLC this_ptr_conv;
8536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8537 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8538 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
8541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8542 LDKCommitmentSigned this_ptr_conv;
8543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8545 CommitmentSigned_free(this_ptr_conv);
8548 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8549 LDKCommitmentSigned orig_conv;
8550 orig_conv.inner = (void*)(orig & (~1));
8551 orig_conv.is_owned = (orig & 1) || (orig == 0);
8552 LDKCommitmentSigned ret = CommitmentSigned_clone(&orig_conv);
8553 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8556 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8557 LDKCommitmentSigned this_ptr_conv;
8558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8559 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8560 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8561 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
8565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8570 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8571 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8572 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
8575 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8576 LDKCommitmentSigned this_ptr_conv;
8577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8579 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8580 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
8584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8585 LDKCommitmentSigned this_ptr_conv;
8586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8587 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8588 LDKSignature val_ref;
8589 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8590 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8591 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
8594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
8595 LDKCommitmentSigned this_ptr_conv;
8596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8597 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8598 LDKCVec_SignatureZ val_constr;
8599 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
8600 if (val_constr.datalen > 0)
8601 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8603 val_constr.data = NULL;
8604 for (size_t i = 0; i < val_constr.datalen; i++) {
8605 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
8606 LDKSignature arr_conv_8_ref;
8607 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
8608 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
8609 val_constr.data[i] = arr_conv_8_ref;
8611 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
8614 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) {
8615 LDKThirtyTwoBytes channel_id_arg_ref;
8616 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8617 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8618 LDKSignature signature_arg_ref;
8619 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8620 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8621 LDKCVec_SignatureZ htlc_signatures_arg_constr;
8622 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
8623 if (htlc_signatures_arg_constr.datalen > 0)
8624 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8626 htlc_signatures_arg_constr.data = NULL;
8627 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
8628 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
8629 LDKSignature arr_conv_8_ref;
8630 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
8631 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
8632 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
8634 LDKCommitmentSigned ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
8635 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8639 LDKRevokeAndACK this_ptr_conv;
8640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8641 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8642 RevokeAndACK_free(this_ptr_conv);
8645 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8646 LDKRevokeAndACK orig_conv;
8647 orig_conv.inner = (void*)(orig & (~1));
8648 orig_conv.is_owned = (orig & 1) || (orig == 0);
8649 LDKRevokeAndACK ret = RevokeAndACK_clone(&orig_conv);
8650 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8653 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8654 LDKRevokeAndACK this_ptr_conv;
8655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8656 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8657 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8658 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
8662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8667 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8668 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8669 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
8672 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
8673 LDKRevokeAndACK this_ptr_conv;
8674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8675 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8676 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8677 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
8681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8682 LDKRevokeAndACK this_ptr_conv;
8683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8684 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8685 LDKThirtyTwoBytes val_ref;
8686 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8687 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8688 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
8691 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8692 LDKRevokeAndACK this_ptr_conv;
8693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8694 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8695 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8696 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8701 LDKRevokeAndACK this_ptr_conv;
8702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8703 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8704 LDKPublicKey val_ref;
8705 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8706 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8707 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8710 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) {
8711 LDKThirtyTwoBytes channel_id_arg_ref;
8712 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8713 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8714 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
8715 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
8716 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
8717 LDKPublicKey next_per_commitment_point_arg_ref;
8718 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8719 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8720 LDKRevokeAndACK ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
8721 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8725 LDKUpdateFee 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 UpdateFee_free(this_ptr_conv);
8731 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8732 LDKUpdateFee orig_conv;
8733 orig_conv.inner = (void*)(orig & (~1));
8734 orig_conv.is_owned = (orig & 1) || (orig == 0);
8735 LDKUpdateFee ret = UpdateFee_clone(&orig_conv);
8736 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8739 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8740 LDKUpdateFee this_ptr_conv;
8741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8742 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8743 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8744 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
8748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8753 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8754 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8755 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
8758 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
8759 LDKUpdateFee this_ptr_conv;
8760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8761 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8762 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
8766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8767 LDKUpdateFee this_ptr_conv;
8768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8769 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8770 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
8773 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
8774 LDKThirtyTwoBytes channel_id_arg_ref;
8775 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8776 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8777 LDKUpdateFee ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
8778 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8782 LDKDataLossProtect this_ptr_conv;
8783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8784 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8785 DataLossProtect_free(this_ptr_conv);
8788 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8789 LDKDataLossProtect orig_conv;
8790 orig_conv.inner = (void*)(orig & (~1));
8791 orig_conv.is_owned = (orig & 1) || (orig == 0);
8792 LDKDataLossProtect ret = DataLossProtect_clone(&orig_conv);
8793 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8796 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
8797 LDKDataLossProtect this_ptr_conv;
8798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8799 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8800 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8801 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
8805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8810 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8811 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8812 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
8815 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8816 LDKDataLossProtect this_ptr_conv;
8817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8818 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8819 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8820 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
8824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8825 LDKDataLossProtect this_ptr_conv;
8826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8827 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8828 LDKPublicKey val_ref;
8829 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8830 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8831 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
8834 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) {
8835 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
8836 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
8837 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
8838 LDKPublicKey my_current_per_commitment_point_arg_ref;
8839 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
8840 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
8841 LDKDataLossProtect ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
8842 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8846 LDKChannelReestablish this_ptr_conv;
8847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8848 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8849 ChannelReestablish_free(this_ptr_conv);
8852 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8853 LDKChannelReestablish orig_conv;
8854 orig_conv.inner = (void*)(orig & (~1));
8855 orig_conv.is_owned = (orig & 1) || (orig == 0);
8856 LDKChannelReestablish ret = ChannelReestablish_clone(&orig_conv);
8857 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8860 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8861 LDKChannelReestablish this_ptr_conv;
8862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8863 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8864 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8865 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
8869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8874 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8875 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8876 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
8879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8880 LDKChannelReestablish this_ptr_conv;
8881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8882 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8883 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
8887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8888 LDKChannelReestablish this_ptr_conv;
8889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8891 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
8894 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8895 LDKChannelReestablish this_ptr_conv;
8896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8898 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
8902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8903 LDKChannelReestablish this_ptr_conv;
8904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8905 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8906 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
8909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8910 LDKAnnouncementSignatures this_ptr_conv;
8911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8912 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8913 AnnouncementSignatures_free(this_ptr_conv);
8916 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8917 LDKAnnouncementSignatures orig_conv;
8918 orig_conv.inner = (void*)(orig & (~1));
8919 orig_conv.is_owned = (orig & 1) || (orig == 0);
8920 LDKAnnouncementSignatures ret = AnnouncementSignatures_clone(&orig_conv);
8921 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8924 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8925 LDKAnnouncementSignatures this_ptr_conv;
8926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8927 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8928 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8929 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
8933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
8938 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8939 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8940 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
8943 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8944 LDKAnnouncementSignatures this_ptr_conv;
8945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8946 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8947 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
8951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8952 LDKAnnouncementSignatures this_ptr_conv;
8953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8954 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8955 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
8958 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8959 LDKAnnouncementSignatures this_ptr_conv;
8960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8961 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8962 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8963 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
8967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKSignature val_ref;
8972 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8973 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8974 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
8977 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8978 LDKAnnouncementSignatures this_ptr_conv;
8979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8980 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8981 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8982 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
8986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8987 LDKAnnouncementSignatures this_ptr_conv;
8988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8989 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8990 LDKSignature val_ref;
8991 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8992 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8993 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
8996 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) {
8997 LDKThirtyTwoBytes channel_id_arg_ref;
8998 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8999 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9000 LDKSignature node_signature_arg_ref;
9001 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
9002 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
9003 LDKSignature bitcoin_signature_arg_ref;
9004 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
9005 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
9006 LDKAnnouncementSignatures ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
9007 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9011 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
9012 FREE((void*)this_ptr);
9013 NetAddress_free(this_ptr_conv);
9016 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9017 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
9018 LDKNetAddress* ret = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9019 *ret = NetAddress_clone(orig_conv);
9023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9024 LDKUnsignedNodeAnnouncement this_ptr_conv;
9025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9026 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9027 UnsignedNodeAnnouncement_free(this_ptr_conv);
9030 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9031 LDKUnsignedNodeAnnouncement orig_conv;
9032 orig_conv.inner = (void*)(orig & (~1));
9033 orig_conv.is_owned = (orig & 1) || (orig == 0);
9034 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_clone(&orig_conv);
9035 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9038 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9039 LDKUnsignedNodeAnnouncement this_ptr_conv;
9040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9041 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9042 LDKNodeFeatures ret = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9043 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9047 LDKUnsignedNodeAnnouncement this_ptr_conv;
9048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9049 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9050 LDKNodeFeatures val_conv;
9051 val_conv.inner = (void*)(val & (~1));
9052 val_conv.is_owned = (val & 1) || (val == 0);
9053 // Warning: we may need a move here but can't clone!
9054 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9057 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9058 LDKUnsignedNodeAnnouncement this_ptr_conv;
9059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9060 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9061 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9066 LDKUnsignedNodeAnnouncement this_ptr_conv;
9067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9068 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9069 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9072 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9073 LDKUnsignedNodeAnnouncement this_ptr_conv;
9074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9075 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9076 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9077 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
9081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKPublicKey val_ref;
9086 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9087 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9088 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
9091 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
9092 LDKUnsignedNodeAnnouncement this_ptr_conv;
9093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9094 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9095 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
9096 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
9100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9101 LDKUnsignedNodeAnnouncement this_ptr_conv;
9102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9103 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9104 LDKThreeBytes val_ref;
9105 CHECK((*_env)->GetArrayLength (_env, val) == 3);
9106 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
9107 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
9110 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
9111 LDKUnsignedNodeAnnouncement this_ptr_conv;
9112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9113 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9114 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9115 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
9119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9120 LDKUnsignedNodeAnnouncement this_ptr_conv;
9121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9122 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9123 LDKThirtyTwoBytes val_ref;
9124 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9125 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9126 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
9129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9130 LDKUnsignedNodeAnnouncement this_ptr_conv;
9131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9132 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9133 LDKCVec_NetAddressZ val_constr;
9134 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9135 if (val_constr.datalen > 0)
9136 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9138 val_constr.data = NULL;
9139 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9140 for (size_t m = 0; m < val_constr.datalen; m++) {
9141 long arr_conv_12 = val_vals[m];
9142 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9143 FREE((void*)arr_conv_12);
9144 val_constr.data[m] = arr_conv_12_conv;
9146 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9147 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
9150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9151 LDKNodeAnnouncement this_ptr_conv;
9152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9153 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9154 NodeAnnouncement_free(this_ptr_conv);
9157 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9158 LDKNodeAnnouncement orig_conv;
9159 orig_conv.inner = (void*)(orig & (~1));
9160 orig_conv.is_owned = (orig & 1) || (orig == 0);
9161 LDKNodeAnnouncement ret = NodeAnnouncement_clone(&orig_conv);
9162 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9165 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9166 LDKNodeAnnouncement this_ptr_conv;
9167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9168 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9169 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9170 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
9174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKSignature val_ref;
9179 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9180 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9181 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
9184 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9185 LDKNodeAnnouncement this_ptr_conv;
9186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9187 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9188 LDKUnsignedNodeAnnouncement ret = NodeAnnouncement_get_contents(&this_ptr_conv);
9189 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9193 LDKNodeAnnouncement this_ptr_conv;
9194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9195 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9196 LDKUnsignedNodeAnnouncement val_conv;
9197 val_conv.inner = (void*)(val & (~1));
9198 val_conv.is_owned = (val & 1) || (val == 0);
9199 if (val_conv.inner != NULL)
9200 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
9201 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
9204 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9205 LDKSignature signature_arg_ref;
9206 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9207 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9208 LDKUnsignedNodeAnnouncement contents_arg_conv;
9209 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9210 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9211 if (contents_arg_conv.inner != NULL)
9212 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
9213 LDKNodeAnnouncement ret = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
9214 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9218 LDKUnsignedChannelAnnouncement this_ptr_conv;
9219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9220 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9221 UnsignedChannelAnnouncement_free(this_ptr_conv);
9224 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9225 LDKUnsignedChannelAnnouncement orig_conv;
9226 orig_conv.inner = (void*)(orig & (~1));
9227 orig_conv.is_owned = (orig & 1) || (orig == 0);
9228 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_clone(&orig_conv);
9229 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9232 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9233 LDKUnsignedChannelAnnouncement this_ptr_conv;
9234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9235 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9236 LDKChannelFeatures ret = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
9237 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9241 LDKUnsignedChannelAnnouncement this_ptr_conv;
9242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9243 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9244 LDKChannelFeatures val_conv;
9245 val_conv.inner = (void*)(val & (~1));
9246 val_conv.is_owned = (val & 1) || (val == 0);
9247 // Warning: we may need a move here but can't clone!
9248 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
9251 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9252 LDKUnsignedChannelAnnouncement this_ptr_conv;
9253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9254 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9255 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9256 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
9260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9261 LDKUnsignedChannelAnnouncement this_ptr_conv;
9262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9263 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9264 LDKThirtyTwoBytes val_ref;
9265 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9266 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9267 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
9270 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9271 LDKUnsignedChannelAnnouncement this_ptr_conv;
9272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9273 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9274 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
9278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9279 LDKUnsignedChannelAnnouncement this_ptr_conv;
9280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9281 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9282 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
9285 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9286 LDKUnsignedChannelAnnouncement this_ptr_conv;
9287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9288 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9289 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9290 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
9294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKPublicKey val_ref;
9299 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9300 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9301 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
9304 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9305 LDKUnsignedChannelAnnouncement this_ptr_conv;
9306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9308 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9309 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
9313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9314 LDKUnsignedChannelAnnouncement this_ptr_conv;
9315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9316 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9317 LDKPublicKey val_ref;
9318 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9319 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9320 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
9323 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9324 LDKUnsignedChannelAnnouncement this_ptr_conv;
9325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9326 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9327 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9328 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
9332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9333 LDKUnsignedChannelAnnouncement this_ptr_conv;
9334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9335 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9336 LDKPublicKey val_ref;
9337 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9338 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9339 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
9342 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9343 LDKUnsignedChannelAnnouncement this_ptr_conv;
9344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9345 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9346 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9347 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
9351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9352 LDKUnsignedChannelAnnouncement this_ptr_conv;
9353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9354 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9355 LDKPublicKey val_ref;
9356 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9357 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9358 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
9361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9362 LDKChannelAnnouncement this_ptr_conv;
9363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9364 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9365 ChannelAnnouncement_free(this_ptr_conv);
9368 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9369 LDKChannelAnnouncement orig_conv;
9370 orig_conv.inner = (void*)(orig & (~1));
9371 orig_conv.is_owned = (orig & 1) || (orig == 0);
9372 LDKChannelAnnouncement ret = ChannelAnnouncement_clone(&orig_conv);
9373 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9376 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9377 LDKChannelAnnouncement this_ptr_conv;
9378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9379 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9380 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9381 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
9385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKSignature val_ref;
9390 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9391 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9392 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
9395 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9396 LDKChannelAnnouncement this_ptr_conv;
9397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9398 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9399 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9400 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
9404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9405 LDKChannelAnnouncement this_ptr_conv;
9406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9408 LDKSignature val_ref;
9409 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9410 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9411 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
9414 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9415 LDKChannelAnnouncement this_ptr_conv;
9416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9417 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9418 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9419 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
9423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9424 LDKChannelAnnouncement this_ptr_conv;
9425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9426 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9427 LDKSignature val_ref;
9428 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9429 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9430 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
9433 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9434 LDKChannelAnnouncement this_ptr_conv;
9435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9436 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9437 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9438 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
9442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9443 LDKChannelAnnouncement this_ptr_conv;
9444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9445 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9446 LDKSignature val_ref;
9447 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9448 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9449 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
9452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9453 LDKChannelAnnouncement this_ptr_conv;
9454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9455 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9456 LDKUnsignedChannelAnnouncement ret = ChannelAnnouncement_get_contents(&this_ptr_conv);
9457 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9461 LDKChannelAnnouncement this_ptr_conv;
9462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9463 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9464 LDKUnsignedChannelAnnouncement val_conv;
9465 val_conv.inner = (void*)(val & (~1));
9466 val_conv.is_owned = (val & 1) || (val == 0);
9467 if (val_conv.inner != NULL)
9468 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
9469 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
9472 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) {
9473 LDKSignature node_signature_1_arg_ref;
9474 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
9475 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
9476 LDKSignature node_signature_2_arg_ref;
9477 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
9478 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
9479 LDKSignature bitcoin_signature_1_arg_ref;
9480 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
9481 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
9482 LDKSignature bitcoin_signature_2_arg_ref;
9483 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
9484 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
9485 LDKUnsignedChannelAnnouncement contents_arg_conv;
9486 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9487 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9488 if (contents_arg_conv.inner != NULL)
9489 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
9490 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);
9491 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9495 LDKUnsignedChannelUpdate this_ptr_conv;
9496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9497 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9498 UnsignedChannelUpdate_free(this_ptr_conv);
9501 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9502 LDKUnsignedChannelUpdate orig_conv;
9503 orig_conv.inner = (void*)(orig & (~1));
9504 orig_conv.is_owned = (orig & 1) || (orig == 0);
9505 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_clone(&orig_conv);
9506 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9509 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9510 LDKUnsignedChannelUpdate this_ptr_conv;
9511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9512 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9513 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9514 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
9518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
9523 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9524 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9525 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
9528 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9529 LDKUnsignedChannelUpdate this_ptr_conv;
9530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9531 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9532 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
9536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9537 LDKUnsignedChannelUpdate this_ptr_conv;
9538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9539 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9540 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
9543 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9544 LDKUnsignedChannelUpdate this_ptr_conv;
9545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9546 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9547 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
9551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9552 LDKUnsignedChannelUpdate this_ptr_conv;
9553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9554 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9555 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
9558 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
9559 LDKUnsignedChannelUpdate this_ptr_conv;
9560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9561 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9562 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
9566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
9567 LDKUnsignedChannelUpdate this_ptr_conv;
9568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9569 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9570 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
9573 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
9574 LDKUnsignedChannelUpdate this_ptr_conv;
9575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9576 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9577 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
9581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9582 LDKUnsignedChannelUpdate this_ptr_conv;
9583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9585 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
9588 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9589 LDKUnsignedChannelUpdate this_ptr_conv;
9590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9591 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9592 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
9596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9597 LDKUnsignedChannelUpdate this_ptr_conv;
9598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9599 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9600 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
9603 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9604 LDKUnsignedChannelUpdate this_ptr_conv;
9605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9606 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9607 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
9611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9612 LDKUnsignedChannelUpdate this_ptr_conv;
9613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9614 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9615 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
9618 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
9619 LDKUnsignedChannelUpdate this_ptr_conv;
9620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9621 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9622 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
9626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9627 LDKUnsignedChannelUpdate this_ptr_conv;
9628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9629 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9630 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
9633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9634 LDKChannelUpdate this_ptr_conv;
9635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9636 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9637 ChannelUpdate_free(this_ptr_conv);
9640 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9641 LDKChannelUpdate orig_conv;
9642 orig_conv.inner = (void*)(orig & (~1));
9643 orig_conv.is_owned = (orig & 1) || (orig == 0);
9644 LDKChannelUpdate ret = ChannelUpdate_clone(&orig_conv);
9645 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9648 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9649 LDKChannelUpdate this_ptr_conv;
9650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9651 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9652 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9653 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
9657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKSignature val_ref;
9662 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9663 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9664 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
9667 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9668 LDKChannelUpdate this_ptr_conv;
9669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9670 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9671 LDKUnsignedChannelUpdate ret = ChannelUpdate_get_contents(&this_ptr_conv);
9672 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9676 LDKChannelUpdate this_ptr_conv;
9677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9678 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9679 LDKUnsignedChannelUpdate val_conv;
9680 val_conv.inner = (void*)(val & (~1));
9681 val_conv.is_owned = (val & 1) || (val == 0);
9682 if (val_conv.inner != NULL)
9683 val_conv = UnsignedChannelUpdate_clone(&val_conv);
9684 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
9687 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9688 LDKSignature signature_arg_ref;
9689 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9690 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9691 LDKUnsignedChannelUpdate contents_arg_conv;
9692 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9693 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9694 if (contents_arg_conv.inner != NULL)
9695 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
9696 LDKChannelUpdate ret = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
9697 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9701 LDKQueryChannelRange this_ptr_conv;
9702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9703 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9704 QueryChannelRange_free(this_ptr_conv);
9707 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9708 LDKQueryChannelRange orig_conv;
9709 orig_conv.inner = (void*)(orig & (~1));
9710 orig_conv.is_owned = (orig & 1) || (orig == 0);
9711 LDKQueryChannelRange ret = QueryChannelRange_clone(&orig_conv);
9712 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9715 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9716 LDKQueryChannelRange this_ptr_conv;
9717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9718 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9719 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9720 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
9724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
9729 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9730 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9731 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9734 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9735 LDKQueryChannelRange this_ptr_conv;
9736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9738 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
9742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9743 LDKQueryChannelRange this_ptr_conv;
9744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9745 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9746 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
9749 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9750 LDKQueryChannelRange this_ptr_conv;
9751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9752 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9753 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
9757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9758 LDKQueryChannelRange this_ptr_conv;
9759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9760 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9761 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9764 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) {
9765 LDKThirtyTwoBytes chain_hash_arg_ref;
9766 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9767 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9768 LDKQueryChannelRange ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
9769 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9773 LDKReplyChannelRange this_ptr_conv;
9774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9776 ReplyChannelRange_free(this_ptr_conv);
9779 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9780 LDKReplyChannelRange orig_conv;
9781 orig_conv.inner = (void*)(orig & (~1));
9782 orig_conv.is_owned = (orig & 1) || (orig == 0);
9783 LDKReplyChannelRange ret = ReplyChannelRange_clone(&orig_conv);
9784 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9787 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9788 LDKReplyChannelRange this_ptr_conv;
9789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9790 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9791 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9792 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
9796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
9801 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9802 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9803 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9806 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9807 LDKReplyChannelRange this_ptr_conv;
9808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9809 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9810 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
9814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9815 LDKReplyChannelRange this_ptr_conv;
9816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9817 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9818 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
9821 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9822 LDKReplyChannelRange this_ptr_conv;
9823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9824 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9825 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
9829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9830 LDKReplyChannelRange this_ptr_conv;
9831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9832 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9833 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9836 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9837 LDKReplyChannelRange this_ptr_conv;
9838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9839 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9840 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
9844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9845 LDKReplyChannelRange this_ptr_conv;
9846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9847 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9848 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
9851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9852 LDKReplyChannelRange this_ptr_conv;
9853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9854 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9855 LDKCVec_u64Z val_constr;
9856 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9857 if (val_constr.datalen > 0)
9858 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9860 val_constr.data = NULL;
9861 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9862 for (size_t g = 0; g < val_constr.datalen; g++) {
9863 long arr_conv_6 = val_vals[g];
9864 val_constr.data[g] = arr_conv_6;
9866 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9867 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
9870 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) {
9871 LDKThirtyTwoBytes chain_hash_arg_ref;
9872 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9873 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9874 LDKCVec_u64Z short_channel_ids_arg_constr;
9875 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
9876 if (short_channel_ids_arg_constr.datalen > 0)
9877 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9879 short_channel_ids_arg_constr.data = NULL;
9880 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
9881 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
9882 long arr_conv_6 = short_channel_ids_arg_vals[g];
9883 short_channel_ids_arg_constr.data[g] = arr_conv_6;
9885 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
9886 LDKReplyChannelRange ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
9887 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9891 LDKQueryShortChannelIds this_ptr_conv;
9892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9893 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9894 QueryShortChannelIds_free(this_ptr_conv);
9897 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9898 LDKQueryShortChannelIds orig_conv;
9899 orig_conv.inner = (void*)(orig & (~1));
9900 orig_conv.is_owned = (orig & 1) || (orig == 0);
9901 LDKQueryShortChannelIds ret = QueryShortChannelIds_clone(&orig_conv);
9902 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9905 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9906 LDKQueryShortChannelIds this_ptr_conv;
9907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9908 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9909 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9910 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
9914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
9919 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9920 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9921 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
9924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9925 LDKQueryShortChannelIds this_ptr_conv;
9926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9927 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9928 LDKCVec_u64Z val_constr;
9929 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9930 if (val_constr.datalen > 0)
9931 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9933 val_constr.data = NULL;
9934 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9935 for (size_t g = 0; g < val_constr.datalen; g++) {
9936 long arr_conv_6 = val_vals[g];
9937 val_constr.data[g] = arr_conv_6;
9939 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9940 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
9943 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
9944 LDKThirtyTwoBytes chain_hash_arg_ref;
9945 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9946 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9947 LDKCVec_u64Z short_channel_ids_arg_constr;
9948 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
9949 if (short_channel_ids_arg_constr.datalen > 0)
9950 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9952 short_channel_ids_arg_constr.data = NULL;
9953 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
9954 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
9955 long arr_conv_6 = short_channel_ids_arg_vals[g];
9956 short_channel_ids_arg_constr.data[g] = arr_conv_6;
9958 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
9959 LDKQueryShortChannelIds ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
9960 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9964 LDKReplyShortChannelIdsEnd this_ptr_conv;
9965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9966 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9967 ReplyShortChannelIdsEnd_free(this_ptr_conv);
9970 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9971 LDKReplyShortChannelIdsEnd orig_conv;
9972 orig_conv.inner = (void*)(orig & (~1));
9973 orig_conv.is_owned = (orig & 1) || (orig == 0);
9974 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_clone(&orig_conv);
9975 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9978 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9979 LDKReplyShortChannelIdsEnd this_ptr_conv;
9980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9981 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9982 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9983 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
9987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
9992 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9993 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9994 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
9997 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9998 LDKReplyShortChannelIdsEnd this_ptr_conv;
9999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10000 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10001 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
10005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10006 LDKReplyShortChannelIdsEnd this_ptr_conv;
10007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10008 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10009 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
10012 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
10013 LDKThirtyTwoBytes chain_hash_arg_ref;
10014 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10015 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10016 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
10017 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10021 LDKGossipTimestampFilter this_ptr_conv;
10022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10023 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10024 GossipTimestampFilter_free(this_ptr_conv);
10027 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10028 LDKGossipTimestampFilter orig_conv;
10029 orig_conv.inner = (void*)(orig & (~1));
10030 orig_conv.is_owned = (orig & 1) || (orig == 0);
10031 LDKGossipTimestampFilter ret = GossipTimestampFilter_clone(&orig_conv);
10032 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10035 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10036 LDKGossipTimestampFilter this_ptr_conv;
10037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10038 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10039 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10040 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
10044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
10049 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10050 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10051 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
10054 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10055 LDKGossipTimestampFilter this_ptr_conv;
10056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10057 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10058 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
10062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10063 LDKGossipTimestampFilter this_ptr_conv;
10064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10066 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
10069 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
10070 LDKGossipTimestampFilter this_ptr_conv;
10071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10072 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10073 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
10077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10078 LDKGossipTimestampFilter this_ptr_conv;
10079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10080 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10081 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
10084 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) {
10085 LDKThirtyTwoBytes chain_hash_arg_ref;
10086 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10087 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10088 LDKGossipTimestampFilter ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
10089 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10093 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
10094 FREE((void*)this_ptr);
10095 ErrorAction_free(this_ptr_conv);
10098 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10099 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
10100 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10101 *ret = ErrorAction_clone(orig_conv);
10105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10106 LDKLightningError this_ptr_conv;
10107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10109 LightningError_free(this_ptr_conv);
10112 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
10113 LDKLightningError this_ptr_conv;
10114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10115 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10116 LDKStr _str = LightningError_get_err(&this_ptr_conv);
10117 char* _buf = MALLOC(_str.len + 1, "str conv buf");
10118 memcpy(_buf, _str.chars, _str.len);
10119 _buf[_str.len] = 0;
10120 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
10125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10126 LDKLightningError this_ptr_conv;
10127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10128 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10129 LDKCVec_u8Z val_ref;
10130 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
10131 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
10132 LightningError_set_err(&this_ptr_conv, val_ref);
10133 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
10136 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(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 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10141 *ret = LightningError_get_action(&this_ptr_conv);
10145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10146 LDKLightningError this_ptr_conv;
10147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10148 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10149 LDKErrorAction val_conv = *(LDKErrorAction*)val;
10151 LightningError_set_action(&this_ptr_conv, val_conv);
10154 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
10155 LDKCVec_u8Z err_arg_ref;
10156 err_arg_ref.data = (*_env)->GetByteArrayElements (_env, err_arg, NULL);
10157 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
10158 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
10159 FREE((void*)action_arg);
10160 LDKLightningError ret = LightningError_new(err_arg_ref, action_arg_conv);
10161 (*_env)->ReleaseByteArrayElements(_env, err_arg, (int8_t*)err_arg_ref.data, 0);
10162 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10166 LDKCommitmentUpdate this_ptr_conv;
10167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10168 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10169 CommitmentUpdate_free(this_ptr_conv);
10172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10173 LDKCommitmentUpdate orig_conv;
10174 orig_conv.inner = (void*)(orig & (~1));
10175 orig_conv.is_owned = (orig & 1) || (orig == 0);
10176 LDKCommitmentUpdate ret = CommitmentUpdate_clone(&orig_conv);
10177 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10181 LDKCommitmentUpdate this_ptr_conv;
10182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10183 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10184 LDKCVec_UpdateAddHTLCZ val_constr;
10185 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10186 if (val_constr.datalen > 0)
10187 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10189 val_constr.data = NULL;
10190 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10191 for (size_t p = 0; p < val_constr.datalen; p++) {
10192 long arr_conv_15 = val_vals[p];
10193 LDKUpdateAddHTLC arr_conv_15_conv;
10194 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10195 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10196 if (arr_conv_15_conv.inner != NULL)
10197 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10198 val_constr.data[p] = arr_conv_15_conv;
10200 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10201 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
10204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_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_UpdateFulfillHTLCZ 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(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10213 val_constr.data = NULL;
10214 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10215 for (size_t t = 0; t < val_constr.datalen; t++) {
10216 long arr_conv_19 = val_vals[t];
10217 LDKUpdateFulfillHTLC arr_conv_19_conv;
10218 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10219 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10220 if (arr_conv_19_conv.inner != NULL)
10221 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10222 val_constr.data[t] = arr_conv_19_conv;
10224 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10225 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
10228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_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_UpdateFailHTLCZ 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(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10237 val_constr.data = NULL;
10238 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10239 for (size_t q = 0; q < val_constr.datalen; q++) {
10240 long arr_conv_16 = val_vals[q];
10241 LDKUpdateFailHTLC arr_conv_16_conv;
10242 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10243 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10244 if (arr_conv_16_conv.inner != NULL)
10245 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
10246 val_constr.data[q] = arr_conv_16_conv;
10248 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10249 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
10252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_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_UpdateFailMalformedHTLCZ 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(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10261 val_constr.data = NULL;
10262 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10263 for (size_t z = 0; z < val_constr.datalen; z++) {
10264 long arr_conv_25 = val_vals[z];
10265 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
10266 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
10267 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
10268 if (arr_conv_25_conv.inner != NULL)
10269 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
10270 val_constr.data[z] = arr_conv_25_conv;
10272 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10273 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
10276 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 LDKUpdateFee ret = CommitmentUpdate_get_update_fee(&this_ptr_conv);
10281 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10285 LDKCommitmentUpdate this_ptr_conv;
10286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10288 LDKUpdateFee val_conv;
10289 val_conv.inner = (void*)(val & (~1));
10290 val_conv.is_owned = (val & 1) || (val == 0);
10291 if (val_conv.inner != NULL)
10292 val_conv = UpdateFee_clone(&val_conv);
10293 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
10296 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
10297 LDKCommitmentUpdate this_ptr_conv;
10298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10299 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10300 LDKCommitmentSigned ret = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
10301 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10305 LDKCommitmentUpdate this_ptr_conv;
10306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10308 LDKCommitmentSigned val_conv;
10309 val_conv.inner = (void*)(val & (~1));
10310 val_conv.is_owned = (val & 1) || (val == 0);
10311 if (val_conv.inner != NULL)
10312 val_conv = CommitmentSigned_clone(&val_conv);
10313 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
10316 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) {
10317 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
10318 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
10319 if (update_add_htlcs_arg_constr.datalen > 0)
10320 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10322 update_add_htlcs_arg_constr.data = NULL;
10323 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
10324 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
10325 long arr_conv_15 = update_add_htlcs_arg_vals[p];
10326 LDKUpdateAddHTLC arr_conv_15_conv;
10327 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10328 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10329 if (arr_conv_15_conv.inner != NULL)
10330 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10331 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
10333 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
10334 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
10335 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
10336 if (update_fulfill_htlcs_arg_constr.datalen > 0)
10337 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10339 update_fulfill_htlcs_arg_constr.data = NULL;
10340 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
10341 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
10342 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
10343 LDKUpdateFulfillHTLC arr_conv_19_conv;
10344 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10345 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10346 if (arr_conv_19_conv.inner != NULL)
10347 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10348 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
10350 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
10351 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
10352 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
10353 if (update_fail_htlcs_arg_constr.datalen > 0)
10354 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10356 update_fail_htlcs_arg_constr.data = NULL;
10357 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
10358 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
10359 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
10360 LDKUpdateFailHTLC arr_conv_16_conv;
10361 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10362 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10363 if (arr_conv_16_conv.inner != NULL)
10364 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
10365 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
10367 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
10368 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
10369 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
10370 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
10371 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10373 update_fail_malformed_htlcs_arg_constr.data = NULL;
10374 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
10375 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
10376 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
10377 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
10378 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
10379 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
10380 if (arr_conv_25_conv.inner != NULL)
10381 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
10382 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
10384 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
10385 LDKUpdateFee update_fee_arg_conv;
10386 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
10387 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
10388 if (update_fee_arg_conv.inner != NULL)
10389 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
10390 LDKCommitmentSigned commitment_signed_arg_conv;
10391 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
10392 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
10393 if (commitment_signed_arg_conv.inner != NULL)
10394 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
10395 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);
10396 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10400 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
10401 FREE((void*)this_ptr);
10402 HTLCFailChannelUpdate_free(this_ptr_conv);
10405 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10406 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
10407 LDKHTLCFailChannelUpdate* ret = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
10408 *ret = HTLCFailChannelUpdate_clone(orig_conv);
10412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10413 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
10414 FREE((void*)this_ptr);
10415 ChannelMessageHandler_free(this_ptr_conv);
10418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10419 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
10420 FREE((void*)this_ptr);
10421 RoutingMessageHandler_free(this_ptr_conv);
10424 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
10425 LDKAcceptChannel obj_conv;
10426 obj_conv.inner = (void*)(obj & (~1));
10427 obj_conv.is_owned = (obj & 1) || (obj == 0);
10428 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
10429 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10430 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10431 CVec_u8Z_free(arg_var);
10435 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10436 LDKu8slice ser_ref;
10437 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10438 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10439 LDKAcceptChannel ret = AcceptChannel_read(ser_ref);
10440 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10441 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10444 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
10445 LDKAnnouncementSignatures obj_conv;
10446 obj_conv.inner = (void*)(obj & (~1));
10447 obj_conv.is_owned = (obj & 1) || (obj == 0);
10448 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
10449 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10450 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10451 CVec_u8Z_free(arg_var);
10455 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10456 LDKu8slice ser_ref;
10457 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10458 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10459 LDKAnnouncementSignatures ret = AnnouncementSignatures_read(ser_ref);
10460 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10461 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10464 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
10465 LDKChannelReestablish obj_conv;
10466 obj_conv.inner = (void*)(obj & (~1));
10467 obj_conv.is_owned = (obj & 1) || (obj == 0);
10468 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
10469 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10470 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10471 CVec_u8Z_free(arg_var);
10475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10476 LDKu8slice ser_ref;
10477 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10478 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10479 LDKChannelReestablish ret = ChannelReestablish_read(ser_ref);
10480 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10481 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10484 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10485 LDKClosingSigned obj_conv;
10486 obj_conv.inner = (void*)(obj & (~1));
10487 obj_conv.is_owned = (obj & 1) || (obj == 0);
10488 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
10489 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10490 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10491 CVec_u8Z_free(arg_var);
10495 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10496 LDKu8slice ser_ref;
10497 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10498 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10499 LDKClosingSigned ret = ClosingSigned_read(ser_ref);
10500 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10501 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10504 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10505 LDKCommitmentSigned obj_conv;
10506 obj_conv.inner = (void*)(obj & (~1));
10507 obj_conv.is_owned = (obj & 1) || (obj == 0);
10508 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
10509 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10510 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10511 CVec_u8Z_free(arg_var);
10515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10516 LDKu8slice ser_ref;
10517 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10518 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10519 LDKCommitmentSigned ret = CommitmentSigned_read(ser_ref);
10520 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10521 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10524 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
10525 LDKFundingCreated obj_conv;
10526 obj_conv.inner = (void*)(obj & (~1));
10527 obj_conv.is_owned = (obj & 1) || (obj == 0);
10528 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
10529 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10530 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10531 CVec_u8Z_free(arg_var);
10535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10536 LDKu8slice ser_ref;
10537 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10538 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10539 LDKFundingCreated ret = FundingCreated_read(ser_ref);
10540 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10541 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10544 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10545 LDKFundingSigned obj_conv;
10546 obj_conv.inner = (void*)(obj & (~1));
10547 obj_conv.is_owned = (obj & 1) || (obj == 0);
10548 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
10549 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10550 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10551 CVec_u8Z_free(arg_var);
10555 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10556 LDKu8slice ser_ref;
10557 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10558 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10559 LDKFundingSigned ret = FundingSigned_read(ser_ref);
10560 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10561 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10564 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
10565 LDKFundingLocked obj_conv;
10566 obj_conv.inner = (void*)(obj & (~1));
10567 obj_conv.is_owned = (obj & 1) || (obj == 0);
10568 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
10569 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10570 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10571 CVec_u8Z_free(arg_var);
10575 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10576 LDKu8slice ser_ref;
10577 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10578 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10579 LDKFundingLocked ret = FundingLocked_read(ser_ref);
10580 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10581 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10584 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
10586 obj_conv.inner = (void*)(obj & (~1));
10587 obj_conv.is_owned = (obj & 1) || (obj == 0);
10588 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
10589 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10590 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10591 CVec_u8Z_free(arg_var);
10595 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10596 LDKu8slice ser_ref;
10597 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10598 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10599 LDKInit ret = Init_read(ser_ref);
10600 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10601 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10604 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
10605 LDKOpenChannel obj_conv;
10606 obj_conv.inner = (void*)(obj & (~1));
10607 obj_conv.is_owned = (obj & 1) || (obj == 0);
10608 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
10609 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10610 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10611 CVec_u8Z_free(arg_var);
10615 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10616 LDKu8slice ser_ref;
10617 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10618 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10619 LDKOpenChannel ret = OpenChannel_read(ser_ref);
10620 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10621 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10624 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
10625 LDKRevokeAndACK obj_conv;
10626 obj_conv.inner = (void*)(obj & (~1));
10627 obj_conv.is_owned = (obj & 1) || (obj == 0);
10628 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
10629 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10630 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10631 CVec_u8Z_free(arg_var);
10635 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10636 LDKu8slice ser_ref;
10637 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10638 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10639 LDKRevokeAndACK ret = RevokeAndACK_read(ser_ref);
10640 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10641 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10644 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
10645 LDKShutdown obj_conv;
10646 obj_conv.inner = (void*)(obj & (~1));
10647 obj_conv.is_owned = (obj & 1) || (obj == 0);
10648 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
10649 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10650 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10651 CVec_u8Z_free(arg_var);
10655 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10656 LDKu8slice ser_ref;
10657 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10658 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10659 LDKShutdown ret = Shutdown_read(ser_ref);
10660 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10661 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10664 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10665 LDKUpdateFailHTLC obj_conv;
10666 obj_conv.inner = (void*)(obj & (~1));
10667 obj_conv.is_owned = (obj & 1) || (obj == 0);
10668 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
10669 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10670 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10671 CVec_u8Z_free(arg_var);
10675 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10676 LDKu8slice ser_ref;
10677 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10678 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10679 LDKUpdateFailHTLC ret = UpdateFailHTLC_read(ser_ref);
10680 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10681 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10684 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10685 LDKUpdateFailMalformedHTLC obj_conv;
10686 obj_conv.inner = (void*)(obj & (~1));
10687 obj_conv.is_owned = (obj & 1) || (obj == 0);
10688 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
10689 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10690 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10691 CVec_u8Z_free(arg_var);
10695 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10696 LDKu8slice ser_ref;
10697 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10698 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10699 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_read(ser_ref);
10700 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10701 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10704 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
10705 LDKUpdateFee obj_conv;
10706 obj_conv.inner = (void*)(obj & (~1));
10707 obj_conv.is_owned = (obj & 1) || (obj == 0);
10708 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
10709 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10710 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10711 CVec_u8Z_free(arg_var);
10715 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10716 LDKu8slice ser_ref;
10717 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10718 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10719 LDKUpdateFee ret = UpdateFee_read(ser_ref);
10720 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10721 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10724 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10725 LDKUpdateFulfillHTLC obj_conv;
10726 obj_conv.inner = (void*)(obj & (~1));
10727 obj_conv.is_owned = (obj & 1) || (obj == 0);
10728 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
10729 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10730 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10731 CVec_u8Z_free(arg_var);
10735 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10736 LDKu8slice ser_ref;
10737 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10738 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10739 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_read(ser_ref);
10740 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10741 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10744 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10745 LDKUpdateAddHTLC obj_conv;
10746 obj_conv.inner = (void*)(obj & (~1));
10747 obj_conv.is_owned = (obj & 1) || (obj == 0);
10748 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
10749 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10750 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10751 CVec_u8Z_free(arg_var);
10755 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10756 LDKu8slice ser_ref;
10757 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10758 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10759 LDKUpdateAddHTLC ret = UpdateAddHTLC_read(ser_ref);
10760 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10761 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10764 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
10766 obj_conv.inner = (void*)(obj & (~1));
10767 obj_conv.is_owned = (obj & 1) || (obj == 0);
10768 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
10769 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10770 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10771 CVec_u8Z_free(arg_var);
10775 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10776 LDKu8slice ser_ref;
10777 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10778 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10779 LDKPing ret = Ping_read(ser_ref);
10780 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10781 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10784 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
10786 obj_conv.inner = (void*)(obj & (~1));
10787 obj_conv.is_owned = (obj & 1) || (obj == 0);
10788 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
10789 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10790 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10791 CVec_u8Z_free(arg_var);
10795 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10796 LDKu8slice ser_ref;
10797 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10798 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10799 LDKPong ret = Pong_read(ser_ref);
10800 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10801 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10804 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10805 LDKUnsignedChannelAnnouncement obj_conv;
10806 obj_conv.inner = (void*)(obj & (~1));
10807 obj_conv.is_owned = (obj & 1) || (obj == 0);
10808 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
10809 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10810 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10811 CVec_u8Z_free(arg_var);
10815 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10816 LDKu8slice ser_ref;
10817 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10818 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10819 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_read(ser_ref);
10820 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10821 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10824 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10825 LDKChannelAnnouncement obj_conv;
10826 obj_conv.inner = (void*)(obj & (~1));
10827 obj_conv.is_owned = (obj & 1) || (obj == 0);
10828 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
10829 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10830 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10831 CVec_u8Z_free(arg_var);
10835 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10836 LDKu8slice ser_ref;
10837 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10838 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10839 LDKChannelAnnouncement ret = ChannelAnnouncement_read(ser_ref);
10840 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10841 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10844 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
10845 LDKUnsignedChannelUpdate obj_conv;
10846 obj_conv.inner = (void*)(obj & (~1));
10847 obj_conv.is_owned = (obj & 1) || (obj == 0);
10848 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
10849 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10850 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10851 CVec_u8Z_free(arg_var);
10855 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10856 LDKu8slice ser_ref;
10857 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10858 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10859 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_read(ser_ref);
10860 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10861 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10864 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
10865 LDKChannelUpdate obj_conv;
10866 obj_conv.inner = (void*)(obj & (~1));
10867 obj_conv.is_owned = (obj & 1) || (obj == 0);
10868 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
10869 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10870 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10871 CVec_u8Z_free(arg_var);
10875 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10876 LDKu8slice ser_ref;
10877 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10878 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10879 LDKChannelUpdate ret = ChannelUpdate_read(ser_ref);
10880 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10881 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10884 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
10885 LDKErrorMessage obj_conv;
10886 obj_conv.inner = (void*)(obj & (~1));
10887 obj_conv.is_owned = (obj & 1) || (obj == 0);
10888 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
10889 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10890 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10891 CVec_u8Z_free(arg_var);
10895 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10896 LDKu8slice ser_ref;
10897 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10898 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10899 LDKErrorMessage ret = ErrorMessage_read(ser_ref);
10900 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10901 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10904 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10905 LDKUnsignedNodeAnnouncement obj_conv;
10906 obj_conv.inner = (void*)(obj & (~1));
10907 obj_conv.is_owned = (obj & 1) || (obj == 0);
10908 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
10909 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10910 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10911 CVec_u8Z_free(arg_var);
10915 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10916 LDKu8slice ser_ref;
10917 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10918 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10919 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_read(ser_ref);
10920 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10921 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10924 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10925 LDKNodeAnnouncement obj_conv;
10926 obj_conv.inner = (void*)(obj & (~1));
10927 obj_conv.is_owned = (obj & 1) || (obj == 0);
10928 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
10929 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10930 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10931 CVec_u8Z_free(arg_var);
10935 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10936 LDKu8slice ser_ref;
10937 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10938 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10939 LDKNodeAnnouncement ret = NodeAnnouncement_read(ser_ref);
10940 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10941 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10944 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10945 LDKu8slice ser_ref;
10946 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10947 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10948 LDKQueryShortChannelIds ret = QueryShortChannelIds_read(ser_ref);
10949 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10950 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10953 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
10954 LDKQueryShortChannelIds obj_conv;
10955 obj_conv.inner = (void*)(obj & (~1));
10956 obj_conv.is_owned = (obj & 1) || (obj == 0);
10957 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
10958 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10959 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10960 CVec_u8Z_free(arg_var);
10964 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10965 LDKu8slice ser_ref;
10966 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10967 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10968 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_read(ser_ref);
10969 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10970 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10973 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
10974 LDKReplyShortChannelIdsEnd obj_conv;
10975 obj_conv.inner = (void*)(obj & (~1));
10976 obj_conv.is_owned = (obj & 1) || (obj == 0);
10977 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
10978 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10979 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10980 CVec_u8Z_free(arg_var);
10984 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10985 LDKu8slice ser_ref;
10986 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10987 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10988 LDKQueryChannelRange ret = QueryChannelRange_read(ser_ref);
10989 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10990 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10993 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
10994 LDKQueryChannelRange obj_conv;
10995 obj_conv.inner = (void*)(obj & (~1));
10996 obj_conv.is_owned = (obj & 1) || (obj == 0);
10997 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
10998 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10999 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11000 CVec_u8Z_free(arg_var);
11004 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11005 LDKu8slice ser_ref;
11006 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11007 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11008 LDKReplyChannelRange ret = ReplyChannelRange_read(ser_ref);
11009 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11010 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11013 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
11014 LDKReplyChannelRange obj_conv;
11015 obj_conv.inner = (void*)(obj & (~1));
11016 obj_conv.is_owned = (obj & 1) || (obj == 0);
11017 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
11018 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11019 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11020 CVec_u8Z_free(arg_var);
11024 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11025 LDKu8slice ser_ref;
11026 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11027 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11028 LDKGossipTimestampFilter ret = GossipTimestampFilter_read(ser_ref);
11029 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11030 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11033 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
11034 LDKGossipTimestampFilter obj_conv;
11035 obj_conv.inner = (void*)(obj & (~1));
11036 obj_conv.is_owned = (obj & 1) || (obj == 0);
11037 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
11038 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11039 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11040 CVec_u8Z_free(arg_var);
11044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11045 LDKMessageHandler this_ptr_conv;
11046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11047 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11048 MessageHandler_free(this_ptr_conv);
11051 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
11052 LDKMessageHandler this_ptr_conv;
11053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11054 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11055 long ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
11059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11060 LDKMessageHandler this_ptr_conv;
11061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11062 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11063 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
11064 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
11065 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11066 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
11068 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
11071 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
11072 LDKMessageHandler this_ptr_conv;
11073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11074 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11075 long ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
11079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11080 LDKMessageHandler this_ptr_conv;
11081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11082 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11083 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
11084 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
11085 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11086 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
11088 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
11091 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
11092 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
11093 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
11094 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11095 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
11097 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
11098 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
11099 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11100 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
11102 LDKMessageHandler ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
11103 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11107 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
11108 FREE((void*)this_ptr);
11109 SocketDescriptor_free(this_ptr_conv);
11112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11113 LDKPeerHandleError this_ptr_conv;
11114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11115 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11116 PeerHandleError_free(this_ptr_conv);
11119 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
11120 LDKPeerHandleError this_ptr_conv;
11121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11122 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11123 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
11127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11128 LDKPeerHandleError this_ptr_conv;
11129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11130 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11131 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
11134 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
11135 LDKPeerHandleError ret = PeerHandleError_new(no_connection_possible_arg);
11136 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11140 LDKPeerManager this_ptr_conv;
11141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11142 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11143 PeerManager_free(this_ptr_conv);
11146 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) {
11147 LDKMessageHandler message_handler_conv;
11148 message_handler_conv.inner = (void*)(message_handler & (~1));
11149 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
11150 // Warning: we may need a move here but can't clone!
11151 LDKSecretKey our_node_secret_ref;
11152 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
11153 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
11154 unsigned char ephemeral_random_data_arr[32];
11155 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
11156 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
11157 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
11158 LDKLogger logger_conv = *(LDKLogger*)logger;
11159 if (logger_conv.free == LDKLogger_JCalls_free) {
11160 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11161 LDKLogger_JCalls_clone(logger_conv.this_arg);
11163 LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
11164 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11167 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
11168 LDKPeerManager this_arg_conv;
11169 this_arg_conv.inner = (void*)(this_arg & (~1));
11170 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11171 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
11172 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, NULL, NULL);
11173 for (size_t i = 0; i < ret_var.datalen; i++) {
11174 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
11175 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
11176 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
11178 CVec_PublicKeyZ_free(ret_var);
11182 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) {
11183 LDKPeerManager this_arg_conv;
11184 this_arg_conv.inner = (void*)(this_arg & (~1));
11185 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11186 LDKPublicKey their_node_id_ref;
11187 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
11188 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11189 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
11190 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
11191 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11192 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
11194 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11195 *ret = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
11199 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
11200 LDKPeerManager this_arg_conv;
11201 this_arg_conv.inner = (void*)(this_arg & (~1));
11202 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11203 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
11204 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
11205 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11206 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
11208 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11209 *ret = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
11213 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
11214 LDKPeerManager this_arg_conv;
11215 this_arg_conv.inner = (void*)(this_arg & (~1));
11216 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11217 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
11218 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11219 *ret = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
11223 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
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* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
11228 LDKu8slice data_ref;
11229 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
11230 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
11231 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11232 *ret = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
11233 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
11237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
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 PeerManager_process_events(&this_arg_conv);
11244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
11245 LDKPeerManager this_arg_conv;
11246 this_arg_conv.inner = (void*)(this_arg & (~1));
11247 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11248 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
11249 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
11252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
11253 LDKPeerManager this_arg_conv;
11254 this_arg_conv.inner = (void*)(this_arg & (~1));
11255 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11256 PeerManager_timer_tick_occured(&this_arg_conv);
11259 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
11260 unsigned char commitment_seed_arr[32];
11261 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
11262 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
11263 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
11264 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
11265 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
11269 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
11270 LDKPublicKey per_commitment_point_ref;
11271 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11272 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11273 unsigned char base_secret_arr[32];
11274 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
11275 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
11276 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
11277 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
11278 *ret = derive_private_key(per_commitment_point_ref, base_secret_ref);
11282 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
11283 LDKPublicKey per_commitment_point_ref;
11284 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11285 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11286 LDKPublicKey base_point_ref;
11287 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
11288 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
11289 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
11290 *ret = derive_public_key(per_commitment_point_ref, base_point_ref);
11294 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) {
11295 unsigned char per_commitment_secret_arr[32];
11296 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
11297 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
11298 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
11299 unsigned char countersignatory_revocation_base_secret_arr[32];
11300 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
11301 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
11302 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
11303 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
11304 *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
11308 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) {
11309 LDKPublicKey per_commitment_point_ref;
11310 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11311 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11312 LDKPublicKey countersignatory_revocation_base_point_ref;
11313 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
11314 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
11315 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
11316 *ret = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
11320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11321 LDKTxCreationKeys this_ptr_conv;
11322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11323 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11324 TxCreationKeys_free(this_ptr_conv);
11327 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11328 LDKTxCreationKeys orig_conv;
11329 orig_conv.inner = (void*)(orig & (~1));
11330 orig_conv.is_owned = (orig & 1) || (orig == 0);
11331 LDKTxCreationKeys ret = TxCreationKeys_clone(&orig_conv);
11332 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11335 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
11336 LDKTxCreationKeys this_ptr_conv;
11337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11339 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11340 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
11344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKPublicKey val_ref;
11349 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11350 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11351 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
11354 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11355 LDKTxCreationKeys this_ptr_conv;
11356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11357 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11358 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11359 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
11363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11364 LDKTxCreationKeys this_ptr_conv;
11365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11366 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11367 LDKPublicKey val_ref;
11368 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11369 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11370 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
11373 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11374 LDKTxCreationKeys this_ptr_conv;
11375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11376 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11377 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11378 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
11382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11383 LDKTxCreationKeys this_ptr_conv;
11384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11385 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11386 LDKPublicKey val_ref;
11387 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11388 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11389 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
11392 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11393 LDKTxCreationKeys this_ptr_conv;
11394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11395 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11396 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11397 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
11401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11402 LDKTxCreationKeys this_ptr_conv;
11403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11404 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11405 LDKPublicKey val_ref;
11406 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11407 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11408 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
11411 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11412 LDKTxCreationKeys this_ptr_conv;
11413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11414 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11415 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11416 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
11420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11421 LDKTxCreationKeys this_ptr_conv;
11422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11423 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11424 LDKPublicKey val_ref;
11425 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11426 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11427 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
11430 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) {
11431 LDKPublicKey per_commitment_point_arg_ref;
11432 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
11433 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
11434 LDKPublicKey revocation_key_arg_ref;
11435 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
11436 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
11437 LDKPublicKey broadcaster_htlc_key_arg_ref;
11438 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
11439 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
11440 LDKPublicKey countersignatory_htlc_key_arg_ref;
11441 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
11442 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
11443 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
11444 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
11445 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
11446 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);
11447 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11450 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
11451 LDKTxCreationKeys obj_conv;
11452 obj_conv.inner = (void*)(obj & (~1));
11453 obj_conv.is_owned = (obj & 1) || (obj == 0);
11454 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
11455 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11456 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11457 CVec_u8Z_free(arg_var);
11461 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11462 LDKu8slice ser_ref;
11463 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11464 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11465 LDKTxCreationKeys ret = TxCreationKeys_read(ser_ref);
11466 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11467 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11471 LDKPreCalculatedTxCreationKeys this_ptr_conv;
11472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11473 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11474 PreCalculatedTxCreationKeys_free(this_ptr_conv);
11477 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
11478 LDKTxCreationKeys keys_conv;
11479 keys_conv.inner = (void*)(keys & (~1));
11480 keys_conv.is_owned = (keys & 1) || (keys == 0);
11481 if (keys_conv.inner != NULL)
11482 keys_conv = TxCreationKeys_clone(&keys_conv);
11483 LDKPreCalculatedTxCreationKeys ret = PreCalculatedTxCreationKeys_new(keys_conv);
11484 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11487 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
11488 LDKPreCalculatedTxCreationKeys this_arg_conv;
11489 this_arg_conv.inner = (void*)(this_arg & (~1));
11490 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11491 LDKTxCreationKeys ret = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
11492 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11495 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
11496 LDKPreCalculatedTxCreationKeys this_arg_conv;
11497 this_arg_conv.inner = (void*)(this_arg & (~1));
11498 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11499 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11500 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
11504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11505 LDKChannelPublicKeys this_ptr_conv;
11506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11507 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11508 ChannelPublicKeys_free(this_ptr_conv);
11511 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11512 LDKChannelPublicKeys orig_conv;
11513 orig_conv.inner = (void*)(orig & (~1));
11514 orig_conv.is_owned = (orig & 1) || (orig == 0);
11515 LDKChannelPublicKeys ret = ChannelPublicKeys_clone(&orig_conv);
11516 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11519 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
11520 LDKChannelPublicKeys this_ptr_conv;
11521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11523 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11524 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
11528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKPublicKey val_ref;
11533 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11534 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11535 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
11538 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
11539 LDKChannelPublicKeys this_ptr_conv;
11540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11541 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11542 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11543 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
11547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11548 LDKChannelPublicKeys this_ptr_conv;
11549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11551 LDKPublicKey val_ref;
11552 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11553 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11554 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
11557 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
11558 LDKChannelPublicKeys this_ptr_conv;
11559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11560 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11561 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11562 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
11566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11567 LDKChannelPublicKeys this_ptr_conv;
11568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11569 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11570 LDKPublicKey val_ref;
11571 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11572 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11573 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
11576 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
11577 LDKChannelPublicKeys this_ptr_conv;
11578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11579 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11580 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11581 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
11585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11586 LDKChannelPublicKeys this_ptr_conv;
11587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11588 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11589 LDKPublicKey val_ref;
11590 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11591 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11592 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
11595 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
11596 LDKChannelPublicKeys this_ptr_conv;
11597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11599 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11600 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
11604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11605 LDKChannelPublicKeys this_ptr_conv;
11606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11607 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11608 LDKPublicKey val_ref;
11609 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11610 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11611 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
11614 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) {
11615 LDKPublicKey funding_pubkey_arg_ref;
11616 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
11617 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
11618 LDKPublicKey revocation_basepoint_arg_ref;
11619 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
11620 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
11621 LDKPublicKey payment_point_arg_ref;
11622 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
11623 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
11624 LDKPublicKey delayed_payment_basepoint_arg_ref;
11625 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
11626 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
11627 LDKPublicKey htlc_basepoint_arg_ref;
11628 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
11629 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
11630 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);
11631 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11634 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
11635 LDKChannelPublicKeys obj_conv;
11636 obj_conv.inner = (void*)(obj & (~1));
11637 obj_conv.is_owned = (obj & 1) || (obj == 0);
11638 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
11639 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11640 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11641 CVec_u8Z_free(arg_var);
11645 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11646 LDKu8slice ser_ref;
11647 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11648 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11649 LDKChannelPublicKeys ret = ChannelPublicKeys_read(ser_ref);
11650 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11651 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11654 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) {
11655 LDKPublicKey per_commitment_point_ref;
11656 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11657 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11658 LDKPublicKey broadcaster_delayed_payment_base_ref;
11659 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
11660 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
11661 LDKPublicKey broadcaster_htlc_base_ref;
11662 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
11663 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
11664 LDKPublicKey countersignatory_revocation_base_ref;
11665 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
11666 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
11667 LDKPublicKey countersignatory_htlc_base_ref;
11668 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
11669 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
11670 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
11671 *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);
11675 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) {
11676 LDKPublicKey revocation_key_ref;
11677 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
11678 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
11679 LDKPublicKey broadcaster_delayed_payment_key_ref;
11680 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
11681 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
11682 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
11683 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11684 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11685 CVec_u8Z_free(arg_var);
11689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11690 LDKHTLCOutputInCommitment this_ptr_conv;
11691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11692 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11693 HTLCOutputInCommitment_free(this_ptr_conv);
11696 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11697 LDKHTLCOutputInCommitment orig_conv;
11698 orig_conv.inner = (void*)(orig & (~1));
11699 orig_conv.is_owned = (orig & 1) || (orig == 0);
11700 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_clone(&orig_conv);
11701 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11704 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
11705 LDKHTLCOutputInCommitment this_ptr_conv;
11706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11707 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11708 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
11712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11713 LDKHTLCOutputInCommitment this_ptr_conv;
11714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11715 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11716 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
11719 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11720 LDKHTLCOutputInCommitment this_ptr_conv;
11721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11722 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11723 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
11727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11728 LDKHTLCOutputInCommitment this_ptr_conv;
11729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11730 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11731 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
11734 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
11735 LDKHTLCOutputInCommitment this_ptr_conv;
11736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11738 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
11742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11743 LDKHTLCOutputInCommitment this_ptr_conv;
11744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11745 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11746 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
11749 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
11750 LDKHTLCOutputInCommitment this_ptr_conv;
11751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11752 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11753 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11754 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
11758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
11763 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11764 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11765 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
11768 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
11769 LDKHTLCOutputInCommitment obj_conv;
11770 obj_conv.inner = (void*)(obj & (~1));
11771 obj_conv.is_owned = (obj & 1) || (obj == 0);
11772 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
11773 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11774 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11775 CVec_u8Z_free(arg_var);
11779 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11780 LDKu8slice ser_ref;
11781 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11782 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11783 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_read(ser_ref);
11784 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11785 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11788 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
11789 LDKHTLCOutputInCommitment htlc_conv;
11790 htlc_conv.inner = (void*)(htlc & (~1));
11791 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
11792 LDKTxCreationKeys keys_conv;
11793 keys_conv.inner = (void*)(keys & (~1));
11794 keys_conv.is_owned = (keys & 1) || (keys == 0);
11795 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
11796 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11797 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11798 CVec_u8Z_free(arg_var);
11802 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
11803 LDKPublicKey broadcaster_ref;
11804 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
11805 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
11806 LDKPublicKey countersignatory_ref;
11807 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
11808 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
11809 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
11810 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11811 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11812 CVec_u8Z_free(arg_var);
11816 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) {
11817 unsigned char prev_hash_arr[32];
11818 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
11819 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
11820 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
11821 LDKHTLCOutputInCommitment htlc_conv;
11822 htlc_conv.inner = (void*)(htlc & (~1));
11823 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
11824 LDKPublicKey broadcaster_delayed_payment_key_ref;
11825 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
11826 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
11827 LDKPublicKey revocation_key_ref;
11828 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
11829 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
11830 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
11831 *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
11835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11836 LDKHolderCommitmentTransaction this_ptr_conv;
11837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11838 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11839 HolderCommitmentTransaction_free(this_ptr_conv);
11842 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11843 LDKHolderCommitmentTransaction orig_conv;
11844 orig_conv.inner = (void*)(orig & (~1));
11845 orig_conv.is_owned = (orig & 1) || (orig == 0);
11846 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_clone(&orig_conv);
11847 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11850 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
11851 LDKHolderCommitmentTransaction this_ptr_conv;
11852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11853 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11854 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
11855 *ret = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
11859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
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 LDKTransaction val_conv = *(LDKTransaction*)val;
11864 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
11867 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
11868 LDKHolderCommitmentTransaction this_ptr_conv;
11869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11870 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11871 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
11872 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
11876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11877 LDKHolderCommitmentTransaction this_ptr_conv;
11878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11879 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11880 LDKSignature val_ref;
11881 CHECK((*_env)->GetArrayLength (_env, val) == 64);
11882 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
11883 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
11886 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
11887 LDKHolderCommitmentTransaction this_ptr_conv;
11888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11889 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11890 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
11894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11895 LDKHolderCommitmentTransaction this_ptr_conv;
11896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11898 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
11901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11902 LDKHolderCommitmentTransaction this_ptr_conv;
11903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11905 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_constr;
11906 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11907 if (val_constr.datalen > 0)
11908 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
11910 val_constr.data = NULL;
11911 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11912 for (size_t q = 0; q < val_constr.datalen; q++) {
11913 long arr_conv_42 = val_vals[q];
11914 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
11915 FREE((void*)arr_conv_42);
11916 val_constr.data[q] = arr_conv_42_conv;
11918 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11919 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_constr);
11922 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) {
11923 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
11924 LDKSignature counterparty_sig_ref;
11925 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
11926 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
11927 LDKPublicKey holder_funding_key_ref;
11928 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
11929 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
11930 LDKPublicKey counterparty_funding_key_ref;
11931 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
11932 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
11933 LDKTxCreationKeys keys_conv;
11934 keys_conv.inner = (void*)(keys & (~1));
11935 keys_conv.is_owned = (keys & 1) || (keys == 0);
11936 if (keys_conv.inner != NULL)
11937 keys_conv = TxCreationKeys_clone(&keys_conv);
11938 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_constr;
11939 htlc_data_constr.datalen = (*_env)->GetArrayLength (_env, htlc_data);
11940 if (htlc_data_constr.datalen > 0)
11941 htlc_data_constr.data = MALLOC(htlc_data_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
11943 htlc_data_constr.data = NULL;
11944 long* htlc_data_vals = (*_env)->GetLongArrayElements (_env, htlc_data, NULL);
11945 for (size_t q = 0; q < htlc_data_constr.datalen; q++) {
11946 long arr_conv_42 = htlc_data_vals[q];
11947 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
11948 FREE((void*)arr_conv_42);
11949 htlc_data_constr.data[q] = arr_conv_42_conv;
11951 (*_env)->ReleaseLongArrayElements (_env, htlc_data, htlc_data_vals, 0);
11952 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);
11953 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11956 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
11957 LDKHolderCommitmentTransaction this_arg_conv;
11958 this_arg_conv.inner = (void*)(this_arg & (~1));
11959 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11960 LDKTxCreationKeys ret = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
11961 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11964 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
11965 LDKHolderCommitmentTransaction this_arg_conv;
11966 this_arg_conv.inner = (void*)(this_arg & (~1));
11967 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11968 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
11969 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
11973 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) {
11974 LDKHolderCommitmentTransaction this_arg_conv;
11975 this_arg_conv.inner = (void*)(this_arg & (~1));
11976 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11977 unsigned char funding_key_arr[32];
11978 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
11979 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
11980 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
11981 LDKu8slice funding_redeemscript_ref;
11982 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
11983 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
11984 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
11985 (*_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);
11986 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
11990 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) {
11991 LDKHolderCommitmentTransaction this_arg_conv;
11992 this_arg_conv.inner = (void*)(this_arg & (~1));
11993 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11994 unsigned char htlc_base_key_arr[32];
11995 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
11996 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
11997 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
11998 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11999 *ret = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
12003 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
12004 LDKHolderCommitmentTransaction obj_conv;
12005 obj_conv.inner = (void*)(obj & (~1));
12006 obj_conv.is_owned = (obj & 1) || (obj == 0);
12007 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
12008 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12009 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12010 CVec_u8Z_free(arg_var);
12014 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12015 LDKu8slice ser_ref;
12016 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12017 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12018 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_read(ser_ref);
12019 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12020 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12024 LDKInitFeatures this_ptr_conv;
12025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12026 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12027 InitFeatures_free(this_ptr_conv);
12030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12031 LDKNodeFeatures this_ptr_conv;
12032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12034 NodeFeatures_free(this_ptr_conv);
12037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12038 LDKChannelFeatures this_ptr_conv;
12039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12040 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12041 ChannelFeatures_free(this_ptr_conv);
12044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12045 LDKRouteHop this_ptr_conv;
12046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12047 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12048 RouteHop_free(this_ptr_conv);
12051 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12052 LDKRouteHop orig_conv;
12053 orig_conv.inner = (void*)(orig & (~1));
12054 orig_conv.is_owned = (orig & 1) || (orig == 0);
12055 LDKRouteHop ret = RouteHop_clone(&orig_conv);
12056 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12059 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
12060 LDKRouteHop this_ptr_conv;
12061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12062 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12063 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12064 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
12068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKPublicKey val_ref;
12073 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12074 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12075 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
12078 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12079 LDKRouteHop this_ptr_conv;
12080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12081 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12082 LDKNodeFeatures ret = RouteHop_get_node_features(&this_ptr_conv);
12083 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12087 LDKRouteHop this_ptr_conv;
12088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12089 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12090 LDKNodeFeatures val_conv;
12091 val_conv.inner = (void*)(val & (~1));
12092 val_conv.is_owned = (val & 1) || (val == 0);
12093 // Warning: we may need a move here but can't clone!
12094 RouteHop_set_node_features(&this_ptr_conv, val_conv);
12097 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12098 LDKRouteHop this_ptr_conv;
12099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12100 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12101 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
12105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12106 LDKRouteHop this_ptr_conv;
12107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12109 RouteHop_set_short_channel_id(&this_ptr_conv, val);
12112 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12113 LDKRouteHop this_ptr_conv;
12114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12115 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12116 LDKChannelFeatures ret = RouteHop_get_channel_features(&this_ptr_conv);
12117 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12121 LDKRouteHop this_ptr_conv;
12122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12123 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12124 LDKChannelFeatures val_conv;
12125 val_conv.inner = (void*)(val & (~1));
12126 val_conv.is_owned = (val & 1) || (val == 0);
12127 // Warning: we may need a move here but can't clone!
12128 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
12131 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12132 LDKRouteHop this_ptr_conv;
12133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12134 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12135 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
12139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12140 LDKRouteHop this_ptr_conv;
12141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12142 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12143 RouteHop_set_fee_msat(&this_ptr_conv, val);
12146 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
12147 LDKRouteHop this_ptr_conv;
12148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12149 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12150 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
12154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12155 LDKRouteHop this_ptr_conv;
12156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12157 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12158 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
12161 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) {
12162 LDKPublicKey pubkey_arg_ref;
12163 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
12164 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
12165 LDKNodeFeatures node_features_arg_conv;
12166 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
12167 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
12168 // Warning: we may need a move here but can't clone!
12169 LDKChannelFeatures channel_features_arg_conv;
12170 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
12171 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
12172 // Warning: we may need a move here but can't clone!
12173 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);
12174 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12178 LDKRoute this_ptr_conv;
12179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12180 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12181 Route_free(this_ptr_conv);
12184 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12185 LDKRoute orig_conv;
12186 orig_conv.inner = (void*)(orig & (~1));
12187 orig_conv.is_owned = (orig & 1) || (orig == 0);
12188 LDKRoute ret = Route_clone(&orig_conv);
12189 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
12193 LDKRoute this_ptr_conv;
12194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12195 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12196 LDKCVec_CVec_RouteHopZZ val_constr;
12197 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12198 if (val_constr.datalen > 0)
12199 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12201 val_constr.data = NULL;
12202 for (size_t m = 0; m < val_constr.datalen; m++) {
12203 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
12204 LDKCVec_RouteHopZ arr_conv_12_constr;
12205 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
12206 if (arr_conv_12_constr.datalen > 0)
12207 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12209 arr_conv_12_constr.data = NULL;
12210 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
12211 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
12212 long arr_conv_10 = arr_conv_12_vals[k];
12213 LDKRouteHop arr_conv_10_conv;
12214 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
12215 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
12216 if (arr_conv_10_conv.inner != NULL)
12217 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
12218 arr_conv_12_constr.data[k] = arr_conv_10_conv;
12220 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
12221 val_constr.data[m] = arr_conv_12_constr;
12223 Route_set_paths(&this_ptr_conv, val_constr);
12226 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
12227 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
12228 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
12229 if (paths_arg_constr.datalen > 0)
12230 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12232 paths_arg_constr.data = NULL;
12233 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
12234 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
12235 LDKCVec_RouteHopZ arr_conv_12_constr;
12236 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
12237 if (arr_conv_12_constr.datalen > 0)
12238 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12240 arr_conv_12_constr.data = NULL;
12241 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
12242 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
12243 long arr_conv_10 = arr_conv_12_vals[k];
12244 LDKRouteHop arr_conv_10_conv;
12245 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
12246 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
12247 if (arr_conv_10_conv.inner != NULL)
12248 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
12249 arr_conv_12_constr.data[k] = arr_conv_10_conv;
12251 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
12252 paths_arg_constr.data[m] = arr_conv_12_constr;
12254 LDKRoute ret = Route_new(paths_arg_constr);
12255 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12258 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
12260 obj_conv.inner = (void*)(obj & (~1));
12261 obj_conv.is_owned = (obj & 1) || (obj == 0);
12262 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
12263 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12264 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12265 CVec_u8Z_free(arg_var);
12269 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12270 LDKu8slice ser_ref;
12271 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12272 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12273 LDKRoute ret = Route_read(ser_ref);
12274 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12275 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12279 LDKRouteHint this_ptr_conv;
12280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12281 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12282 RouteHint_free(this_ptr_conv);
12285 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12286 LDKRouteHint orig_conv;
12287 orig_conv.inner = (void*)(orig & (~1));
12288 orig_conv.is_owned = (orig & 1) || (orig == 0);
12289 LDKRouteHint ret = RouteHint_clone(&orig_conv);
12290 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12293 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12294 LDKRouteHint this_ptr_conv;
12295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12296 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12297 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12298 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
12302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKPublicKey val_ref;
12307 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12308 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12309 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
12312 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12313 LDKRouteHint this_ptr_conv;
12314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12316 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
12320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12321 LDKRouteHint this_ptr_conv;
12322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12323 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12324 RouteHint_set_short_channel_id(&this_ptr_conv, val);
12327 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
12328 LDKRouteHint this_ptr_conv;
12329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12330 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12331 LDKRoutingFees ret = RouteHint_get_fees(&this_ptr_conv);
12332 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12336 LDKRouteHint this_ptr_conv;
12337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12339 LDKRoutingFees val_conv;
12340 val_conv.inner = (void*)(val & (~1));
12341 val_conv.is_owned = (val & 1) || (val == 0);
12342 if (val_conv.inner != NULL)
12343 val_conv = RoutingFees_clone(&val_conv);
12344 RouteHint_set_fees(&this_ptr_conv, val_conv);
12347 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
12348 LDKRouteHint this_ptr_conv;
12349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12351 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
12355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
12356 LDKRouteHint this_ptr_conv;
12357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12358 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12359 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
12362 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12363 LDKRouteHint this_ptr_conv;
12364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12365 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12366 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
12370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12371 LDKRouteHint this_ptr_conv;
12372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12373 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12374 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
12377 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) {
12378 LDKPublicKey src_node_id_arg_ref;
12379 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
12380 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
12381 LDKRoutingFees fees_arg_conv;
12382 fees_arg_conv.inner = (void*)(fees_arg & (~1));
12383 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
12384 if (fees_arg_conv.inner != NULL)
12385 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
12386 LDKRouteHint ret = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
12387 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12390 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) {
12391 LDKPublicKey our_node_id_ref;
12392 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
12393 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
12394 LDKNetworkGraph network_conv;
12395 network_conv.inner = (void*)(network & (~1));
12396 network_conv.is_owned = (network & 1) || (network == 0);
12397 LDKPublicKey target_ref;
12398 CHECK((*_env)->GetArrayLength (_env, target) == 33);
12399 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
12400 LDKCVec_ChannelDetailsZ first_hops_constr;
12401 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
12402 if (first_hops_constr.datalen > 0)
12403 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12405 first_hops_constr.data = NULL;
12406 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
12407 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
12408 long arr_conv_16 = first_hops_vals[q];
12409 LDKChannelDetails arr_conv_16_conv;
12410 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
12411 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
12412 first_hops_constr.data[q] = arr_conv_16_conv;
12414 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
12415 LDKCVec_RouteHintZ last_hops_constr;
12416 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
12417 if (last_hops_constr.datalen > 0)
12418 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12420 last_hops_constr.data = NULL;
12421 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
12422 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
12423 long arr_conv_11 = last_hops_vals[l];
12424 LDKRouteHint arr_conv_11_conv;
12425 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
12426 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
12427 if (arr_conv_11_conv.inner != NULL)
12428 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
12429 last_hops_constr.data[l] = arr_conv_11_conv;
12431 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
12432 LDKLogger logger_conv = *(LDKLogger*)logger;
12433 if (logger_conv.free == LDKLogger_JCalls_free) {
12434 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12435 LDKLogger_JCalls_clone(logger_conv.this_arg);
12437 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12438 *ret = get_route(our_node_id_ref, &network_conv, target_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
12439 FREE(first_hops_constr.data);
12443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12444 LDKNetworkGraph this_ptr_conv;
12445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12446 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12447 NetworkGraph_free(this_ptr_conv);
12450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12451 LDKLockedNetworkGraph this_ptr_conv;
12452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12453 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12454 LockedNetworkGraph_free(this_ptr_conv);
12457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12458 LDKNetGraphMsgHandler this_ptr_conv;
12459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12460 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12461 NetGraphMsgHandler_free(this_ptr_conv);
12464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
12465 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
12466 LDKLogger logger_conv = *(LDKLogger*)logger;
12467 if (logger_conv.free == LDKLogger_JCalls_free) {
12468 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12469 LDKLogger_JCalls_clone(logger_conv.this_arg);
12471 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
12472 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
12476 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
12477 LDKLogger logger_conv = *(LDKLogger*)logger;
12478 if (logger_conv.free == LDKLogger_JCalls_free) {
12479 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12480 LDKLogger_JCalls_clone(logger_conv.this_arg);
12482 LDKNetworkGraph network_graph_conv;
12483 network_graph_conv.inner = (void*)(network_graph & (~1));
12484 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
12485 // Warning: we may need a move here but can't clone!
12486 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
12487 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12490 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
12491 LDKNetGraphMsgHandler this_arg_conv;
12492 this_arg_conv.inner = (void*)(this_arg & (~1));
12493 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12494 LDKLockedNetworkGraph ret = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
12495 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
12499 LDKLockedNetworkGraph this_arg_conv;
12500 this_arg_conv.inner = (void*)(this_arg & (~1));
12501 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12502 LDKNetworkGraph ret = LockedNetworkGraph_graph(&this_arg_conv);
12503 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
12507 LDKNetGraphMsgHandler this_arg_conv;
12508 this_arg_conv.inner = (void*)(this_arg & (~1));
12509 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12510 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
12511 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
12515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12516 LDKDirectionalChannelInfo this_ptr_conv;
12517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12518 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12519 DirectionalChannelInfo_free(this_ptr_conv);
12522 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
12523 LDKDirectionalChannelInfo this_ptr_conv;
12524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12525 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12526 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
12530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12531 LDKDirectionalChannelInfo this_ptr_conv;
12532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12533 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12534 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
12537 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
12538 LDKDirectionalChannelInfo this_ptr_conv;
12539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12541 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
12545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12546 LDKDirectionalChannelInfo this_ptr_conv;
12547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12548 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12549 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
12552 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
12553 LDKDirectionalChannelInfo this_ptr_conv;
12554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12555 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12556 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
12560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
12561 LDKDirectionalChannelInfo this_ptr_conv;
12562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12563 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12564 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
12567 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12568 LDKDirectionalChannelInfo this_ptr_conv;
12569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12570 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12571 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
12575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12576 LDKDirectionalChannelInfo this_ptr_conv;
12577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12579 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
12582 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
12583 LDKDirectionalChannelInfo this_ptr_conv;
12584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12585 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12586 LDKChannelUpdate ret = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
12587 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12591 LDKDirectionalChannelInfo this_ptr_conv;
12592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12593 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12594 LDKChannelUpdate val_conv;
12595 val_conv.inner = (void*)(val & (~1));
12596 val_conv.is_owned = (val & 1) || (val == 0);
12597 if (val_conv.inner != NULL)
12598 val_conv = ChannelUpdate_clone(&val_conv);
12599 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
12602 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12603 LDKDirectionalChannelInfo obj_conv;
12604 obj_conv.inner = (void*)(obj & (~1));
12605 obj_conv.is_owned = (obj & 1) || (obj == 0);
12606 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
12607 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12608 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12609 CVec_u8Z_free(arg_var);
12613 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12614 LDKu8slice ser_ref;
12615 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12616 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12617 LDKDirectionalChannelInfo ret = DirectionalChannelInfo_read(ser_ref);
12618 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12619 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12623 LDKChannelInfo this_ptr_conv;
12624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12625 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12626 ChannelInfo_free(this_ptr_conv);
12629 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12630 LDKChannelInfo this_ptr_conv;
12631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12632 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12633 LDKChannelFeatures ret = ChannelInfo_get_features(&this_ptr_conv);
12634 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12638 LDKChannelInfo this_ptr_conv;
12639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12640 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12641 LDKChannelFeatures val_conv;
12642 val_conv.inner = (void*)(val & (~1));
12643 val_conv.is_owned = (val & 1) || (val == 0);
12644 // Warning: we may need a move here but can't clone!
12645 ChannelInfo_set_features(&this_ptr_conv, val_conv);
12648 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12653 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
12657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12658 LDKChannelInfo this_ptr_conv;
12659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12660 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12661 LDKPublicKey val_ref;
12662 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12663 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12664 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
12667 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
12668 LDKChannelInfo this_ptr_conv;
12669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12670 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12671 LDKDirectionalChannelInfo ret = ChannelInfo_get_one_to_two(&this_ptr_conv);
12672 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12676 LDKChannelInfo this_ptr_conv;
12677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12678 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12679 LDKDirectionalChannelInfo val_conv;
12680 val_conv.inner = (void*)(val & (~1));
12681 val_conv.is_owned = (val & 1) || (val == 0);
12682 // Warning: we may need a move here but can't clone!
12683 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
12686 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
12687 LDKChannelInfo this_ptr_conv;
12688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12690 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12691 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
12695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12696 LDKChannelInfo this_ptr_conv;
12697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12699 LDKPublicKey val_ref;
12700 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12701 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12702 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
12705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
12706 LDKChannelInfo this_ptr_conv;
12707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12709 LDKDirectionalChannelInfo ret = ChannelInfo_get_two_to_one(&this_ptr_conv);
12710 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12714 LDKChannelInfo this_ptr_conv;
12715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12717 LDKDirectionalChannelInfo val_conv;
12718 val_conv.inner = (void*)(val & (~1));
12719 val_conv.is_owned = (val & 1) || (val == 0);
12720 // Warning: we may need a move here but can't clone!
12721 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
12724 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
12725 LDKChannelInfo this_ptr_conv;
12726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12728 LDKChannelAnnouncement ret = ChannelInfo_get_announcement_message(&this_ptr_conv);
12729 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12733 LDKChannelInfo this_ptr_conv;
12734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12735 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12736 LDKChannelAnnouncement val_conv;
12737 val_conv.inner = (void*)(val & (~1));
12738 val_conv.is_owned = (val & 1) || (val == 0);
12739 if (val_conv.inner != NULL)
12740 val_conv = ChannelAnnouncement_clone(&val_conv);
12741 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
12744 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12745 LDKChannelInfo obj_conv;
12746 obj_conv.inner = (void*)(obj & (~1));
12747 obj_conv.is_owned = (obj & 1) || (obj == 0);
12748 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
12749 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12750 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12751 CVec_u8Z_free(arg_var);
12755 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12756 LDKu8slice ser_ref;
12757 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12758 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12759 LDKChannelInfo ret = ChannelInfo_read(ser_ref);
12760 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12761 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12765 LDKRoutingFees this_ptr_conv;
12766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12767 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12768 RoutingFees_free(this_ptr_conv);
12771 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12772 LDKRoutingFees orig_conv;
12773 orig_conv.inner = (void*)(orig & (~1));
12774 orig_conv.is_owned = (orig & 1) || (orig == 0);
12775 LDKRoutingFees ret = RoutingFees_clone(&orig_conv);
12776 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12779 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12780 LDKRoutingFees this_ptr_conv;
12781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12782 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12783 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
12787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12788 LDKRoutingFees this_ptr_conv;
12789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12790 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12791 RoutingFees_set_base_msat(&this_ptr_conv, val);
12794 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
12795 LDKRoutingFees this_ptr_conv;
12796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12798 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
12802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12803 LDKRoutingFees this_ptr_conv;
12804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12806 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
12809 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
12810 LDKRoutingFees ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
12811 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12814 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12815 LDKu8slice ser_ref;
12816 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12817 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12818 LDKRoutingFees ret = RoutingFees_read(ser_ref);
12819 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12820 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12823 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
12824 LDKRoutingFees obj_conv;
12825 obj_conv.inner = (void*)(obj & (~1));
12826 obj_conv.is_owned = (obj & 1) || (obj == 0);
12827 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
12828 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12829 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12830 CVec_u8Z_free(arg_var);
12834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12835 LDKNodeAnnouncementInfo this_ptr_conv;
12836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12837 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12838 NodeAnnouncementInfo_free(this_ptr_conv);
12841 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12842 LDKNodeAnnouncementInfo this_ptr_conv;
12843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12844 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12845 LDKNodeFeatures ret = NodeAnnouncementInfo_get_features(&this_ptr_conv);
12846 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12850 LDKNodeAnnouncementInfo this_ptr_conv;
12851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12852 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12853 LDKNodeFeatures val_conv;
12854 val_conv.inner = (void*)(val & (~1));
12855 val_conv.is_owned = (val & 1) || (val == 0);
12856 // Warning: we may need a move here but can't clone!
12857 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
12860 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(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 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
12868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12869 LDKNodeAnnouncementInfo this_ptr_conv;
12870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12871 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12872 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
12875 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
12880 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
12884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12885 LDKNodeAnnouncementInfo this_ptr_conv;
12886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12887 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12888 LDKThreeBytes val_ref;
12889 CHECK((*_env)->GetArrayLength (_env, val) == 3);
12890 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
12891 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
12894 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12899 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
12903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12904 LDKNodeAnnouncementInfo this_ptr_conv;
12905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12906 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12907 LDKThirtyTwoBytes val_ref;
12908 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12909 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12910 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
12913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
12914 LDKNodeAnnouncementInfo this_ptr_conv;
12915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12916 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12917 LDKCVec_NetAddressZ val_constr;
12918 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12919 if (val_constr.datalen > 0)
12920 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12922 val_constr.data = NULL;
12923 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
12924 for (size_t m = 0; m < val_constr.datalen; m++) {
12925 long arr_conv_12 = val_vals[m];
12926 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
12927 FREE((void*)arr_conv_12);
12928 val_constr.data[m] = arr_conv_12_conv;
12930 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
12931 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
12934 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
12935 LDKNodeAnnouncementInfo this_ptr_conv;
12936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12937 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12938 LDKNodeAnnouncement ret = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
12939 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12943 LDKNodeAnnouncementInfo this_ptr_conv;
12944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12945 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12946 LDKNodeAnnouncement val_conv;
12947 val_conv.inner = (void*)(val & (~1));
12948 val_conv.is_owned = (val & 1) || (val == 0);
12949 if (val_conv.inner != NULL)
12950 val_conv = NodeAnnouncement_clone(&val_conv);
12951 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
12954 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) {
12955 LDKNodeFeatures features_arg_conv;
12956 features_arg_conv.inner = (void*)(features_arg & (~1));
12957 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
12958 // Warning: we may need a move here but can't clone!
12959 LDKThreeBytes rgb_arg_ref;
12960 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
12961 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
12962 LDKThirtyTwoBytes alias_arg_ref;
12963 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
12964 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
12965 LDKCVec_NetAddressZ addresses_arg_constr;
12966 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
12967 if (addresses_arg_constr.datalen > 0)
12968 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12970 addresses_arg_constr.data = NULL;
12971 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
12972 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
12973 long arr_conv_12 = addresses_arg_vals[m];
12974 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
12975 FREE((void*)arr_conv_12);
12976 addresses_arg_constr.data[m] = arr_conv_12_conv;
12978 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
12979 LDKNodeAnnouncement announcement_message_arg_conv;
12980 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
12981 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
12982 if (announcement_message_arg_conv.inner != NULL)
12983 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
12984 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
12985 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12988 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12989 LDKNodeAnnouncementInfo obj_conv;
12990 obj_conv.inner = (void*)(obj & (~1));
12991 obj_conv.is_owned = (obj & 1) || (obj == 0);
12992 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
12993 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12994 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12995 CVec_u8Z_free(arg_var);
12999 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13000 LDKu8slice ser_ref;
13001 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13002 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13003 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_read(ser_ref);
13004 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13005 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13009 LDKNodeInfo this_ptr_conv;
13010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13011 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13012 NodeInfo_free(this_ptr_conv);
13015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
13016 LDKNodeInfo this_ptr_conv;
13017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13018 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13019 LDKCVec_u64Z val_constr;
13020 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13021 if (val_constr.datalen > 0)
13022 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
13024 val_constr.data = NULL;
13025 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
13026 for (size_t g = 0; g < val_constr.datalen; g++) {
13027 long arr_conv_6 = val_vals[g];
13028 val_constr.data[g] = arr_conv_6;
13030 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
13031 NodeInfo_set_channels(&this_ptr_conv, val_constr);
13034 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(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 LDKRoutingFees ret = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
13039 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13043 LDKNodeInfo this_ptr_conv;
13044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13045 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13046 LDKRoutingFees val_conv;
13047 val_conv.inner = (void*)(val & (~1));
13048 val_conv.is_owned = (val & 1) || (val == 0);
13049 if (val_conv.inner != NULL)
13050 val_conv = RoutingFees_clone(&val_conv);
13051 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
13054 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
13055 LDKNodeInfo this_ptr_conv;
13056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13057 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13058 LDKNodeAnnouncementInfo ret = NodeInfo_get_announcement_info(&this_ptr_conv);
13059 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13063 LDKNodeInfo this_ptr_conv;
13064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13066 LDKNodeAnnouncementInfo val_conv;
13067 val_conv.inner = (void*)(val & (~1));
13068 val_conv.is_owned = (val & 1) || (val == 0);
13069 // Warning: we may need a move here but can't clone!
13070 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
13073 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) {
13074 LDKCVec_u64Z channels_arg_constr;
13075 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
13076 if (channels_arg_constr.datalen > 0)
13077 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
13079 channels_arg_constr.data = NULL;
13080 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
13081 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
13082 long arr_conv_6 = channels_arg_vals[g];
13083 channels_arg_constr.data[g] = arr_conv_6;
13085 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
13086 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
13087 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
13088 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
13089 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
13090 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
13091 LDKNodeAnnouncementInfo announcement_info_arg_conv;
13092 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
13093 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
13094 // Warning: we may need a move here but can't clone!
13095 LDKNodeInfo ret = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
13096 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13099 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13100 LDKNodeInfo obj_conv;
13101 obj_conv.inner = (void*)(obj & (~1));
13102 obj_conv.is_owned = (obj & 1) || (obj == 0);
13103 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
13104 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13105 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13106 CVec_u8Z_free(arg_var);
13110 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13111 LDKu8slice ser_ref;
13112 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13113 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13114 LDKNodeInfo ret = NodeInfo_read(ser_ref);
13115 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13116 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13119 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
13120 LDKNetworkGraph obj_conv;
13121 obj_conv.inner = (void*)(obj & (~1));
13122 obj_conv.is_owned = (obj & 1) || (obj == 0);
13123 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
13124 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13125 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13126 CVec_u8Z_free(arg_var);
13130 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13131 LDKu8slice ser_ref;
13132 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13133 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13134 LDKNetworkGraph ret = NetworkGraph_read(ser_ref);
13135 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13136 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13139 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
13140 LDKNetworkGraph ret = NetworkGraph_new();
13141 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13144 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) {
13145 LDKNetworkGraph this_arg_conv;
13146 this_arg_conv.inner = (void*)(this_arg & (~1));
13147 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13148 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);