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) { p = it; it = it->next; }
58 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
59 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
60 DO_ASSERT(it->ptr == ptr);
63 static void FREE(void* ptr) {
64 if ((long)ptr < 1024) return; // Rust loves to create pointers to the NULL page for dummys
69 void* __wrap_malloc(size_t len) {
70 void* res = __real_malloc(len);
71 new_allocation(res, "malloc call");
74 void* __wrap_calloc(size_t nmemb, size_t len) {
75 void* res = __real_calloc(nmemb, len);
76 new_allocation(res, "calloc call");
79 void __wrap_free(void* ptr) {
84 void* __real_realloc(void* ptr, size_t newlen);
85 void* __wrap_realloc(void* ptr, size_t len) {
87 void* res = __real_realloc(ptr, len);
88 new_allocation(res, "realloc call");
91 void __wrap_reallocarray(void* ptr, size_t new_sz) {
92 // Rust doesn't seem to use reallocarray currently
96 void __attribute__((destructor)) check_leaks() {
97 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
98 fprintf(stderr, "%s %p remains:\n", a->struct_name, a->ptr);
99 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
100 fprintf(stderr, "\n\n");
102 DO_ASSERT(allocation_ll == NULL);
105 static jmethodID ordinal_meth = NULL;
106 static jmethodID slicedef_meth = NULL;
107 static jclass slicedef_cls = NULL;
108 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
109 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
110 CHECK(ordinal_meth != NULL);
111 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
112 CHECK(slicedef_meth != NULL);
113 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
114 CHECK(slicedef_cls != NULL);
117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
118 return *((bool*)ptr);
120 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
121 return *((long*)ptr);
123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
126 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * _env, jclass _b, jlong ptr, jlong len) {
127 jbyteArray ret_arr = (*_env)->NewByteArray(_env, len);
128 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, len, (unsigned char*)ptr);
131 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * _env, jclass _b, jlong slice_ptr) {
132 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
133 jbyteArray ret_arr = (*_env)->NewByteArray(_env, slice->datalen);
134 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, slice->datalen, slice->data);
137 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * _env, jclass _b, jbyteArray bytes) {
138 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
139 vec->datalen = (*_env)->GetArrayLength(_env, bytes);
140 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
141 (*_env)->GetByteArrayRegion (_env, bytes, 0, vec->datalen, vec->data);
144 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
145 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
146 txdata->datalen = (*env)->GetArrayLength(env, bytes);
147 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
148 txdata->data_is_owned = true;
149 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
152 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
153 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
154 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
155 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
156 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
157 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
158 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
159 return (long)vec->datalen;
161 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * _env, jclass _b) {
162 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
163 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
164 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
165 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
166 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
167 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
173 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
174 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
175 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
176 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
178 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
179 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
180 case 0: return LDKAccessError_UnknownChain;
181 case 1: return LDKAccessError_UnknownTx;
185 static jclass LDKAccessError_class = NULL;
186 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
187 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
188 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv * env, jclass clz) {
189 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
190 CHECK(LDKAccessError_class != NULL);
191 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
192 CHECK(LDKAccessError_LDKAccessError_UnknownChain != NULL);
193 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
194 CHECK(LDKAccessError_LDKAccessError_UnknownTx != NULL);
196 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
198 case LDKAccessError_UnknownChain:
199 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
200 case LDKAccessError_UnknownTx:
201 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
206 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
207 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
208 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
209 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
213 static jclass LDKChannelMonitorUpdateErr_class = NULL;
214 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
215 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
216 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv * env, jclass clz) {
217 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
218 CHECK(LDKChannelMonitorUpdateErr_class != NULL);
219 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
220 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
221 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
222 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
224 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
226 case LDKChannelMonitorUpdateErr_TemporaryFailure:
227 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
228 case LDKChannelMonitorUpdateErr_PermanentFailure:
229 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
234 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
235 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
236 case 0: return LDKConfirmationTarget_Background;
237 case 1: return LDKConfirmationTarget_Normal;
238 case 2: return LDKConfirmationTarget_HighPriority;
242 static jclass LDKConfirmationTarget_class = NULL;
243 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
244 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
245 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
246 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv * env, jclass clz) {
247 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
248 CHECK(LDKConfirmationTarget_class != NULL);
249 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
250 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
251 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
252 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
253 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
254 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
256 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
258 case LDKConfirmationTarget_Background:
259 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
260 case LDKConfirmationTarget_Normal:
261 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
262 case LDKConfirmationTarget_HighPriority:
263 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
268 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
269 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
270 case 0: return LDKLevel_Off;
271 case 1: return LDKLevel_Error;
272 case 2: return LDKLevel_Warn;
273 case 3: return LDKLevel_Info;
274 case 4: return LDKLevel_Debug;
275 case 5: return LDKLevel_Trace;
279 static jclass LDKLevel_class = NULL;
280 static jfieldID LDKLevel_LDKLevel_Off = NULL;
281 static jfieldID LDKLevel_LDKLevel_Error = NULL;
282 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
283 static jfieldID LDKLevel_LDKLevel_Info = NULL;
284 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
285 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
286 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv * env, jclass clz) {
287 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
288 CHECK(LDKLevel_class != NULL);
289 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
290 CHECK(LDKLevel_LDKLevel_Off != NULL);
291 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
292 CHECK(LDKLevel_LDKLevel_Error != NULL);
293 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
294 CHECK(LDKLevel_LDKLevel_Warn != NULL);
295 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
296 CHECK(LDKLevel_LDKLevel_Info != NULL);
297 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
298 CHECK(LDKLevel_LDKLevel_Debug != NULL);
299 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
300 CHECK(LDKLevel_LDKLevel_Trace != NULL);
302 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
305 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
307 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
309 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
311 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
313 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
315 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
320 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
321 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
322 case 0: return LDKNetwork_Bitcoin;
323 case 1: return LDKNetwork_Testnet;
324 case 2: return LDKNetwork_Regtest;
328 static jclass LDKNetwork_class = NULL;
329 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
330 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
331 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
332 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv * env, jclass clz) {
333 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
334 CHECK(LDKNetwork_class != NULL);
335 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
336 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
337 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
338 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
339 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
340 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
342 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
344 case LDKNetwork_Bitcoin:
345 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
346 case LDKNetwork_Testnet:
347 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
348 case LDKNetwork_Regtest:
349 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
354 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
355 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
356 case 0: return LDKSecp256k1Error_IncorrectSignature;
357 case 1: return LDKSecp256k1Error_InvalidMessage;
358 case 2: return LDKSecp256k1Error_InvalidPublicKey;
359 case 3: return LDKSecp256k1Error_InvalidSignature;
360 case 4: return LDKSecp256k1Error_InvalidSecretKey;
361 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
362 case 6: return LDKSecp256k1Error_InvalidTweak;
363 case 7: return LDKSecp256k1Error_NotEnoughMemory;
364 case 8: return LDKSecp256k1Error_CallbackPanicked;
368 static jclass LDKSecp256k1Error_class = NULL;
369 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
370 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
371 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
372 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
373 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
374 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
375 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
376 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
377 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
378 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv * env, jclass clz) {
379 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
380 CHECK(LDKSecp256k1Error_class != NULL);
381 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
382 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
383 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
384 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
385 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
386 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
387 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
388 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
389 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
390 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
391 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
392 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
393 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
394 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
395 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
396 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
397 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
398 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
400 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
402 case LDKSecp256k1Error_IncorrectSignature:
403 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
404 case LDKSecp256k1Error_InvalidMessage:
405 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
406 case LDKSecp256k1Error_InvalidPublicKey:
407 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
408 case LDKSecp256k1Error_InvalidSignature:
409 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
410 case LDKSecp256k1Error_InvalidSecretKey:
411 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
412 case LDKSecp256k1Error_InvalidRecoveryId:
413 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
414 case LDKSecp256k1Error_InvalidTweak:
415 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
416 case LDKSecp256k1Error_NotEnoughMemory:
417 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
418 case LDKSecp256k1Error_CallbackPanicked:
419 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
424 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
425 LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr;
426 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
428 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1new(JNIEnv *env, jclass _b, jbyteArray elems){
429 LDKCVecTempl_u8 *ret = MALLOC(sizeof(LDKCVecTempl_u8), "LDKCVecTempl_u8");
430 ret->datalen = (*env)->GetArrayLength(env, elems);
431 if (ret->datalen == 0) {
434 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVecTempl_u8 Data");
435 jbyte *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
436 for (size_t i = 0; i < ret->datalen; i++) {
437 ret->data[i] = java_elems[i];
439 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
444 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
446 LDKTransaction b_conv = *(LDKTransaction*)b;
451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
452 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
454 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
455 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
456 CHECK(val->result_ok);
457 return *val->contents.result;
459 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
460 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
461 CHECK(!val->result_ok);
462 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(_env, (*val->contents.err));
465 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
466 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
468 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
469 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
470 CHECK(val->result_ok);
471 return *val->contents.result;
473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
474 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
475 CHECK(!val->result_ok);
476 LDKMonitorUpdateError err_var = (*val->contents.err);
477 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
478 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
479 long err_ref = (long)err_var.inner & ~1;
482 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
483 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
485 a_conv.inner = (void*)(a & (~1));
486 a_conv.is_owned = (a & 1) || (a == 0);
487 if (a_conv.inner != NULL)
488 a_conv = OutPoint_clone(&a_conv);
491 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
492 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
494 //TODO: Really need to call (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0); here
497 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
498 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
499 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
501 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
502 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
503 ret->datalen = (*env)->GetArrayLength(env, elems);
504 if (ret->datalen == 0) {
507 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
508 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
509 for (size_t i = 0; i < ret->datalen; i++) {
510 jlong arr_elem = java_elems[i];
511 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
512 FREE((void*)arr_elem);
513 ret->data[i] = arr_elem_conv;
515 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
519 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlongArray b) {
520 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
521 LDKThirtyTwoBytes a_ref;
522 CHECK((*_env)->GetArrayLength (_env, a) == 32);
523 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
525 LDKCVecTempl_TxOut b_constr;
526 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
527 if (b_constr.datalen > 0)
528 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVecTempl_TxOut Elements");
530 b_constr.data = NULL;
531 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
532 for (size_t h = 0; h < b_constr.datalen; h++) {
533 long arr_conv_7 = b_vals[h];
534 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
535 FREE((void*)arr_conv_7);
536 b_constr.data[h] = arr_conv_7_conv;
538 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
543 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
548 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
549 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
550 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
552 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jbyteArray a, jobjectArray b) {
553 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
555 CHECK((*_env)->GetArrayLength (_env, a) == 64);
556 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
558 LDKCVecTempl_Signature b_constr;
559 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
560 if (b_constr.datalen > 0)
561 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVecTempl_Signature Elements");
563 b_constr.data = NULL;
564 for (size_t i = 0; i < b_constr.datalen; i++) {
565 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
566 LDKSignature arr_conv_8_ref;
567 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
568 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
569 b_constr.data[i] = arr_conv_8_ref;
574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
575 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
577 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
578 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
579 CHECK(val->result_ok);
580 long res_ref = (long)&(*val->contents.result);
583 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
584 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
585 CHECK(!val->result_ok);
586 return *val->contents.err;
588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
589 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
591 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
592 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
593 CHECK(val->result_ok);
594 jbyteArray res_arr = (*_env)->NewByteArray(_env, 64);
595 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 64, (*val->contents.result).compact_form);
598 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
599 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
600 CHECK(!val->result_ok);
601 return *val->contents.err;
603 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
604 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
606 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
607 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
608 CHECK(val->result_ok);
609 LDKCVecTempl_Signature res_var = (*val->contents.result);
610 jobjectArray res_arr = (*_env)->NewObjectArray(_env, res_var.datalen, NULL, NULL);
611 for (size_t i = 0; i < res_var.datalen; i++) {
612 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
613 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
614 (*_env)->SetObjectArrayElement(_env, res_arr, i, arr_conv_8_arr);
618 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
619 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
620 CHECK(!val->result_ok);
621 return *val->contents.err;
623 static jclass LDKAPIError_APIMisuseError_class = NULL;
624 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
625 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
626 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
627 static jclass LDKAPIError_RouteError_class = NULL;
628 static jmethodID LDKAPIError_RouteError_meth = NULL;
629 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
630 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
631 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
632 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
634 LDKAPIError_APIMisuseError_class =
635 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
636 CHECK(LDKAPIError_APIMisuseError_class != NULL);
637 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
638 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
639 LDKAPIError_FeeRateTooHigh_class =
640 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
641 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
642 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
643 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
644 LDKAPIError_RouteError_class =
645 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
646 CHECK(LDKAPIError_RouteError_class != NULL);
647 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
648 CHECK(LDKAPIError_RouteError_meth != NULL);
649 LDKAPIError_ChannelUnavailable_class =
650 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
651 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
652 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
653 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
654 LDKAPIError_MonitorUpdateFailed_class =
655 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
656 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
657 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
658 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
660 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
661 LDKAPIError *obj = (LDKAPIError*)ptr;
663 case LDKAPIError_APIMisuseError: {
664 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
665 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
666 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
667 return (*_env)->NewObject(_env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
669 case LDKAPIError_FeeRateTooHigh: {
670 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
671 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
672 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
673 return (*_env)->NewObject(_env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
675 case LDKAPIError_RouteError: {
676 LDKStr err_str = obj->route_error.err;
677 char* err_buf = MALLOC(err_str.len + 1, "str conv buf");
678 memcpy(err_buf, err_str.chars, err_str.len);
679 err_buf[err_str.len] = 0;
680 jstring err_conv = (*_env)->NewStringUTF(_env, err_str.chars);
682 return (*_env)->NewObject(_env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
684 case LDKAPIError_ChannelUnavailable: {
685 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
686 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
687 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
688 return (*_env)->NewObject(_env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
690 case LDKAPIError_MonitorUpdateFailed: {
691 return (*_env)->NewObject(_env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
696 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
697 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
699 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
700 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
701 CHECK(val->result_ok);
702 return *val->contents.result;
704 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
705 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
706 CHECK(!val->result_ok);
707 long err_ref = (long)&(*val->contents.err);
710 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
711 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
713 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
714 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
715 CHECK(val->result_ok);
716 return *val->contents.result;
718 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
719 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
720 CHECK(!val->result_ok);
721 LDKPaymentSendFailure err_var = (*val->contents.err);
722 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
723 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
724 long err_ref = (long)err_var.inner & ~1;
727 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) {
728 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
729 LDKChannelAnnouncement a_conv;
730 a_conv.inner = (void*)(a & (~1));
731 a_conv.is_owned = (a & 1) || (a == 0);
732 if (a_conv.inner != NULL)
733 a_conv = ChannelAnnouncement_clone(&a_conv);
735 LDKChannelUpdate b_conv;
736 b_conv.inner = (void*)(b & (~1));
737 b_conv.is_owned = (b & 1) || (b == 0);
738 if (b_conv.inner != NULL)
739 b_conv = ChannelUpdate_clone(&b_conv);
741 LDKChannelUpdate c_conv;
742 c_conv.inner = (void*)(c & (~1));
743 c_conv.is_owned = (c & 1) || (c == 0);
744 if (c_conv.inner != NULL)
745 c_conv = ChannelUpdate_clone(&c_conv);
749 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
750 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
752 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
753 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
754 CHECK(val->result_ok);
755 return *val->contents.result;
757 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
758 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
759 CHECK(!val->result_ok);
760 LDKPeerHandleError err_var = (*val->contents.err);
761 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
762 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
763 long err_ref = (long)err_var.inner & ~1;
766 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
767 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
768 LDKHTLCOutputInCommitment a_conv;
769 a_conv.inner = (void*)(a & (~1));
770 a_conv.is_owned = (a & 1) || (a == 0);
771 if (a_conv.inner != NULL)
772 a_conv = HTLCOutputInCommitment_clone(&a_conv);
775 CHECK((*_env)->GetArrayLength (_env, b) == 64);
776 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
780 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
781 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
782 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
783 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
784 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
785 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
787 LDKSpendableOutputDescriptor_StaticOutput_class =
788 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
789 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
790 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
791 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
792 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
793 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
794 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
795 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
796 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
797 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
798 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
799 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
800 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
801 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
803 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
804 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
806 case LDKSpendableOutputDescriptor_StaticOutput: {
807 LDKOutPoint outpoint_var = obj->static_output.outpoint;
808 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
809 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
810 long outpoint_ref = (long)outpoint_var.inner & ~1;
811 long output_ref = (long)&obj->static_output.output;
812 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
814 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
815 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
816 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
817 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
818 long outpoint_ref = (long)outpoint_var.inner & ~1;
819 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
820 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
821 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
822 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
823 jbyteArray revocation_pubkey_arr = (*_env)->NewByteArray(_env, 33);
824 (*_env)->SetByteArrayRegion(_env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
825 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);
827 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
828 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
829 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
830 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
831 long outpoint_ref = (long)outpoint_var.inner & ~1;
832 long output_ref = (long)&obj->static_output_counterparty_payment.output;
833 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
834 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
839 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
840 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
841 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
843 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
844 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
845 ret->datalen = (*env)->GetArrayLength(env, elems);
846 if (ret->datalen == 0) {
849 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
850 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
851 for (size_t i = 0; i < ret->datalen; i++) {
852 jlong arr_elem = java_elems[i];
853 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
854 FREE((void*)arr_elem);
855 ret->data[i] = arr_elem_conv;
857 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
861 static jclass LDKEvent_FundingGenerationReady_class = NULL;
862 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
863 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
864 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
865 static jclass LDKEvent_PaymentReceived_class = NULL;
866 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
867 static jclass LDKEvent_PaymentSent_class = NULL;
868 static jmethodID LDKEvent_PaymentSent_meth = NULL;
869 static jclass LDKEvent_PaymentFailed_class = NULL;
870 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
871 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
872 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
873 static jclass LDKEvent_SpendableOutputs_class = NULL;
874 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
876 LDKEvent_FundingGenerationReady_class =
877 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
878 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
879 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
880 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
881 LDKEvent_FundingBroadcastSafe_class =
882 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
883 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
884 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
885 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
886 LDKEvent_PaymentReceived_class =
887 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
888 CHECK(LDKEvent_PaymentReceived_class != NULL);
889 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
890 CHECK(LDKEvent_PaymentReceived_meth != NULL);
891 LDKEvent_PaymentSent_class =
892 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
893 CHECK(LDKEvent_PaymentSent_class != NULL);
894 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
895 CHECK(LDKEvent_PaymentSent_meth != NULL);
896 LDKEvent_PaymentFailed_class =
897 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
898 CHECK(LDKEvent_PaymentFailed_class != NULL);
899 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
900 CHECK(LDKEvent_PaymentFailed_meth != NULL);
901 LDKEvent_PendingHTLCsForwardable_class =
902 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
903 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
904 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
905 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
906 LDKEvent_SpendableOutputs_class =
907 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
908 CHECK(LDKEvent_SpendableOutputs_class != NULL);
909 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
910 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
912 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
913 LDKEvent *obj = (LDKEvent*)ptr;
915 case LDKEvent_FundingGenerationReady: {
916 jbyteArray temporary_channel_id_arr = (*_env)->NewByteArray(_env, 32);
917 (*_env)->SetByteArrayRegion(_env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
918 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
919 jbyteArray output_script_arr = (*_env)->NewByteArray(_env, output_script_var.datalen);
920 (*_env)->SetByteArrayRegion(_env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
921 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);
923 case LDKEvent_FundingBroadcastSafe: {
924 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
925 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
926 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
927 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
928 return (*_env)->NewObject(_env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
930 case LDKEvent_PaymentReceived: {
931 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
932 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
933 jbyteArray payment_secret_arr = (*_env)->NewByteArray(_env, 32);
934 (*_env)->SetByteArrayRegion(_env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
935 return (*_env)->NewObject(_env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
937 case LDKEvent_PaymentSent: {
938 jbyteArray payment_preimage_arr = (*_env)->NewByteArray(_env, 32);
939 (*_env)->SetByteArrayRegion(_env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
940 return (*_env)->NewObject(_env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
942 case LDKEvent_PaymentFailed: {
943 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
944 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
945 return (*_env)->NewObject(_env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
947 case LDKEvent_PendingHTLCsForwardable: {
948 return (*_env)->NewObject(_env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
950 case LDKEvent_SpendableOutputs: {
951 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
952 jlongArray outputs_arr = (*_env)->NewLongArray(_env, outputs_var.datalen);
953 jlong *outputs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, outputs_arr, NULL);
954 for (size_t b = 0; b < outputs_var.datalen; b++) {
955 long arr_conv_27_ref = (long)&outputs_var.data[b];
956 outputs_arr_ptr[b] = arr_conv_27_ref;
958 (*_env)->ReleasePrimitiveArrayCritical(_env, outputs_arr, outputs_arr_ptr, 0);
959 return (*_env)->NewObject(_env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
964 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
965 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
966 static jclass LDKErrorAction_IgnoreError_class = NULL;
967 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
968 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
969 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
971 LDKErrorAction_DisconnectPeer_class =
972 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
973 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
974 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
975 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
976 LDKErrorAction_IgnoreError_class =
977 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
978 CHECK(LDKErrorAction_IgnoreError_class != NULL);
979 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
980 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
981 LDKErrorAction_SendErrorMessage_class =
982 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
983 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
984 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
985 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
987 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
988 LDKErrorAction *obj = (LDKErrorAction*)ptr;
990 case LDKErrorAction_DisconnectPeer: {
991 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
992 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
993 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
994 long msg_ref = (long)msg_var.inner & ~1;
995 return (*_env)->NewObject(_env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
997 case LDKErrorAction_IgnoreError: {
998 return (*_env)->NewObject(_env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1000 case LDKErrorAction_SendErrorMessage: {
1001 LDKErrorMessage msg_var = obj->send_error_message.msg;
1002 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1003 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1004 long msg_ref = (long)msg_var.inner & ~1;
1005 return (*_env)->NewObject(_env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1010 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1011 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1012 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1013 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1014 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1015 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
1017 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1018 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1019 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1020 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1021 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1022 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1023 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1024 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1025 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1026 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1027 LDKHTLCFailChannelUpdate_NodeFailure_class =
1028 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1029 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1030 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1031 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1033 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1034 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
1036 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1037 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1038 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1039 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1040 long msg_ref = (long)msg_var.inner & ~1;
1041 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1043 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1044 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1046 case LDKHTLCFailChannelUpdate_NodeFailure: {
1047 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1048 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1049 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1054 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1055 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1056 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1057 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1058 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1059 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1060 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1061 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1062 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1063 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1064 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1065 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1066 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1067 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1068 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1069 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1070 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1071 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1072 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1073 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1074 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1075 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1076 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1077 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1078 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1079 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1080 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1081 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1082 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1083 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1084 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1085 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1087 LDKMessageSendEvent_SendAcceptChannel_class =
1088 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1089 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1090 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1091 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1092 LDKMessageSendEvent_SendOpenChannel_class =
1093 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1094 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1095 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1096 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1097 LDKMessageSendEvent_SendFundingCreated_class =
1098 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1099 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1100 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1101 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1102 LDKMessageSendEvent_SendFundingSigned_class =
1103 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1104 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1105 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1106 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1107 LDKMessageSendEvent_SendFundingLocked_class =
1108 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1109 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1110 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1111 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1112 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1113 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1114 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1115 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1116 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1117 LDKMessageSendEvent_UpdateHTLCs_class =
1118 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1119 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1120 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1121 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1122 LDKMessageSendEvent_SendRevokeAndACK_class =
1123 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1124 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1125 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1126 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1127 LDKMessageSendEvent_SendClosingSigned_class =
1128 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1129 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1130 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1131 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1132 LDKMessageSendEvent_SendShutdown_class =
1133 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1134 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1135 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1136 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1137 LDKMessageSendEvent_SendChannelReestablish_class =
1138 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1139 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1140 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1141 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1142 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1143 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1144 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1145 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1146 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1147 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1148 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1149 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1150 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1151 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1152 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1153 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1154 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1155 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1156 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1157 LDKMessageSendEvent_HandleError_class =
1158 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1159 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1160 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1161 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1162 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1163 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1164 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1165 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1166 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1168 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1169 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1171 case LDKMessageSendEvent_SendAcceptChannel: {
1172 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1173 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1174 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1175 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1176 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1177 long msg_ref = (long)msg_var.inner & ~1;
1178 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1180 case LDKMessageSendEvent_SendOpenChannel: {
1181 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1182 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1183 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1184 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1185 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1186 long msg_ref = (long)msg_var.inner & ~1;
1187 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1189 case LDKMessageSendEvent_SendFundingCreated: {
1190 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1191 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1192 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1193 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1194 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1195 long msg_ref = (long)msg_var.inner & ~1;
1196 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1198 case LDKMessageSendEvent_SendFundingSigned: {
1199 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1200 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1201 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1202 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1203 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1204 long msg_ref = (long)msg_var.inner & ~1;
1205 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1207 case LDKMessageSendEvent_SendFundingLocked: {
1208 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1209 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1210 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1211 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1212 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1213 long msg_ref = (long)msg_var.inner & ~1;
1214 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1216 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1217 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1218 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1219 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1220 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1221 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1222 long msg_ref = (long)msg_var.inner & ~1;
1223 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1225 case LDKMessageSendEvent_UpdateHTLCs: {
1226 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1227 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1228 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1229 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1230 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1231 long updates_ref = (long)updates_var.inner & ~1;
1232 return (*_env)->NewObject(_env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1234 case LDKMessageSendEvent_SendRevokeAndACK: {
1235 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1236 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1237 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1238 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1239 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1240 long msg_ref = (long)msg_var.inner & ~1;
1241 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1243 case LDKMessageSendEvent_SendClosingSigned: {
1244 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1245 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1246 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1247 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1248 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1249 long msg_ref = (long)msg_var.inner & ~1;
1250 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1252 case LDKMessageSendEvent_SendShutdown: {
1253 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1254 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1255 LDKShutdown msg_var = obj->send_shutdown.msg;
1256 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1257 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1258 long msg_ref = (long)msg_var.inner & ~1;
1259 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1261 case LDKMessageSendEvent_SendChannelReestablish: {
1262 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1263 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1264 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1265 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1266 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1267 long msg_ref = (long)msg_var.inner & ~1;
1268 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1270 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1271 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1272 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1273 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1274 long msg_ref = (long)msg_var.inner & ~1;
1275 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1276 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1277 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1278 long update_msg_ref = (long)update_msg_var.inner & ~1;
1279 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1281 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1282 LDKNodeAnnouncement msg_var = obj->broadcast_node_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 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1288 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1289 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1290 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1291 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1292 long msg_ref = (long)msg_var.inner & ~1;
1293 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1295 case LDKMessageSendEvent_HandleError: {
1296 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1297 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1298 long action_ref = (long)&obj->handle_error.action;
1299 return (*_env)->NewObject(_env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1301 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1302 long update_ref = (long)&obj->payment_failure_network_update.update;
1303 return (*_env)->NewObject(_env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1308 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1309 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1310 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1312 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1313 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1314 ret->datalen = (*env)->GetArrayLength(env, elems);
1315 if (ret->datalen == 0) {
1318 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1319 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1320 for (size_t i = 0; i < ret->datalen; i++) {
1321 jlong arr_elem = java_elems[i];
1322 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1323 FREE((void*)arr_elem);
1324 ret->data[i] = arr_elem_conv;
1326 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1330 typedef struct LDKMessageSendEventsProvider_JCalls {
1331 atomic_size_t refcnt;
1334 jmethodID get_and_clear_pending_msg_events_meth;
1335 } LDKMessageSendEventsProvider_JCalls;
1336 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1337 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1339 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1340 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1342 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1343 LDKCVec_MessageSendEventZ ret_constr;
1344 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
1345 if (ret_constr.datalen > 0)
1346 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
1348 ret_constr.data = NULL;
1349 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
1350 for (size_t s = 0; s < ret_constr.datalen; s++) {
1351 long arr_conv_18 = ret_vals[s];
1352 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
1353 FREE((void*)arr_conv_18);
1354 ret_constr.data[s] = arr_conv_18_conv;
1356 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
1359 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1360 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1361 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1363 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1364 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1368 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1369 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1370 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1371 return (void*) this_arg;
1373 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1374 jclass c = (*env)->GetObjectClass(env, o);
1376 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1377 atomic_init(&calls->refcnt, 1);
1378 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1379 calls->o = (*env)->NewWeakGlobalRef(env, o);
1380 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
1381 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
1383 LDKMessageSendEventsProvider ret = {
1384 .this_arg = (void*) calls,
1385 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1386 .free = LDKMessageSendEventsProvider_JCalls_free,
1390 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1391 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1392 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1393 return (long)res_ptr;
1395 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1396 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1400 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1401 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1402 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1403 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1404 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1405 for (size_t s = 0; s < ret_var.datalen; s++) {
1406 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
1407 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
1408 long arr_conv_18_ref = (long)arr_conv_18_copy;
1409 ret_arr_ptr[s] = arr_conv_18_ref;
1411 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1412 CVec_MessageSendEventZ_free(ret_var);
1416 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1417 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1418 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1420 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1421 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1422 ret->datalen = (*env)->GetArrayLength(env, elems);
1423 if (ret->datalen == 0) {
1426 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1427 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1428 for (size_t i = 0; i < ret->datalen; i++) {
1429 jlong arr_elem = java_elems[i];
1430 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1431 FREE((void*)arr_elem);
1432 ret->data[i] = arr_elem_conv;
1434 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1438 typedef struct LDKEventsProvider_JCalls {
1439 atomic_size_t refcnt;
1442 jmethodID get_and_clear_pending_events_meth;
1443 } LDKEventsProvider_JCalls;
1444 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1445 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1447 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1448 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1450 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_events_meth);
1451 LDKCVec_EventZ ret_constr;
1452 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
1453 if (ret_constr.datalen > 0)
1454 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
1456 ret_constr.data = NULL;
1457 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
1458 for (size_t h = 0; h < ret_constr.datalen; h++) {
1459 long arr_conv_7 = ret_vals[h];
1460 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
1461 FREE((void*)arr_conv_7);
1462 ret_constr.data[h] = arr_conv_7_conv;
1464 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
1467 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1468 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1469 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1471 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1472 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1476 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1477 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1478 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1479 return (void*) this_arg;
1481 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1482 jclass c = (*env)->GetObjectClass(env, o);
1484 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1485 atomic_init(&calls->refcnt, 1);
1486 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1487 calls->o = (*env)->NewWeakGlobalRef(env, o);
1488 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
1489 CHECK(calls->get_and_clear_pending_events_meth != NULL);
1491 LDKEventsProvider ret = {
1492 .this_arg = (void*) calls,
1493 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1494 .free = LDKEventsProvider_JCalls_free,
1498 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1499 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1500 *res_ptr = LDKEventsProvider_init(env, _a, o);
1501 return (long)res_ptr;
1503 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1504 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1508 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1509 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1510 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1511 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1512 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1513 for (size_t h = 0; h < ret_var.datalen; h++) {
1514 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
1515 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
1516 long arr_conv_7_ref = (long)arr_conv_7_copy;
1517 ret_arr_ptr[h] = arr_conv_7_ref;
1519 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1520 CVec_EventZ_free(ret_var);
1524 typedef struct LDKLogger_JCalls {
1525 atomic_size_t refcnt;
1530 void log_jcall(const void* this_arg, const char *record) {
1531 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1533 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1534 jstring record_conv = (*_env)->NewStringUTF(_env, record);
1535 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1537 return (*_env)->CallVoidMethod(_env, obj, j_calls->log_meth, record_conv);
1539 static void LDKLogger_JCalls_free(void* this_arg) {
1540 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1541 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1543 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1544 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1548 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1549 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1550 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1551 return (void*) this_arg;
1553 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1554 jclass c = (*env)->GetObjectClass(env, o);
1556 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1557 atomic_init(&calls->refcnt, 1);
1558 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1559 calls->o = (*env)->NewWeakGlobalRef(env, o);
1560 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1561 CHECK(calls->log_meth != NULL);
1564 .this_arg = (void*) calls,
1566 .free = LDKLogger_JCalls_free,
1570 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1571 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1572 *res_ptr = LDKLogger_init(env, _a, o);
1573 return (long)res_ptr;
1575 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1576 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1580 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1581 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1583 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1584 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1585 CHECK(val->result_ok);
1586 long res_ref = (long)&(*val->contents.result);
1589 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1590 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1591 CHECK(!val->result_ok);
1592 jclass err_conv = LDKAccessError_to_java(_env, (*val->contents.err));
1595 typedef struct LDKAccess_JCalls {
1596 atomic_size_t refcnt;
1599 jmethodID get_utxo_meth;
1601 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1602 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1604 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1605 jbyteArray genesis_hash_arr = (*_env)->NewByteArray(_env, 32);
1606 (*_env)->SetByteArrayRegion(_env, genesis_hash_arr, 0, 32, *genesis_hash);
1607 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1609 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1610 LDKCResult_TxOutAccessErrorZ res = *ret;
1614 static void LDKAccess_JCalls_free(void* this_arg) {
1615 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1616 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1618 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1619 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1623 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1624 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1625 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1626 return (void*) this_arg;
1628 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1629 jclass c = (*env)->GetObjectClass(env, o);
1631 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1632 atomic_init(&calls->refcnt, 1);
1633 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1634 calls->o = (*env)->NewWeakGlobalRef(env, o);
1635 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1636 CHECK(calls->get_utxo_meth != NULL);
1639 .this_arg = (void*) calls,
1640 .get_utxo = get_utxo_jcall,
1641 .free = LDKAccess_JCalls_free,
1645 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1646 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1647 *res_ptr = LDKAccess_init(env, _a, o);
1648 return (long)res_ptr;
1650 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1651 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1655 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) {
1656 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1657 unsigned char genesis_hash_arr[32];
1658 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
1659 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1660 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1661 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1662 *ret = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1666 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1667 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1668 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1669 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1670 for (size_t i = 0; i < vec->datalen; i++) {
1671 CHECK((((long)vec->data[i].inner) & 1) == 0);
1672 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1674 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1677 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1678 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1679 ret->datalen = (*env)->GetArrayLength(env, elems);
1680 if (ret->datalen == 0) {
1683 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1684 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1685 for (size_t i = 0; i < ret->datalen; i++) {
1686 jlong arr_elem = java_elems[i];
1687 LDKHTLCOutputInCommitment arr_elem_conv;
1688 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1689 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1690 if (arr_elem_conv.inner != NULL)
1691 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1692 ret->data[i] = arr_elem_conv;
1694 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1698 typedef struct LDKChannelKeys_JCalls {
1699 atomic_size_t refcnt;
1702 jmethodID get_per_commitment_point_meth;
1703 jmethodID release_commitment_secret_meth;
1704 jmethodID key_derivation_params_meth;
1705 jmethodID sign_counterparty_commitment_meth;
1706 jmethodID sign_holder_commitment_meth;
1707 jmethodID sign_holder_commitment_htlc_transactions_meth;
1708 jmethodID sign_justice_transaction_meth;
1709 jmethodID sign_counterparty_htlc_transaction_meth;
1710 jmethodID sign_closing_transaction_meth;
1711 jmethodID sign_channel_announcement_meth;
1712 jmethodID on_accept_meth;
1713 } LDKChannelKeys_JCalls;
1714 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1715 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1717 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1718 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1720 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_per_commitment_point_meth, idx);
1721 LDKPublicKey ret_ref;
1722 CHECK((*_env)->GetArrayLength (_env, ret) == 33);
1723 (*_env)->GetByteArrayRegion (_env, ret, 0, 33, ret_ref.compressed_form);
1726 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1727 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1729 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1730 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1732 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->release_commitment_secret_meth, idx);
1733 LDKThirtyTwoBytes ret_ref;
1734 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
1735 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.data);
1738 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1739 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1741 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1742 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1744 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*_env)->CallLongMethod(_env, obj, j_calls->key_derivation_params_meth);
1745 LDKC2Tuple_u64u64Z res = *ret;
1749 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) {
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 long commitment_tx_ref = (long)&commitment_tx;
1754 LDKCVec_HTLCOutputInCommitmentZ htlcs_var = htlcs;
1755 jlongArray htlcs_arr = (*_env)->NewLongArray(_env, htlcs_var.datalen);
1756 jlong *htlcs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, htlcs_arr, NULL);
1757 for (size_t y = 0; y < htlcs_var.datalen; y++) {
1758 LDKHTLCOutputInCommitment arr_conv_24_var = htlcs_var.data[y];
1759 CHECK((((long)arr_conv_24_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1760 CHECK((((long)&arr_conv_24_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1761 long arr_conv_24_ref;
1762 if (arr_conv_24_var.is_owned) {
1763 arr_conv_24_ref = (long)arr_conv_24_var.inner | 1;
1765 arr_conv_24_ref = (long)arr_conv_24_var.inner & ~1;
1767 htlcs_arr_ptr[y] = arr_conv_24_ref;
1769 (*_env)->ReleasePrimitiveArrayCritical(_env, htlcs_arr, htlcs_arr_ptr, 0);
1770 FREE(htlcs_var.data);
1771 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1773 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);
1774 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
1778 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1779 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1781 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1782 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1784 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx);
1785 LDKCResult_SignatureNoneZ res = *ret;
1789 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1790 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1792 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1793 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1795 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx);
1796 LDKCResult_CVec_SignatureZNoneZ res = *ret;
1800 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) {
1801 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1803 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1804 long justice_tx_ref = (long)&justice_tx;
1805 jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32);
1806 (*_env)->SetByteArrayRegion(_env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1807 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1809 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);
1810 LDKCResult_SignatureNoneZ res = *ret;
1814 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) {
1815 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1817 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1818 long htlc_tx_ref = (long)&htlc_tx;
1819 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
1820 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1821 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1823 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);
1824 LDKCResult_SignatureNoneZ res = *ret;
1828 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1829 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1831 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1832 long closing_tx_ref = (long)&closing_tx;
1833 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1835 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1836 LDKCResult_SignatureNoneZ res = *ret;
1840 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1841 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1843 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1844 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1846 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, msg);
1847 LDKCResult_SignatureNoneZ res = *ret;
1851 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1852 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1854 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1855 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1857 return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
1859 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1860 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1861 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1863 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1864 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1868 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1869 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1870 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1871 return (void*) this_arg;
1873 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o) {
1874 jclass c = (*env)->GetObjectClass(env, o);
1876 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1877 atomic_init(&calls->refcnt, 1);
1878 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1879 calls->o = (*env)->NewWeakGlobalRef(env, o);
1880 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1881 CHECK(calls->get_per_commitment_point_meth != NULL);
1882 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1883 CHECK(calls->release_commitment_secret_meth != NULL);
1884 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1885 CHECK(calls->key_derivation_params_meth != NULL);
1886 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJ[J)J");
1887 CHECK(calls->sign_counterparty_commitment_meth != NULL);
1888 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1889 CHECK(calls->sign_holder_commitment_meth != NULL);
1890 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1891 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1892 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
1893 CHECK(calls->sign_justice_transaction_meth != NULL);
1894 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
1895 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
1896 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
1897 CHECK(calls->sign_closing_transaction_meth != NULL);
1898 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1899 CHECK(calls->sign_channel_announcement_meth != NULL);
1900 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
1901 CHECK(calls->on_accept_meth != NULL);
1903 LDKChannelKeys ret = {
1904 .this_arg = (void*) calls,
1905 .get_per_commitment_point = get_per_commitment_point_jcall,
1906 .release_commitment_secret = release_commitment_secret_jcall,
1907 .key_derivation_params = key_derivation_params_jcall,
1908 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1909 .sign_holder_commitment = sign_holder_commitment_jcall,
1910 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1911 .sign_justice_transaction = sign_justice_transaction_jcall,
1912 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1913 .sign_closing_transaction = sign_closing_transaction_jcall,
1914 .sign_channel_announcement = sign_channel_announcement_jcall,
1915 .on_accept = on_accept_jcall,
1916 .clone = LDKChannelKeys_JCalls_clone,
1917 .free = LDKChannelKeys_JCalls_free,
1921 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) {
1922 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1923 *res_ptr = LDKChannelKeys_init(env, _a, o);
1924 return (long)res_ptr;
1926 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1927 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
1931 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1932 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1933 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
1934 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
1938 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1939 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1940 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
1941 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
1945 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
1946 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1947 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1948 *ret = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1952 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) {
1953 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1954 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
1955 FREE((void*)commitment_tx);
1956 LDKPreCalculatedTxCreationKeys keys_conv;
1957 keys_conv.inner = (void*)(keys & (~1));
1958 keys_conv.is_owned = (keys & 1) || (keys == 0);
1959 LDKCVec_HTLCOutputInCommitmentZ htlcs_constr;
1960 htlcs_constr.datalen = (*_env)->GetArrayLength (_env, htlcs);
1961 if (htlcs_constr.datalen > 0)
1962 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
1964 htlcs_constr.data = NULL;
1965 long* htlcs_vals = (*_env)->GetLongArrayElements (_env, htlcs, NULL);
1966 for (size_t y = 0; y < htlcs_constr.datalen; y++) {
1967 long arr_conv_24 = htlcs_vals[y];
1968 LDKHTLCOutputInCommitment arr_conv_24_conv;
1969 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
1970 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
1971 if (arr_conv_24_conv.inner != NULL)
1972 arr_conv_24_conv = HTLCOutputInCommitment_clone(&arr_conv_24_conv);
1973 htlcs_constr.data[y] = arr_conv_24_conv;
1975 (*_env)->ReleaseLongArrayElements (_env, htlcs, htlcs_vals, 0);
1976 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1977 *ret = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_constr);
1981 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
1982 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1983 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1984 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1985 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1986 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1987 *ret = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
1991 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) {
1992 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1993 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1994 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1995 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1996 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1997 *ret = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2001 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) {
2002 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2003 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
2004 FREE((void*)justice_tx);
2005 unsigned char per_commitment_key_arr[32];
2006 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
2007 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
2008 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2009 LDKHTLCOutputInCommitment htlc_conv;
2010 htlc_conv.inner = (void*)(htlc & (~1));
2011 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2012 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2013 *ret = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
2017 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) {
2018 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2019 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
2020 FREE((void*)htlc_tx);
2021 LDKPublicKey per_commitment_point_ref;
2022 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
2023 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2024 LDKHTLCOutputInCommitment htlc_conv;
2025 htlc_conv.inner = (void*)(htlc & (~1));
2026 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2027 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2028 *ret = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv);
2032 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) {
2033 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2034 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
2035 FREE((void*)closing_tx);
2036 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2037 *ret = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv);
2041 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
2042 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2043 LDKUnsignedChannelAnnouncement msg_conv;
2044 msg_conv.inner = (void*)(msg & (~1));
2045 msg_conv.is_owned = (msg & 1) || (msg == 0);
2046 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2047 *ret = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2051 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) {
2052 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2053 LDKChannelPublicKeys channel_points_conv;
2054 channel_points_conv.inner = (void*)(channel_points & (~1));
2055 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2056 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2059 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2060 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2061 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2062 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2063 for (size_t i = 0; i < vec->datalen; i++) {
2064 CHECK((((long)vec->data[i].inner) & 1) == 0);
2065 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2067 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2070 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2071 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2072 ret->datalen = (*env)->GetArrayLength(env, elems);
2073 if (ret->datalen == 0) {
2076 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2077 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2078 for (size_t i = 0; i < ret->datalen; i++) {
2079 jlong arr_elem = java_elems[i];
2080 LDKMonitorEvent arr_elem_conv;
2081 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2082 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2083 // Warning: we may need a move here but can't clone!
2084 ret->data[i] = arr_elem_conv;
2086 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2090 typedef struct LDKWatch_JCalls {
2091 atomic_size_t refcnt;
2094 jmethodID watch_channel_meth;
2095 jmethodID update_channel_meth;
2096 jmethodID release_pending_monitor_events_meth;
2098 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2099 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2101 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2102 LDKOutPoint funding_txo_var = funding_txo;
2103 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2104 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2105 long funding_txo_ref;
2106 if (funding_txo_var.is_owned) {
2107 funding_txo_ref = (long)funding_txo_var.inner | 1;
2109 funding_txo_ref = (long)funding_txo_var.inner & ~1;
2111 LDKChannelMonitor monitor_var = monitor;
2112 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2113 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2115 if (monitor_var.is_owned) {
2116 monitor_ref = (long)monitor_var.inner | 1;
2118 monitor_ref = (long)monitor_var.inner & ~1;
2120 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2122 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2123 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2127 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2128 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2130 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2131 LDKOutPoint funding_txo_var = funding_txo;
2132 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2133 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2134 long funding_txo_ref;
2135 if (funding_txo_var.is_owned) {
2136 funding_txo_ref = (long)funding_txo_var.inner | 1;
2138 funding_txo_ref = (long)funding_txo_var.inner & ~1;
2140 LDKChannelMonitorUpdate update_var = update;
2141 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2142 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2144 if (update_var.is_owned) {
2145 update_ref = (long)update_var.inner | 1;
2147 update_ref = (long)update_var.inner & ~1;
2149 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2151 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2152 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2156 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2157 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2159 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2160 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2162 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->release_pending_monitor_events_meth);
2163 LDKCVec_MonitorEventZ ret_constr;
2164 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
2165 if (ret_constr.datalen > 0)
2166 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2168 ret_constr.data = NULL;
2169 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
2170 for (size_t o = 0; o < ret_constr.datalen; o++) {
2171 long arr_conv_14 = ret_vals[o];
2172 LDKMonitorEvent arr_conv_14_conv;
2173 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2174 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2175 // Warning: we may need a move here but can't clone!
2176 ret_constr.data[o] = arr_conv_14_conv;
2178 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
2181 static void LDKWatch_JCalls_free(void* this_arg) {
2182 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2183 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2185 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2186 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2190 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2191 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2192 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2193 return (void*) this_arg;
2195 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2196 jclass c = (*env)->GetObjectClass(env, o);
2198 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2199 atomic_init(&calls->refcnt, 1);
2200 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2201 calls->o = (*env)->NewWeakGlobalRef(env, o);
2202 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2203 CHECK(calls->watch_channel_meth != NULL);
2204 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2205 CHECK(calls->update_channel_meth != NULL);
2206 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2207 CHECK(calls->release_pending_monitor_events_meth != NULL);
2210 .this_arg = (void*) calls,
2211 .watch_channel = watch_channel_jcall,
2212 .update_channel = update_channel_jcall,
2213 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2214 .free = LDKWatch_JCalls_free,
2218 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2219 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2220 *res_ptr = LDKWatch_init(env, _a, o);
2221 return (long)res_ptr;
2223 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2224 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2228 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2229 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2230 LDKOutPoint funding_txo_conv;
2231 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2232 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2233 if (funding_txo_conv.inner != NULL)
2234 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2235 LDKChannelMonitor monitor_conv;
2236 monitor_conv.inner = (void*)(monitor & (~1));
2237 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2238 // Warning: we may need a move here but can't clone!
2239 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2240 *ret = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2244 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2245 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2246 LDKOutPoint funding_txo_conv;
2247 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2248 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2249 if (funding_txo_conv.inner != NULL)
2250 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2251 LDKChannelMonitorUpdate update_conv;
2252 update_conv.inner = (void*)(update & (~1));
2253 update_conv.is_owned = (update & 1) || (update == 0);
2254 if (update_conv.inner != NULL)
2255 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2256 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2257 *ret = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2261 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2262 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2263 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2264 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
2265 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
2266 for (size_t o = 0; o < ret_var.datalen; o++) {
2267 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2268 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2269 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2270 long arr_conv_14_ref;
2271 if (arr_conv_14_var.is_owned) {
2272 arr_conv_14_ref = (long)arr_conv_14_var.inner | 1;
2274 arr_conv_14_ref = (long)arr_conv_14_var.inner & ~1;
2276 ret_arr_ptr[o] = arr_conv_14_ref;
2278 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
2283 typedef struct LDKFilter_JCalls {
2284 atomic_size_t refcnt;
2287 jmethodID register_tx_meth;
2288 jmethodID register_output_meth;
2290 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2291 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2293 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2294 jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
2295 (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
2296 LDKu8slice script_pubkey_var = script_pubkey;
2297 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2298 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2299 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2301 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2303 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2304 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2306 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2307 LDKu8slice script_pubkey_var = script_pubkey;
2308 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2309 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2310 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2312 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, outpoint, script_pubkey_arr);
2314 static void LDKFilter_JCalls_free(void* this_arg) {
2315 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2316 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2318 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2319 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2323 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2324 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2325 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2326 return (void*) this_arg;
2328 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2329 jclass c = (*env)->GetObjectClass(env, o);
2331 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2332 atomic_init(&calls->refcnt, 1);
2333 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2334 calls->o = (*env)->NewWeakGlobalRef(env, o);
2335 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2336 CHECK(calls->register_tx_meth != NULL);
2337 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2338 CHECK(calls->register_output_meth != NULL);
2341 .this_arg = (void*) calls,
2342 .register_tx = register_tx_jcall,
2343 .register_output = register_output_jcall,
2344 .free = LDKFilter_JCalls_free,
2348 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2349 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2350 *res_ptr = LDKFilter_init(env, _a, o);
2351 return (long)res_ptr;
2353 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2354 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2359 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2360 unsigned char txid_arr[32];
2361 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2362 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2363 unsigned char (*txid_ref)[32] = &txid_arr;
2364 LDKu8slice script_pubkey_ref;
2365 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2366 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2367 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2368 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2372 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2373 LDKOutPoint outpoint_conv;
2374 outpoint_conv.inner = (void*)(outpoint & (~1));
2375 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2376 LDKu8slice script_pubkey_ref;
2377 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2378 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2379 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2380 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2383 typedef struct LDKBroadcasterInterface_JCalls {
2384 atomic_size_t refcnt;
2387 jmethodID broadcast_transaction_meth;
2388 } LDKBroadcasterInterface_JCalls;
2389 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2390 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2392 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2393 long tx_ref = (long)&tx;
2394 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2396 return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2398 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2399 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2400 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2402 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2403 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2407 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2408 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2409 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2410 return (void*) this_arg;
2412 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2413 jclass c = (*env)->GetObjectClass(env, o);
2415 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2416 atomic_init(&calls->refcnt, 1);
2417 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2418 calls->o = (*env)->NewWeakGlobalRef(env, o);
2419 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2420 CHECK(calls->broadcast_transaction_meth != NULL);
2422 LDKBroadcasterInterface ret = {
2423 .this_arg = (void*) calls,
2424 .broadcast_transaction = broadcast_transaction_jcall,
2425 .free = LDKBroadcasterInterface_JCalls_free,
2429 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2430 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2431 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2432 return (long)res_ptr;
2434 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2435 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2440 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2441 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2443 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv);
2446 typedef struct LDKFeeEstimator_JCalls {
2447 atomic_size_t refcnt;
2450 jmethodID get_est_sat_per_1000_weight_meth;
2451 } LDKFeeEstimator_JCalls;
2452 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2453 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2455 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2456 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target);
2457 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2459 return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2461 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2462 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2463 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2465 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2466 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2470 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2471 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2472 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2473 return (void*) this_arg;
2475 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2476 jclass c = (*env)->GetObjectClass(env, o);
2478 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2479 atomic_init(&calls->refcnt, 1);
2480 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2481 calls->o = (*env)->NewWeakGlobalRef(env, o);
2482 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2483 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2485 LDKFeeEstimator ret = {
2486 .this_arg = (void*) calls,
2487 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2488 .free = LDKFeeEstimator_JCalls_free,
2492 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2493 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2494 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2495 return (long)res_ptr;
2497 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2498 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2502 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) {
2503 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2504 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2505 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2509 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2510 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2511 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2513 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2514 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2515 ret->datalen = (*env)->GetArrayLength(env, elems);
2516 if (ret->datalen == 0) {
2519 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2520 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2521 for (size_t i = 0; i < ret->datalen; i++) {
2522 jlong arr_elem = java_elems[i];
2523 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2524 FREE((void*)arr_elem);
2525 ret->data[i] = arr_elem_conv;
2527 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2531 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2532 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2533 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2536 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2537 ret->datalen = (*env)->GetArrayLength(env, elems);
2538 if (ret->datalen == 0) {
2541 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2542 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2543 for (size_t i = 0; i < ret->datalen; i++) {
2544 jlong arr_elem = java_elems[i];
2545 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2546 FREE((void*)arr_elem);
2547 ret->data[i] = arr_elem_conv;
2549 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2553 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2554 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2555 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2558 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2559 ret->datalen = (*env)->GetArrayLength(env, elems);
2560 if (ret->datalen == 0) {
2563 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2564 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2565 for (size_t i = 0; i < ret->datalen; i++) {
2566 jlong arr_elem = java_elems[i];
2567 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2568 FREE((void*)arr_elem);
2569 ret->data[i] = arr_elem_conv;
2571 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2575 typedef struct LDKKeysInterface_JCalls {
2576 atomic_size_t refcnt;
2579 jmethodID get_node_secret_meth;
2580 jmethodID get_destination_script_meth;
2581 jmethodID get_shutdown_pubkey_meth;
2582 jmethodID get_channel_keys_meth;
2583 jmethodID get_secure_random_bytes_meth;
2584 } LDKKeysInterface_JCalls;
2585 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2586 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2588 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2589 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2591 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth);
2592 LDKSecretKey ret_ref;
2593 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
2594 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.bytes);
2597 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2598 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2600 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2601 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2603 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_destination_script_meth);
2604 LDKCVec_u8Z ret_ref;
2605 ret_ref.data = (*_env)->GetByteArrayElements (_env, ret, NULL);
2606 ret_ref.datalen = (*_env)->GetArrayLength (_env, ret);
2609 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2610 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2612 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2613 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2615 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_shutdown_pubkey_meth);
2616 LDKPublicKey ret_ref;
2617 CHECK((*_env)->GetArrayLength (_env, ret) == 33);
2618 (*_env)->GetByteArrayRegion (_env, ret, 0, 33, ret_ref.compressed_form);
2621 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2622 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2624 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2625 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2627 LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2628 LDKChannelKeys res = *ret;
2632 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2633 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2635 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2636 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2638 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth);
2639 LDKThirtyTwoBytes ret_ref;
2640 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
2641 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.data);
2644 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2645 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2646 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2648 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2649 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2653 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2654 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2655 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2656 return (void*) this_arg;
2658 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2659 jclass c = (*env)->GetObjectClass(env, o);
2661 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2662 atomic_init(&calls->refcnt, 1);
2663 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2664 calls->o = (*env)->NewWeakGlobalRef(env, o);
2665 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2666 CHECK(calls->get_node_secret_meth != NULL);
2667 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2668 CHECK(calls->get_destination_script_meth != NULL);
2669 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2670 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2671 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2672 CHECK(calls->get_channel_keys_meth != NULL);
2673 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2674 CHECK(calls->get_secure_random_bytes_meth != NULL);
2676 LDKKeysInterface ret = {
2677 .this_arg = (void*) calls,
2678 .get_node_secret = get_node_secret_jcall,
2679 .get_destination_script = get_destination_script_jcall,
2680 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2681 .get_channel_keys = get_channel_keys_jcall,
2682 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2683 .free = LDKKeysInterface_JCalls_free,
2687 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2688 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2689 *res_ptr = LDKKeysInterface_init(env, _a, o);
2690 return (long)res_ptr;
2692 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2693 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2697 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2698 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2699 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2700 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2704 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2705 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2706 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2707 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2708 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2709 CVec_u8Z_free(arg_var);
2713 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2714 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2715 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2716 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2720 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) {
2721 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2722 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2723 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2727 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2728 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2729 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2730 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2734 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2735 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2736 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2737 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2738 for (size_t i = 0; i < vec->datalen; i++) {
2739 CHECK((((long)vec->data[i].inner) & 1) == 0);
2740 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2742 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2745 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2746 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2747 ret->datalen = (*env)->GetArrayLength(env, elems);
2748 if (ret->datalen == 0) {
2751 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2752 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2753 for (size_t i = 0; i < ret->datalen; i++) {
2754 jlong arr_elem = java_elems[i];
2755 LDKChannelDetails arr_elem_conv;
2756 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2757 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2758 if (arr_elem_conv.inner != NULL)
2759 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2760 ret->data[i] = arr_elem_conv;
2762 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2766 static jclass LDKNetAddress_IPv4_class = NULL;
2767 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2768 static jclass LDKNetAddress_IPv6_class = NULL;
2769 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2770 static jclass LDKNetAddress_OnionV2_class = NULL;
2771 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2772 static jclass LDKNetAddress_OnionV3_class = NULL;
2773 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2775 LDKNetAddress_IPv4_class =
2776 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2777 CHECK(LDKNetAddress_IPv4_class != NULL);
2778 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2779 CHECK(LDKNetAddress_IPv4_meth != NULL);
2780 LDKNetAddress_IPv6_class =
2781 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2782 CHECK(LDKNetAddress_IPv6_class != NULL);
2783 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2784 CHECK(LDKNetAddress_IPv6_meth != NULL);
2785 LDKNetAddress_OnionV2_class =
2786 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2787 CHECK(LDKNetAddress_OnionV2_class != NULL);
2788 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2789 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2790 LDKNetAddress_OnionV3_class =
2791 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2792 CHECK(LDKNetAddress_OnionV3_class != NULL);
2793 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2794 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2796 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
2797 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2799 case LDKNetAddress_IPv4: {
2800 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 4);
2801 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 4, obj->i_pv4.addr.data);
2802 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
2804 case LDKNetAddress_IPv6: {
2805 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 16);
2806 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 16, obj->i_pv6.addr.data);
2807 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
2809 case LDKNetAddress_OnionV2: {
2810 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 10);
2811 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 10, obj->onion_v2.addr.data);
2812 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
2814 case LDKNetAddress_OnionV3: {
2815 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
2816 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2817 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);
2822 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2823 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2824 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2826 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2827 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2828 ret->datalen = (*env)->GetArrayLength(env, elems);
2829 if (ret->datalen == 0) {
2832 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2833 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2834 for (size_t i = 0; i < ret->datalen; i++) {
2835 jlong arr_elem = java_elems[i];
2836 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2837 FREE((void*)arr_elem);
2838 ret->data[i] = arr_elem_conv;
2840 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2844 typedef struct LDKChannelMessageHandler_JCalls {
2845 atomic_size_t refcnt;
2848 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2849 jmethodID handle_open_channel_meth;
2850 jmethodID handle_accept_channel_meth;
2851 jmethodID handle_funding_created_meth;
2852 jmethodID handle_funding_signed_meth;
2853 jmethodID handle_funding_locked_meth;
2854 jmethodID handle_shutdown_meth;
2855 jmethodID handle_closing_signed_meth;
2856 jmethodID handle_update_add_htlc_meth;
2857 jmethodID handle_update_fulfill_htlc_meth;
2858 jmethodID handle_update_fail_htlc_meth;
2859 jmethodID handle_update_fail_malformed_htlc_meth;
2860 jmethodID handle_commitment_signed_meth;
2861 jmethodID handle_revoke_and_ack_meth;
2862 jmethodID handle_update_fee_meth;
2863 jmethodID handle_announcement_signatures_meth;
2864 jmethodID peer_disconnected_meth;
2865 jmethodID peer_connected_meth;
2866 jmethodID handle_channel_reestablish_meth;
2867 jmethodID handle_error_meth;
2868 } LDKChannelMessageHandler_JCalls;
2869 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
2870 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2872 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2873 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2874 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2875 LDKInitFeatures their_features_var = their_features;
2876 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2877 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2878 long their_features_ref;
2879 if (their_features_var.is_owned) {
2880 their_features_ref = (long)their_features_var.inner | 1;
2882 their_features_ref = (long)their_features_var.inner & ~1;
2884 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2886 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg);
2888 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
2889 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2891 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2892 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2893 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2894 LDKInitFeatures their_features_var = their_features;
2895 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2896 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2897 long their_features_ref;
2898 if (their_features_var.is_owned) {
2899 their_features_ref = (long)their_features_var.inner | 1;
2901 their_features_ref = (long)their_features_var.inner & ~1;
2903 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2905 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg);
2907 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
2908 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2910 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2911 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2912 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2913 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2915 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg);
2917 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
2918 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2920 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2921 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2922 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2923 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2925 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg);
2927 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
2928 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2930 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2931 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2932 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2933 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2935 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg);
2937 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
2938 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2940 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2941 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2942 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2943 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2945 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg);
2947 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
2948 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2950 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2951 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2952 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2953 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2955 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg);
2957 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
2958 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2960 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2961 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2962 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2963 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2965 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg);
2967 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
2968 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2970 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2971 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2972 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2973 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2975 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg);
2977 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
2978 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2980 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2981 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2982 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2983 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2985 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg);
2987 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
2988 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2990 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2991 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2992 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2993 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2995 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg);
2997 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
2998 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3000 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3001 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3002 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3003 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3005 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg);
3007 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
3008 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3010 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3011 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3012 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3013 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3015 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg);
3017 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
3018 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3020 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3021 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3022 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3023 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3025 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg);
3027 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
3028 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3030 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3031 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3032 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3033 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3035 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg);
3037 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3038 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3040 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3041 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3042 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3043 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3045 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
3047 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
3048 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3050 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3051 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3052 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3053 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3055 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg);
3057 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3058 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3060 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3061 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3062 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3063 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3065 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg);
3067 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
3068 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3070 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3071 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3072 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3073 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3075 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, msg);
3077 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3078 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3079 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3081 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3082 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3086 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3087 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3088 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3089 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3090 return (void*) this_arg;
3092 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3093 jclass c = (*env)->GetObjectClass(env, o);
3095 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3096 atomic_init(&calls->refcnt, 1);
3097 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3098 calls->o = (*env)->NewWeakGlobalRef(env, o);
3099 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3100 CHECK(calls->handle_open_channel_meth != NULL);
3101 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3102 CHECK(calls->handle_accept_channel_meth != NULL);
3103 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3104 CHECK(calls->handle_funding_created_meth != NULL);
3105 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3106 CHECK(calls->handle_funding_signed_meth != NULL);
3107 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3108 CHECK(calls->handle_funding_locked_meth != NULL);
3109 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3110 CHECK(calls->handle_shutdown_meth != NULL);
3111 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3112 CHECK(calls->handle_closing_signed_meth != NULL);
3113 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3114 CHECK(calls->handle_update_add_htlc_meth != NULL);
3115 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3116 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3117 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3118 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3119 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3120 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3121 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3122 CHECK(calls->handle_commitment_signed_meth != NULL);
3123 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3124 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3125 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3126 CHECK(calls->handle_update_fee_meth != NULL);
3127 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3128 CHECK(calls->handle_announcement_signatures_meth != NULL);
3129 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3130 CHECK(calls->peer_disconnected_meth != NULL);
3131 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3132 CHECK(calls->peer_connected_meth != NULL);
3133 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3134 CHECK(calls->handle_channel_reestablish_meth != NULL);
3135 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3136 CHECK(calls->handle_error_meth != NULL);
3138 LDKChannelMessageHandler ret = {
3139 .this_arg = (void*) calls,
3140 .handle_open_channel = handle_open_channel_jcall,
3141 .handle_accept_channel = handle_accept_channel_jcall,
3142 .handle_funding_created = handle_funding_created_jcall,
3143 .handle_funding_signed = handle_funding_signed_jcall,
3144 .handle_funding_locked = handle_funding_locked_jcall,
3145 .handle_shutdown = handle_shutdown_jcall,
3146 .handle_closing_signed = handle_closing_signed_jcall,
3147 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3148 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3149 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3150 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3151 .handle_commitment_signed = handle_commitment_signed_jcall,
3152 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3153 .handle_update_fee = handle_update_fee_jcall,
3154 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3155 .peer_disconnected = peer_disconnected_jcall,
3156 .peer_connected = peer_connected_jcall,
3157 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3158 .handle_error = handle_error_jcall,
3159 .free = LDKChannelMessageHandler_JCalls_free,
3160 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3162 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3165 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3166 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3167 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3168 return (long)res_ptr;
3170 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3171 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3175 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) {
3176 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3177 LDKPublicKey their_node_id_ref;
3178 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3179 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3180 LDKInitFeatures their_features_conv;
3181 their_features_conv.inner = (void*)(their_features & (~1));
3182 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3183 // Warning: we may need a move here but can't clone!
3184 LDKOpenChannel msg_conv;
3185 msg_conv.inner = (void*)(msg & (~1));
3186 msg_conv.is_owned = (msg & 1) || (msg == 0);
3187 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3190 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) {
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 LDKAcceptChannel msg_conv;
3200 msg_conv.inner = (void*)(msg & (~1));
3201 msg_conv.is_owned = (msg & 1) || (msg == 0);
3202 (this_arg_conv->handle_accept_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_1funding_1created(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, 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 LDKFundingCreated msg_conv;
3211 msg_conv.inner = (void*)(msg & (~1));
3212 msg_conv.is_owned = (msg & 1) || (msg == 0);
3213 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3216 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) {
3217 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3218 LDKPublicKey their_node_id_ref;
3219 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3220 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3221 LDKFundingSigned msg_conv;
3222 msg_conv.inner = (void*)(msg & (~1));
3223 msg_conv.is_owned = (msg & 1) || (msg == 0);
3224 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3227 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) {
3228 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3229 LDKPublicKey their_node_id_ref;
3230 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3231 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3232 LDKFundingLocked msg_conv;
3233 msg_conv.inner = (void*)(msg & (~1));
3234 msg_conv.is_owned = (msg & 1) || (msg == 0);
3235 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3239 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3240 LDKPublicKey their_node_id_ref;
3241 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3242 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3243 LDKShutdown msg_conv;
3244 msg_conv.inner = (void*)(msg & (~1));
3245 msg_conv.is_owned = (msg & 1) || (msg == 0);
3246 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3249 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) {
3250 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3251 LDKPublicKey their_node_id_ref;
3252 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3253 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3254 LDKClosingSigned msg_conv;
3255 msg_conv.inner = (void*)(msg & (~1));
3256 msg_conv.is_owned = (msg & 1) || (msg == 0);
3257 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3260 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) {
3261 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3262 LDKPublicKey their_node_id_ref;
3263 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3264 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3265 LDKUpdateAddHTLC msg_conv;
3266 msg_conv.inner = (void*)(msg & (~1));
3267 msg_conv.is_owned = (msg & 1) || (msg == 0);
3268 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3271 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) {
3272 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3273 LDKPublicKey their_node_id_ref;
3274 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3275 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3276 LDKUpdateFulfillHTLC msg_conv;
3277 msg_conv.inner = (void*)(msg & (~1));
3278 msg_conv.is_owned = (msg & 1) || (msg == 0);
3279 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3282 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) {
3283 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3284 LDKPublicKey their_node_id_ref;
3285 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3286 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3287 LDKUpdateFailHTLC msg_conv;
3288 msg_conv.inner = (void*)(msg & (~1));
3289 msg_conv.is_owned = (msg & 1) || (msg == 0);
3290 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3293 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) {
3294 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3295 LDKPublicKey their_node_id_ref;
3296 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3297 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3298 LDKUpdateFailMalformedHTLC msg_conv;
3299 msg_conv.inner = (void*)(msg & (~1));
3300 msg_conv.is_owned = (msg & 1) || (msg == 0);
3301 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3304 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) {
3305 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3306 LDKPublicKey their_node_id_ref;
3307 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3308 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3309 LDKCommitmentSigned msg_conv;
3310 msg_conv.inner = (void*)(msg & (~1));
3311 msg_conv.is_owned = (msg & 1) || (msg == 0);
3312 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3315 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) {
3316 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3317 LDKPublicKey their_node_id_ref;
3318 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3319 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3320 LDKRevokeAndACK msg_conv;
3321 msg_conv.inner = (void*)(msg & (~1));
3322 msg_conv.is_owned = (msg & 1) || (msg == 0);
3323 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3326 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) {
3327 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3328 LDKPublicKey their_node_id_ref;
3329 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3330 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3331 LDKUpdateFee msg_conv;
3332 msg_conv.inner = (void*)(msg & (~1));
3333 msg_conv.is_owned = (msg & 1) || (msg == 0);
3334 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3337 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) {
3338 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3339 LDKPublicKey their_node_id_ref;
3340 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3341 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3342 LDKAnnouncementSignatures msg_conv;
3343 msg_conv.inner = (void*)(msg & (~1));
3344 msg_conv.is_owned = (msg & 1) || (msg == 0);
3345 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3348 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) {
3349 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3350 LDKPublicKey their_node_id_ref;
3351 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3352 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3353 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3357 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3358 LDKPublicKey their_node_id_ref;
3359 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3360 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3362 msg_conv.inner = (void*)(msg & (~1));
3363 msg_conv.is_owned = (msg & 1) || (msg == 0);
3364 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3367 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) {
3368 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3369 LDKPublicKey their_node_id_ref;
3370 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3371 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3372 LDKChannelReestablish msg_conv;
3373 msg_conv.inner = (void*)(msg & (~1));
3374 msg_conv.is_owned = (msg & 1) || (msg == 0);
3375 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3379 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3380 LDKPublicKey their_node_id_ref;
3381 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3382 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3383 LDKErrorMessage msg_conv;
3384 msg_conv.inner = (void*)(msg & (~1));
3385 msg_conv.is_owned = (msg & 1) || (msg == 0);
3386 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3389 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3390 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3391 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3392 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3393 for (size_t i = 0; i < vec->datalen; i++) {
3394 CHECK((((long)vec->data[i].inner) & 1) == 0);
3395 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3397 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3400 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3401 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3402 ret->datalen = (*env)->GetArrayLength(env, elems);
3403 if (ret->datalen == 0) {
3406 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3407 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3408 for (size_t i = 0; i < ret->datalen; i++) {
3409 jlong arr_elem = java_elems[i];
3410 LDKChannelMonitor arr_elem_conv;
3411 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3412 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3413 // Warning: we may need a move here but can't clone!
3414 ret->data[i] = arr_elem_conv;
3416 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3420 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3421 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3422 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3424 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3425 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3426 ret->datalen = (*env)->GetArrayLength(env, elems);
3427 if (ret->datalen == 0) {
3430 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3431 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3432 for (size_t i = 0; i < ret->datalen; i++) {
3433 ret->data[i] = java_elems[i];
3435 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3439 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3440 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3441 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3442 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3443 for (size_t i = 0; i < vec->datalen; i++) {
3444 CHECK((((long)vec->data[i].inner) & 1) == 0);
3445 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3447 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3450 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3451 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3452 ret->datalen = (*env)->GetArrayLength(env, elems);
3453 if (ret->datalen == 0) {
3456 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3457 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3458 for (size_t i = 0; i < ret->datalen; i++) {
3459 jlong arr_elem = java_elems[i];
3460 LDKUpdateAddHTLC arr_elem_conv;
3461 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3462 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3463 if (arr_elem_conv.inner != NULL)
3464 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3465 ret->data[i] = arr_elem_conv;
3467 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3471 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3472 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3473 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3474 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3475 for (size_t i = 0; i < vec->datalen; i++) {
3476 CHECK((((long)vec->data[i].inner) & 1) == 0);
3477 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3479 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3482 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3483 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3484 ret->datalen = (*env)->GetArrayLength(env, elems);
3485 if (ret->datalen == 0) {
3488 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3489 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3490 for (size_t i = 0; i < ret->datalen; i++) {
3491 jlong arr_elem = java_elems[i];
3492 LDKUpdateFulfillHTLC arr_elem_conv;
3493 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3494 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3495 if (arr_elem_conv.inner != NULL)
3496 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3497 ret->data[i] = arr_elem_conv;
3499 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3503 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3504 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3505 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3506 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3507 for (size_t i = 0; i < vec->datalen; i++) {
3508 CHECK((((long)vec->data[i].inner) & 1) == 0);
3509 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3511 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3514 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3515 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3516 ret->datalen = (*env)->GetArrayLength(env, elems);
3517 if (ret->datalen == 0) {
3520 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3521 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3522 for (size_t i = 0; i < ret->datalen; i++) {
3523 jlong arr_elem = java_elems[i];
3524 LDKUpdateFailHTLC arr_elem_conv;
3525 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3526 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3527 if (arr_elem_conv.inner != NULL)
3528 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3529 ret->data[i] = arr_elem_conv;
3531 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3535 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3536 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3537 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3538 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3539 for (size_t i = 0; i < vec->datalen; i++) {
3540 CHECK((((long)vec->data[i].inner) & 1) == 0);
3541 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3543 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3546 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3547 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3548 ret->datalen = (*env)->GetArrayLength(env, elems);
3549 if (ret->datalen == 0) {
3552 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3553 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3554 for (size_t i = 0; i < ret->datalen; i++) {
3555 jlong arr_elem = java_elems[i];
3556 LDKUpdateFailMalformedHTLC arr_elem_conv;
3557 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3558 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3559 if (arr_elem_conv.inner != NULL)
3560 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3561 ret->data[i] = arr_elem_conv;
3563 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3567 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3568 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3570 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3571 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3572 CHECK(val->result_ok);
3573 return *val->contents.result;
3575 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3576 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3577 CHECK(!val->result_ok);
3578 LDKLightningError err_var = (*val->contents.err);
3579 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3580 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3581 long err_ref = (long)err_var.inner & ~1;
3584 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3585 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3586 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3588 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3589 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3590 ret->datalen = (*env)->GetArrayLength(env, elems);
3591 if (ret->datalen == 0) {
3594 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3595 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3596 for (size_t i = 0; i < ret->datalen; i++) {
3597 jlong arr_elem = java_elems[i];
3598 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3599 FREE((void*)arr_elem);
3600 ret->data[i] = arr_elem_conv;
3602 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3606 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3607 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3608 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3609 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3610 for (size_t i = 0; i < vec->datalen; i++) {
3611 CHECK((((long)vec->data[i].inner) & 1) == 0);
3612 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3614 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3618 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3619 ret->datalen = (*env)->GetArrayLength(env, elems);
3620 if (ret->datalen == 0) {
3623 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3624 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3625 for (size_t i = 0; i < ret->datalen; i++) {
3626 jlong arr_elem = java_elems[i];
3627 LDKNodeAnnouncement arr_elem_conv;
3628 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3629 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3630 if (arr_elem_conv.inner != NULL)
3631 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3632 ret->data[i] = arr_elem_conv;
3634 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3638 typedef struct LDKRoutingMessageHandler_JCalls {
3639 atomic_size_t refcnt;
3642 jmethodID handle_node_announcement_meth;
3643 jmethodID handle_channel_announcement_meth;
3644 jmethodID handle_channel_update_meth;
3645 jmethodID handle_htlc_fail_channel_update_meth;
3646 jmethodID get_next_channel_announcements_meth;
3647 jmethodID get_next_node_announcements_meth;
3648 jmethodID should_request_full_sync_meth;
3649 } LDKRoutingMessageHandler_JCalls;
3650 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3651 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3653 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3654 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3656 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, msg);
3657 LDKCResult_boolLightningErrorZ res = *ret;
3661 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3662 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3664 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3665 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3667 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, msg);
3668 LDKCResult_boolLightningErrorZ res = *ret;
3672 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3673 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3675 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3676 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3678 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, msg);
3679 LDKCResult_boolLightningErrorZ res = *ret;
3683 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3684 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3686 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3687 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3689 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, update);
3691 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3692 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3694 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3695 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3697 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3698 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
3699 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
3700 if (ret_constr.datalen > 0)
3701 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
3703 ret_constr.data = NULL;
3704 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
3705 for (size_t l = 0; l < ret_constr.datalen; l++) {
3706 long arr_conv_63 = ret_vals[l];
3707 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
3708 FREE((void*)arr_conv_63);
3709 ret_constr.data[l] = arr_conv_63_conv;
3711 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
3714 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3715 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3717 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3718 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
3719 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
3720 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3722 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3723 LDKCVec_NodeAnnouncementZ ret_constr;
3724 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
3725 if (ret_constr.datalen > 0)
3726 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
3728 ret_constr.data = NULL;
3729 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
3730 for (size_t s = 0; s < ret_constr.datalen; s++) {
3731 long arr_conv_18 = ret_vals[s];
3732 LDKNodeAnnouncement arr_conv_18_conv;
3733 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
3734 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
3735 if (arr_conv_18_conv.inner != NULL)
3736 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
3737 ret_constr.data[s] = arr_conv_18_conv;
3739 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
3742 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3743 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3745 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3746 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
3747 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form);
3748 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3750 return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3752 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3753 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3754 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3756 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3757 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3761 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3762 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3763 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3764 return (void*) this_arg;
3766 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3767 jclass c = (*env)->GetObjectClass(env, o);
3769 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3770 atomic_init(&calls->refcnt, 1);
3771 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3772 calls->o = (*env)->NewWeakGlobalRef(env, o);
3773 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3774 CHECK(calls->handle_node_announcement_meth != NULL);
3775 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3776 CHECK(calls->handle_channel_announcement_meth != NULL);
3777 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3778 CHECK(calls->handle_channel_update_meth != NULL);
3779 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3780 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
3781 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
3782 CHECK(calls->get_next_channel_announcements_meth != NULL);
3783 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
3784 CHECK(calls->get_next_node_announcements_meth != NULL);
3785 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3786 CHECK(calls->should_request_full_sync_meth != NULL);
3788 LDKRoutingMessageHandler ret = {
3789 .this_arg = (void*) calls,
3790 .handle_node_announcement = handle_node_announcement_jcall,
3791 .handle_channel_announcement = handle_channel_announcement_jcall,
3792 .handle_channel_update = handle_channel_update_jcall,
3793 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3794 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3795 .get_next_node_announcements = get_next_node_announcements_jcall,
3796 .should_request_full_sync = should_request_full_sync_jcall,
3797 .free = LDKRoutingMessageHandler_JCalls_free,
3801 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3802 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3803 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3804 return (long)res_ptr;
3806 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3807 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3811 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3812 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3813 LDKNodeAnnouncement msg_conv;
3814 msg_conv.inner = (void*)(msg & (~1));
3815 msg_conv.is_owned = (msg & 1) || (msg == 0);
3816 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3817 *ret = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
3821 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3822 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3823 LDKChannelAnnouncement msg_conv;
3824 msg_conv.inner = (void*)(msg & (~1));
3825 msg_conv.is_owned = (msg & 1) || (msg == 0);
3826 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3827 *ret = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3831 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3832 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3833 LDKChannelUpdate msg_conv;
3834 msg_conv.inner = (void*)(msg & (~1));
3835 msg_conv.is_owned = (msg & 1) || (msg == 0);
3836 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3837 *ret = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
3841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
3842 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3843 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3844 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
3847 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) {
3848 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3849 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
3850 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
3851 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
3852 for (size_t l = 0; l < ret_var.datalen; l++) {
3853 /*XXX False */long arr_conv_63_ref = (long)&ret_var.data[l];
3854 ret_arr_ptr[l] = arr_conv_63_ref;
3856 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
3857 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(ret_var);
3861 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) {
3862 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3863 LDKPublicKey starting_point_ref;
3864 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
3865 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
3866 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
3867 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
3868 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
3869 for (size_t s = 0; s < ret_var.datalen; s++) {
3870 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
3871 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3872 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3873 long arr_conv_18_ref;
3874 if (arr_conv_18_var.is_owned) {
3875 arr_conv_18_ref = (long)arr_conv_18_var.inner | 1;
3877 arr_conv_18_ref = (long)arr_conv_18_var.inner & ~1;
3879 ret_arr_ptr[s] = arr_conv_18_ref;
3881 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
3886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
3887 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3888 LDKPublicKey node_id_ref;
3889 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
3890 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
3891 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
3895 typedef struct LDKSocketDescriptor_JCalls {
3896 atomic_size_t refcnt;
3899 jmethodID send_data_meth;
3900 jmethodID disconnect_socket_meth;
3902 jmethodID hash_meth;
3903 } LDKSocketDescriptor_JCalls;
3904 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
3905 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3907 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3908 LDKu8slice data_var = data;
3909 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
3910 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
3911 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3913 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
3915 void disconnect_socket_jcall(void* this_arg) {
3916 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3918 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3919 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3921 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
3923 bool eq_jcall(const void* this_arg, const void *other_arg) {
3924 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3926 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3927 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3929 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, other_arg);
3931 uint64_t hash_jcall(const void* this_arg) {
3932 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3934 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3935 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3937 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
3939 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
3940 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3941 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3943 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3944 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3948 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
3949 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3950 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3951 return (void*) this_arg;
3953 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
3954 jclass c = (*env)->GetObjectClass(env, o);
3956 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
3957 atomic_init(&calls->refcnt, 1);
3958 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3959 calls->o = (*env)->NewWeakGlobalRef(env, o);
3960 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
3961 CHECK(calls->send_data_meth != NULL);
3962 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
3963 CHECK(calls->disconnect_socket_meth != NULL);
3964 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
3965 CHECK(calls->eq_meth != NULL);
3966 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
3967 CHECK(calls->hash_meth != NULL);
3969 LDKSocketDescriptor ret = {
3970 .this_arg = (void*) calls,
3971 .send_data = send_data_jcall,
3972 .disconnect_socket = disconnect_socket_jcall,
3975 .clone = LDKSocketDescriptor_JCalls_clone,
3976 .free = LDKSocketDescriptor_JCalls_free,
3980 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
3981 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
3982 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
3983 return (long)res_ptr;
3985 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3986 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
3990 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
3991 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3992 LDKu8slice data_ref;
3993 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
3994 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
3995 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
3996 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
4000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
4001 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4002 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4005 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
4006 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4007 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4011 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4012 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
4013 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
4015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4016 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4018 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4019 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4020 CHECK(val->result_ok);
4021 LDKCVecTempl_u8 res_var = (*val->contents.result);
4022 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
4023 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
4026 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4027 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4028 CHECK(!val->result_ok);
4029 LDKPeerHandleError err_var = (*val->contents.err);
4030 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4031 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4032 long err_ref = (long)err_var.inner & ~1;
4035 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4036 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4039 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4040 CHECK(val->result_ok);
4041 return *val->contents.result;
4043 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4044 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4045 CHECK(!val->result_ok);
4046 LDKPeerHandleError err_var = (*val->contents.err);
4047 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4048 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4049 long err_ref = (long)err_var.inner & ~1;
4052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4053 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
4055 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4056 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4057 CHECK(val->result_ok);
4058 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
4059 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
4062 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4063 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4064 CHECK(!val->result_ok);
4065 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4069 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
4071 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4072 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4073 CHECK(val->result_ok);
4074 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
4075 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
4078 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4079 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4080 CHECK(!val->result_ok);
4081 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4085 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
4087 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4088 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4089 CHECK(val->result_ok);
4090 LDKTxCreationKeys res_var = (*val->contents.result);
4091 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4092 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4093 long res_ref = (long)res_var.inner & ~1;
4096 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4097 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4098 CHECK(!val->result_ok);
4099 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4102 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4103 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4104 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4106 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4107 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4108 ret->datalen = (*env)->GetArrayLength(env, elems);
4109 if (ret->datalen == 0) {
4112 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4113 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4114 for (size_t i = 0; i < ret->datalen; i++) {
4115 jlong arr_elem = java_elems[i];
4116 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4117 FREE((void*)arr_elem);
4118 ret->data[i] = arr_elem_conv;
4120 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4124 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4125 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4126 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4127 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4128 for (size_t i = 0; i < vec->datalen; i++) {
4129 CHECK((((long)vec->data[i].inner) & 1) == 0);
4130 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4132 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4135 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4136 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4137 ret->datalen = (*env)->GetArrayLength(env, elems);
4138 if (ret->datalen == 0) {
4141 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4142 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4143 for (size_t i = 0; i < ret->datalen; i++) {
4144 jlong arr_elem = java_elems[i];
4145 LDKRouteHop arr_elem_conv;
4146 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4147 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4148 if (arr_elem_conv.inner != NULL)
4149 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4150 ret->data[i] = arr_elem_conv;
4152 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4156 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4157 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4158 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4161 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4163 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4164 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4165 CHECK(val->result_ok);
4166 LDKRoute res_var = (*val->contents.result);
4167 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4168 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4169 long res_ref = (long)res_var.inner & ~1;
4172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4173 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4174 CHECK(!val->result_ok);
4175 LDKLightningError err_var = (*val->contents.err);
4176 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4177 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4178 long err_ref = (long)err_var.inner & ~1;
4181 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4182 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4183 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4184 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4185 for (size_t i = 0; i < vec->datalen; i++) {
4186 CHECK((((long)vec->data[i].inner) & 1) == 0);
4187 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4189 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4193 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4194 ret->datalen = (*env)->GetArrayLength(env, elems);
4195 if (ret->datalen == 0) {
4198 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4199 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4200 for (size_t i = 0; i < ret->datalen; i++) {
4201 jlong arr_elem = java_elems[i];
4202 LDKRouteHint arr_elem_conv;
4203 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4204 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4205 if (arr_elem_conv.inner != NULL)
4206 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4207 ret->data[i] = arr_elem_conv;
4209 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4214 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4216 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4220 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4222 C2Tuple_OutPointScriptZ_free(arg_conv);
4225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4226 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4228 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4232 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4234 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4238 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4240 C2Tuple_u64u64Z_free(arg_conv);
4243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4244 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4246 C2Tuple_usizeTransactionZ_free(arg_conv);
4249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4250 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4252 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4256 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4258 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4261 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4262 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4264 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4265 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4270 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4272 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4275 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray arg) {
4276 LDKCVec_SignatureZ arg_constr;
4277 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4278 if (arg_constr.datalen > 0)
4279 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4281 arg_constr.data = NULL;
4282 for (size_t i = 0; i < arg_constr.datalen; i++) {
4283 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4284 LDKSignature arr_conv_8_ref;
4285 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4286 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4287 arg_constr.data[i] = arr_conv_8_ref;
4289 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4290 *ret = CResult_CVec_SignatureZNoneZ_ok(arg_constr);
4294 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4295 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4297 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4298 *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4303 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4305 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4308 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4309 LDKCVec_u8Z arg_ref;
4310 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
4311 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4312 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4313 *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4314 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
4318 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4319 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4321 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4322 *ret = CResult_NoneAPIErrorZ_err(arg_conv);
4326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4327 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4329 CResult_NoneAPIErrorZ_free(arg_conv);
4332 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4333 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4335 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4336 *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4341 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4343 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4346 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4347 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4349 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4350 *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4355 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4357 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4360 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4361 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4363 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4364 *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
4368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4369 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4371 CResult_NonePaymentSendFailureZ_free(arg_conv);
4374 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4375 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4377 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4378 *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
4382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4383 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4385 CResult_NonePeerHandleErrorZ_free(arg_conv);
4388 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4389 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4391 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4392 *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
4396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4397 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4399 CResult_PublicKeySecpErrorZ_free(arg_conv);
4402 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4403 LDKPublicKey arg_ref;
4404 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4405 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4406 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4407 *ret = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4411 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4412 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4414 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4415 *ret = CResult_RouteLightningErrorZ_err(arg_conv);
4419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4420 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4422 CResult_RouteLightningErrorZ_free(arg_conv);
4425 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4426 LDKRoute arg_conv = *(LDKRoute*)arg;
4428 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4429 *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
4433 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4434 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4436 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4437 *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
4441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4442 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4444 CResult_SecretKeySecpErrorZ_free(arg_conv);
4447 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4448 LDKSecretKey arg_ref;
4449 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4450 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4451 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4452 *ret = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4457 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4459 CResult_SignatureNoneZ_free(arg_conv);
4462 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4463 LDKSignature arg_ref;
4464 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4465 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4466 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4467 *ret = CResult_SignatureNoneZ_ok(arg_ref);
4471 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4472 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4474 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4475 *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4480 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4482 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4486 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4488 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4489 *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4493 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4494 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4496 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4497 *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
4501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4502 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4504 CResult_TxOutAccessErrorZ_free(arg_conv);
4507 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4508 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4510 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4511 *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
4515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4516 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4518 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4519 *ret = CResult_boolLightningErrorZ_err(arg_conv);
4523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4524 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4526 CResult_boolLightningErrorZ_free(arg_conv);
4529 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4530 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4531 *ret = CResult_boolLightningErrorZ_ok(arg);
4535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4536 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4538 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4539 *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
4543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4544 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4546 CResult_boolPeerHandleErrorZ_free(arg_conv);
4549 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4550 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4551 *ret = CResult_boolPeerHandleErrorZ_ok(arg);
4555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4556 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_constr;
4557 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4558 if (arg_constr.datalen > 0)
4559 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
4561 arg_constr.data = NULL;
4562 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4563 for (size_t q = 0; q < arg_constr.datalen; q++) {
4564 long arr_conv_42 = arg_vals[q];
4565 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
4566 FREE((void*)arr_conv_42);
4567 arg_constr.data[q] = arr_conv_42_conv;
4569 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4570 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_constr);
4573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4574 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_constr;
4575 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4576 if (arg_constr.datalen > 0)
4577 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ Elements");
4579 arg_constr.data = NULL;
4580 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4581 for (size_t b = 0; b < arg_constr.datalen; b++) {
4582 long arr_conv_27 = arg_vals[b];
4583 LDKC2Tuple_TxidCVec_TxOutZZ arr_conv_27_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arr_conv_27;
4584 FREE((void*)arr_conv_27);
4585 arg_constr.data[b] = arr_conv_27_conv;
4587 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4588 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_constr);
4591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4592 LDKCVec_C2Tuple_usizeTransactionZZ arg_constr;
4593 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4594 if (arg_constr.datalen > 0)
4595 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
4597 arg_constr.data = NULL;
4598 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4599 for (size_t d = 0; d < arg_constr.datalen; d++) {
4600 long arr_conv_29 = arg_vals[d];
4601 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
4602 FREE((void*)arr_conv_29);
4603 arg_constr.data[d] = arr_conv_29_conv;
4605 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4606 CVec_C2Tuple_usizeTransactionZZ_free(arg_constr);
4609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4610 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4611 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4612 if (arg_constr.datalen > 0)
4613 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4615 arg_constr.data = NULL;
4616 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4617 for (size_t l = 0; l < arg_constr.datalen; l++) {
4618 long arr_conv_63 = arg_vals[l];
4619 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4620 FREE((void*)arr_conv_63);
4621 arg_constr.data[l] = arr_conv_63_conv;
4623 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4624 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_constr);
4627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4628 LDKCVec_CVec_RouteHopZZ arg_constr;
4629 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4630 if (arg_constr.datalen > 0)
4631 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
4633 arg_constr.data = NULL;
4634 for (size_t m = 0; m < arg_constr.datalen; m++) {
4635 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, arg, m);
4636 LDKCVec_RouteHopZ arr_conv_12_constr;
4637 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
4638 if (arr_conv_12_constr.datalen > 0)
4639 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4641 arr_conv_12_constr.data = NULL;
4642 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
4643 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
4644 long arr_conv_10 = arr_conv_12_vals[k];
4645 LDKRouteHop arr_conv_10_conv;
4646 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4647 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4648 arr_conv_12_constr.data[k] = arr_conv_10_conv;
4650 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
4651 arg_constr.data[m] = arr_conv_12_constr;
4653 CVec_CVec_RouteHopZZ_free(arg_constr);
4656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4657 LDKCVec_ChannelDetailsZ arg_constr;
4658 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4659 if (arg_constr.datalen > 0)
4660 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
4662 arg_constr.data = NULL;
4663 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4664 for (size_t q = 0; q < arg_constr.datalen; q++) {
4665 long arr_conv_16 = arg_vals[q];
4666 LDKChannelDetails arr_conv_16_conv;
4667 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4668 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4669 arg_constr.data[q] = arr_conv_16_conv;
4671 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4672 CVec_ChannelDetailsZ_free(arg_constr);
4675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4676 LDKCVec_ChannelMonitorZ arg_constr;
4677 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4678 if (arg_constr.datalen > 0)
4679 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
4681 arg_constr.data = NULL;
4682 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4683 for (size_t q = 0; q < arg_constr.datalen; q++) {
4684 long arr_conv_16 = arg_vals[q];
4685 LDKChannelMonitor arr_conv_16_conv;
4686 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4687 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4688 arg_constr.data[q] = arr_conv_16_conv;
4690 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4691 CVec_ChannelMonitorZ_free(arg_constr);
4694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4695 LDKCVec_EventZ arg_constr;
4696 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4697 if (arg_constr.datalen > 0)
4698 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4700 arg_constr.data = NULL;
4701 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4702 for (size_t h = 0; h < arg_constr.datalen; h++) {
4703 long arr_conv_7 = arg_vals[h];
4704 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
4705 FREE((void*)arr_conv_7);
4706 arg_constr.data[h] = arr_conv_7_conv;
4708 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4709 CVec_EventZ_free(arg_constr);
4712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4713 LDKCVec_HTLCOutputInCommitmentZ arg_constr;
4714 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4715 if (arg_constr.datalen > 0)
4716 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
4718 arg_constr.data = NULL;
4719 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4720 for (size_t y = 0; y < arg_constr.datalen; y++) {
4721 long arr_conv_24 = arg_vals[y];
4722 LDKHTLCOutputInCommitment arr_conv_24_conv;
4723 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
4724 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
4725 arg_constr.data[y] = arr_conv_24_conv;
4727 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4728 CVec_HTLCOutputInCommitmentZ_free(arg_constr);
4731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4732 LDKCVec_MessageSendEventZ arg_constr;
4733 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4734 if (arg_constr.datalen > 0)
4735 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4737 arg_constr.data = NULL;
4738 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4739 for (size_t s = 0; s < arg_constr.datalen; s++) {
4740 long arr_conv_18 = arg_vals[s];
4741 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
4742 FREE((void*)arr_conv_18);
4743 arg_constr.data[s] = arr_conv_18_conv;
4745 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4746 CVec_MessageSendEventZ_free(arg_constr);
4749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4750 LDKCVec_MonitorEventZ arg_constr;
4751 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4752 if (arg_constr.datalen > 0)
4753 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
4755 arg_constr.data = NULL;
4756 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4757 for (size_t o = 0; o < arg_constr.datalen; o++) {
4758 long arr_conv_14 = arg_vals[o];
4759 LDKMonitorEvent arr_conv_14_conv;
4760 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
4761 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
4762 arg_constr.data[o] = arr_conv_14_conv;
4764 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4765 CVec_MonitorEventZ_free(arg_constr);
4768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4769 LDKCVec_NetAddressZ arg_constr;
4770 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4771 if (arg_constr.datalen > 0)
4772 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
4774 arg_constr.data = NULL;
4775 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4776 for (size_t m = 0; m < arg_constr.datalen; m++) {
4777 long arr_conv_12 = arg_vals[m];
4778 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
4779 FREE((void*)arr_conv_12);
4780 arg_constr.data[m] = arr_conv_12_conv;
4782 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4783 CVec_NetAddressZ_free(arg_constr);
4786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4787 LDKCVec_NodeAnnouncementZ arg_constr;
4788 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4789 if (arg_constr.datalen > 0)
4790 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4792 arg_constr.data = NULL;
4793 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4794 for (size_t s = 0; s < arg_constr.datalen; s++) {
4795 long arr_conv_18 = arg_vals[s];
4796 LDKNodeAnnouncement arr_conv_18_conv;
4797 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4798 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4799 arg_constr.data[s] = arr_conv_18_conv;
4801 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4802 CVec_NodeAnnouncementZ_free(arg_constr);
4805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4806 LDKCVec_PublicKeyZ arg_constr;
4807 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4808 if (arg_constr.datalen > 0)
4809 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
4811 arg_constr.data = NULL;
4812 for (size_t i = 0; i < arg_constr.datalen; i++) {
4813 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4814 LDKPublicKey arr_conv_8_ref;
4815 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
4816 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
4817 arg_constr.data[i] = arr_conv_8_ref;
4819 CVec_PublicKeyZ_free(arg_constr);
4822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4823 LDKCVec_RouteHintZ arg_constr;
4824 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4825 if (arg_constr.datalen > 0)
4826 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
4828 arg_constr.data = NULL;
4829 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4830 for (size_t l = 0; l < arg_constr.datalen; l++) {
4831 long arr_conv_11 = arg_vals[l];
4832 LDKRouteHint arr_conv_11_conv;
4833 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
4834 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
4835 arg_constr.data[l] = arr_conv_11_conv;
4837 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4838 CVec_RouteHintZ_free(arg_constr);
4841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4842 LDKCVec_RouteHopZ arg_constr;
4843 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4844 if (arg_constr.datalen > 0)
4845 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4847 arg_constr.data = NULL;
4848 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4849 for (size_t k = 0; k < arg_constr.datalen; k++) {
4850 long arr_conv_10 = arg_vals[k];
4851 LDKRouteHop arr_conv_10_conv;
4852 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4853 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4854 arg_constr.data[k] = arr_conv_10_conv;
4856 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4857 CVec_RouteHopZ_free(arg_constr);
4860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4861 LDKCVec_SignatureZ arg_constr;
4862 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4863 if (arg_constr.datalen > 0)
4864 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4866 arg_constr.data = NULL;
4867 for (size_t i = 0; i < arg_constr.datalen; i++) {
4868 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4869 LDKSignature arr_conv_8_ref;
4870 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4871 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4872 arg_constr.data[i] = arr_conv_8_ref;
4874 CVec_SignatureZ_free(arg_constr);
4877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4878 LDKCVec_SpendableOutputDescriptorZ arg_constr;
4879 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4880 if (arg_constr.datalen > 0)
4881 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
4883 arg_constr.data = NULL;
4884 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4885 for (size_t b = 0; b < arg_constr.datalen; b++) {
4886 long arr_conv_27 = arg_vals[b];
4887 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
4888 FREE((void*)arr_conv_27);
4889 arg_constr.data[b] = arr_conv_27_conv;
4891 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4892 CVec_SpendableOutputDescriptorZ_free(arg_constr);
4895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4896 LDKCVec_TransactionZ arg_constr;
4897 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4898 if (arg_constr.datalen > 0)
4899 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
4901 arg_constr.data = NULL;
4902 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4903 for (size_t n = 0; n < arg_constr.datalen; n++) {
4904 long arr_conv_13 = arg_vals[n];
4905 LDKTransaction arr_conv_13_conv = *(LDKTransaction*)arr_conv_13;
4906 FREE((void*)arr_conv_13);
4907 arg_constr.data[n] = arr_conv_13_conv;
4909 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4910 CVec_TransactionZ_free(arg_constr);
4913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4914 LDKCVec_TxOutZ arg_constr;
4915 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4916 if (arg_constr.datalen > 0)
4917 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
4919 arg_constr.data = NULL;
4920 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4921 for (size_t h = 0; h < arg_constr.datalen; h++) {
4922 long arr_conv_7 = arg_vals[h];
4923 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
4924 FREE((void*)arr_conv_7);
4925 arg_constr.data[h] = arr_conv_7_conv;
4927 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4928 CVec_TxOutZ_free(arg_constr);
4931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4932 LDKCVec_UpdateAddHTLCZ arg_constr;
4933 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4934 if (arg_constr.datalen > 0)
4935 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
4937 arg_constr.data = NULL;
4938 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4939 for (size_t p = 0; p < arg_constr.datalen; p++) {
4940 long arr_conv_15 = arg_vals[p];
4941 LDKUpdateAddHTLC arr_conv_15_conv;
4942 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
4943 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
4944 arg_constr.data[p] = arr_conv_15_conv;
4946 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4947 CVec_UpdateAddHTLCZ_free(arg_constr);
4950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4951 LDKCVec_UpdateFailHTLCZ arg_constr;
4952 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4953 if (arg_constr.datalen > 0)
4954 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
4956 arg_constr.data = NULL;
4957 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4958 for (size_t q = 0; q < arg_constr.datalen; q++) {
4959 long arr_conv_16 = arg_vals[q];
4960 LDKUpdateFailHTLC arr_conv_16_conv;
4961 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4962 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4963 arg_constr.data[q] = arr_conv_16_conv;
4965 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4966 CVec_UpdateFailHTLCZ_free(arg_constr);
4969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4970 LDKCVec_UpdateFailMalformedHTLCZ arg_constr;
4971 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4972 if (arg_constr.datalen > 0)
4973 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
4975 arg_constr.data = NULL;
4976 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4977 for (size_t z = 0; z < arg_constr.datalen; z++) {
4978 long arr_conv_25 = arg_vals[z];
4979 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
4980 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
4981 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
4982 arg_constr.data[z] = arr_conv_25_conv;
4984 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4985 CVec_UpdateFailMalformedHTLCZ_free(arg_constr);
4988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4989 LDKCVec_UpdateFulfillHTLCZ arg_constr;
4990 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4991 if (arg_constr.datalen > 0)
4992 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
4994 arg_constr.data = NULL;
4995 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4996 for (size_t t = 0; t < arg_constr.datalen; t++) {
4997 long arr_conv_19 = arg_vals[t];
4998 LDKUpdateFulfillHTLC arr_conv_19_conv;
4999 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5000 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5001 arg_constr.data[t] = arr_conv_19_conv;
5003 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5004 CVec_UpdateFulfillHTLCZ_free(arg_constr);
5007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5008 LDKCVec_u64Z arg_constr;
5009 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5010 if (arg_constr.datalen > 0)
5011 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
5013 arg_constr.data = NULL;
5014 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5015 for (size_t g = 0; g < arg_constr.datalen; g++) {
5016 long arr_conv_6 = arg_vals[g];
5017 arg_constr.data[g] = arr_conv_6;
5019 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5020 CVec_u64Z_free(arg_constr);
5023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
5024 LDKCVec_u8Z arg_ref;
5025 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
5026 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
5027 CVec_u8Z_free(arg_ref);
5028 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
5031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
5032 LDKTransaction _res_conv = *(LDKTransaction*)_res;
5034 Transaction_free(_res_conv);
5037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5038 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5040 TxOut_free(_res_conv);
5043 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5044 LDKTransaction b_conv = *(LDKTransaction*)b;
5046 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5047 *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
5051 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5052 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5053 *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
5057 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5058 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5059 *ret = CResult_NoneMonitorUpdateErrorZ_ok();
5063 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5065 a_conv.inner = (void*)(a & (~1));
5066 a_conv.is_owned = (a & 1) || (a == 0);
5067 if (a_conv.inner != NULL)
5068 a_conv = OutPoint_clone(&a_conv);
5070 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
5071 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5072 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5073 *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5074 (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0);
5078 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5079 LDKThirtyTwoBytes a_ref;
5080 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5081 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5082 LDKCVec_TxOutZ b_constr;
5083 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5084 if (b_constr.datalen > 0)
5085 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5087 b_constr.data = NULL;
5088 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5089 for (size_t h = 0; h < b_constr.datalen; h++) {
5090 long arr_conv_7 = b_vals[h];
5091 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5092 FREE((void*)arr_conv_7);
5093 b_constr.data[h] = arr_conv_7_conv;
5095 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5096 LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
5097 *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_constr);
5101 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5102 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5103 *ret = C2Tuple_u64u64Z_new(a, b);
5107 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5109 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5110 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5111 LDKCVec_SignatureZ b_constr;
5112 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5113 if (b_constr.datalen > 0)
5114 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5116 b_constr.data = NULL;
5117 for (size_t i = 0; i < b_constr.datalen; i++) {
5118 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5119 LDKSignature arr_conv_8_ref;
5120 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5121 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5122 b_constr.data[i] = arr_conv_8_ref;
5124 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5125 *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5129 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
5130 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5131 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5135 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
5136 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5137 *ret = CResult_SignatureNoneZ_err();
5141 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
5142 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5143 *ret = CResult_CVec_SignatureZNoneZ_err();
5147 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
5148 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5149 *ret = CResult_NoneAPIErrorZ_ok();
5153 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
5154 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5155 *ret = CResult_NonePaymentSendFailureZ_ok();
5159 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
5160 LDKChannelAnnouncement a_conv;
5161 a_conv.inner = (void*)(a & (~1));
5162 a_conv.is_owned = (a & 1) || (a == 0);
5163 if (a_conv.inner != NULL)
5164 a_conv = ChannelAnnouncement_clone(&a_conv);
5165 LDKChannelUpdate b_conv;
5166 b_conv.inner = (void*)(b & (~1));
5167 b_conv.is_owned = (b & 1) || (b == 0);
5168 if (b_conv.inner != NULL)
5169 b_conv = ChannelUpdate_clone(&b_conv);
5170 LDKChannelUpdate c_conv;
5171 c_conv.inner = (void*)(c & (~1));
5172 c_conv.is_owned = (c & 1) || (c == 0);
5173 if (c_conv.inner != NULL)
5174 c_conv = ChannelUpdate_clone(&c_conv);
5175 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5176 *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5180 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
5181 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5182 *ret = CResult_NonePeerHandleErrorZ_ok();
5186 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5187 LDKHTLCOutputInCommitment a_conv;
5188 a_conv.inner = (void*)(a & (~1));
5189 a_conv.is_owned = (a & 1) || (a == 0);
5190 if (a_conv.inner != NULL)
5191 a_conv = HTLCOutputInCommitment_clone(&a_conv);
5193 CHECK((*_env)->GetArrayLength (_env, b) == 64);
5194 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
5195 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
5196 *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
5200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5201 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
5202 FREE((void*)this_ptr);
5203 Event_free(this_ptr_conv);
5206 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5207 LDKEvent* orig_conv = (LDKEvent*)orig;
5208 LDKEvent* ret = MALLOC(sizeof(LDKEvent), "LDKEvent");
5209 *ret = Event_clone(orig_conv);
5213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5214 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
5215 FREE((void*)this_ptr);
5216 MessageSendEvent_free(this_ptr_conv);
5219 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5220 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
5221 LDKMessageSendEvent* ret = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5222 *ret = MessageSendEvent_clone(orig_conv);
5226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5227 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
5228 FREE((void*)this_ptr);
5229 MessageSendEventsProvider_free(this_ptr_conv);
5232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5233 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
5234 FREE((void*)this_ptr);
5235 EventsProvider_free(this_ptr_conv);
5238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5239 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
5240 FREE((void*)this_ptr);
5241 APIError_free(this_ptr_conv);
5244 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5245 LDKAPIError* orig_conv = (LDKAPIError*)orig;
5246 LDKAPIError* ret = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5247 *ret = APIError_clone(orig_conv);
5251 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5252 LDKLevel* orig_conv = (LDKLevel*)orig;
5253 jclass ret = LDKLevel_to_java(_env, Level_clone(orig_conv));
5257 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
5258 jclass ret = LDKLevel_to_java(_env, Level_max());
5262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5263 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
5264 FREE((void*)this_ptr);
5265 Logger_free(this_ptr_conv);
5268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5269 LDKChannelHandshakeConfig this_ptr_conv;
5270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5271 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5272 ChannelHandshakeConfig_free(this_ptr_conv);
5275 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5276 LDKChannelHandshakeConfig orig_conv;
5277 orig_conv.inner = (void*)(orig & (~1));
5278 orig_conv.is_owned = (orig & 1) || (orig == 0);
5279 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_clone(&orig_conv);
5280 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5283 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5284 LDKChannelHandshakeConfig this_ptr_conv;
5285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5286 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5287 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
5291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5292 LDKChannelHandshakeConfig this_ptr_conv;
5293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5294 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5295 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
5298 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5299 LDKChannelHandshakeConfig this_ptr_conv;
5300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5301 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5302 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
5306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5307 LDKChannelHandshakeConfig this_ptr_conv;
5308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5309 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5310 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
5313 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5314 LDKChannelHandshakeConfig this_ptr_conv;
5315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5316 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5317 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
5321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5322 LDKChannelHandshakeConfig this_ptr_conv;
5323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5324 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5325 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
5328 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) {
5329 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
5330 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5333 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
5334 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_default();
5335 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5339 LDKChannelHandshakeLimits this_ptr_conv;
5340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5341 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5342 ChannelHandshakeLimits_free(this_ptr_conv);
5345 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5346 LDKChannelHandshakeLimits orig_conv;
5347 orig_conv.inner = (void*)(orig & (~1));
5348 orig_conv.is_owned = (orig & 1) || (orig == 0);
5349 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_clone(&orig_conv);
5350 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5353 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5354 LDKChannelHandshakeLimits this_ptr_conv;
5355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5356 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5357 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
5361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5362 LDKChannelHandshakeLimits this_ptr_conv;
5363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5364 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5365 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
5368 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5369 LDKChannelHandshakeLimits this_ptr_conv;
5370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5371 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5372 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
5376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5377 LDKChannelHandshakeLimits this_ptr_conv;
5378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5379 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5380 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
5383 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5384 LDKChannelHandshakeLimits this_ptr_conv;
5385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5387 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
5391 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) {
5392 LDKChannelHandshakeLimits this_ptr_conv;
5393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5394 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5395 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
5398 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5399 LDKChannelHandshakeLimits this_ptr_conv;
5400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5401 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5402 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
5406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5407 LDKChannelHandshakeLimits this_ptr_conv;
5408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5409 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5410 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
5413 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
5414 LDKChannelHandshakeLimits this_ptr_conv;
5415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5416 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5417 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
5421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5422 LDKChannelHandshakeLimits this_ptr_conv;
5423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5424 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5425 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
5428 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5429 LDKChannelHandshakeLimits this_ptr_conv;
5430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5431 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5432 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
5436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5437 LDKChannelHandshakeLimits this_ptr_conv;
5438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5439 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5440 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
5443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5444 LDKChannelHandshakeLimits this_ptr_conv;
5445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5446 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5447 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
5451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5452 LDKChannelHandshakeLimits this_ptr_conv;
5453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5454 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5455 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
5458 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5459 LDKChannelHandshakeLimits this_ptr_conv;
5460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5462 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
5466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5467 LDKChannelHandshakeLimits this_ptr_conv;
5468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5469 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5470 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5473 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
5474 LDKChannelHandshakeLimits this_ptr_conv;
5475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5476 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5477 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5482 LDKChannelHandshakeLimits this_ptr_conv;
5483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5484 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5485 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5488 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5489 LDKChannelHandshakeLimits this_ptr_conv;
5490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5491 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5492 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5497 LDKChannelHandshakeLimits this_ptr_conv;
5498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5499 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5500 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5503 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) {
5504 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);
5505 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5508 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5509 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_default();
5510 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5514 LDKChannelConfig this_ptr_conv;
5515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5516 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5517 ChannelConfig_free(this_ptr_conv);
5520 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5521 LDKChannelConfig orig_conv;
5522 orig_conv.inner = (void*)(orig & (~1));
5523 orig_conv.is_owned = (orig & 1) || (orig == 0);
5524 LDKChannelConfig ret = ChannelConfig_clone(&orig_conv);
5525 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5528 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
5529 LDKChannelConfig this_ptr_conv;
5530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5531 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5532 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
5536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5537 LDKChannelConfig this_ptr_conv;
5538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5539 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5540 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
5543 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
5544 LDKChannelConfig this_ptr_conv;
5545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5546 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5547 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
5551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5552 LDKChannelConfig this_ptr_conv;
5553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5554 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5555 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5558 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5559 LDKChannelConfig this_ptr_conv;
5560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5561 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5562 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5567 LDKChannelConfig this_ptr_conv;
5568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5569 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5570 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5573 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) {
5574 LDKChannelConfig ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5575 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5578 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
5579 LDKChannelConfig ret = ChannelConfig_default();
5580 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5583 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
5584 LDKChannelConfig obj_conv;
5585 obj_conv.inner = (void*)(obj & (~1));
5586 obj_conv.is_owned = (obj & 1) || (obj == 0);
5587 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
5588 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5589 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5590 CVec_u8Z_free(arg_var);
5594 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5596 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5597 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5598 LDKChannelConfig ret = ChannelConfig_read(ser_ref);
5599 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5600 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5604 LDKUserConfig this_ptr_conv;
5605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5606 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5607 UserConfig_free(this_ptr_conv);
5610 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5611 LDKUserConfig orig_conv;
5612 orig_conv.inner = (void*)(orig & (~1));
5613 orig_conv.is_owned = (orig & 1) || (orig == 0);
5614 LDKUserConfig ret = UserConfig_clone(&orig_conv);
5615 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5618 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
5619 LDKUserConfig this_ptr_conv;
5620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5621 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5622 LDKChannelHandshakeConfig ret = UserConfig_get_own_channel_config(&this_ptr_conv);
5623 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5627 LDKUserConfig this_ptr_conv;
5628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5629 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5630 LDKChannelHandshakeConfig val_conv;
5631 val_conv.inner = (void*)(val & (~1));
5632 val_conv.is_owned = (val & 1) || (val == 0);
5633 if (val_conv.inner != NULL)
5634 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5635 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5638 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 LDKChannelHandshakeLimits ret = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5643 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5647 LDKUserConfig this_ptr_conv;
5648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5650 LDKChannelHandshakeLimits val_conv;
5651 val_conv.inner = (void*)(val & (~1));
5652 val_conv.is_owned = (val & 1) || (val == 0);
5653 if (val_conv.inner != NULL)
5654 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5655 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5658 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 LDKChannelConfig ret = UserConfig_get_channel_options(&this_ptr_conv);
5663 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5667 LDKUserConfig this_ptr_conv;
5668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5670 LDKChannelConfig val_conv;
5671 val_conv.inner = (void*)(val & (~1));
5672 val_conv.is_owned = (val & 1) || (val == 0);
5673 if (val_conv.inner != NULL)
5674 val_conv = ChannelConfig_clone(&val_conv);
5675 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5678 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) {
5679 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5680 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5681 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5682 if (own_channel_config_arg_conv.inner != NULL)
5683 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5684 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5685 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5686 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5687 if (peer_channel_config_limits_arg_conv.inner != NULL)
5688 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5689 LDKChannelConfig channel_options_arg_conv;
5690 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5691 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5692 if (channel_options_arg_conv.inner != NULL)
5693 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5694 LDKUserConfig ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5695 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5698 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5699 LDKUserConfig ret = UserConfig_default();
5700 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5703 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5704 LDKAccessError* orig_conv = (LDKAccessError*)orig;
5705 jclass ret = LDKAccessError_to_java(_env, AccessError_clone(orig_conv));
5709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5710 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5711 FREE((void*)this_ptr);
5712 Access_free(this_ptr_conv);
5715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5716 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5717 FREE((void*)this_ptr);
5718 Watch_free(this_ptr_conv);
5721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5722 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5723 FREE((void*)this_ptr);
5724 Filter_free(this_ptr_conv);
5727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5728 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
5729 FREE((void*)this_ptr);
5730 BroadcasterInterface_free(this_ptr_conv);
5733 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5734 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
5735 jclass ret = LDKConfirmationTarget_to_java(_env, ConfirmationTarget_clone(orig_conv));
5739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5740 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
5741 FREE((void*)this_ptr);
5742 FeeEstimator_free(this_ptr_conv);
5745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5746 LDKChainMonitor this_ptr_conv;
5747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5748 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5749 ChainMonitor_free(this_ptr_conv);
5752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
5753 LDKChainMonitor this_arg_conv;
5754 this_arg_conv.inner = (void*)(this_arg & (~1));
5755 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5756 unsigned char header_arr[80];
5757 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5758 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5759 unsigned char (*header_ref)[80] = &header_arr;
5760 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5761 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
5762 if (txdata_constr.datalen > 0)
5763 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5765 txdata_constr.data = NULL;
5766 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
5767 for (size_t d = 0; d < txdata_constr.datalen; d++) {
5768 long arr_conv_29 = txdata_vals[d];
5769 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
5770 FREE((void*)arr_conv_29);
5771 txdata_constr.data[d] = arr_conv_29_conv;
5773 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
5774 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
5777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
5778 LDKChainMonitor this_arg_conv;
5779 this_arg_conv.inner = (void*)(this_arg & (~1));
5780 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5781 unsigned char header_arr[80];
5782 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5783 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5784 unsigned char (*header_ref)[80] = &header_arr;
5785 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
5788 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
5789 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
5790 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5791 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5792 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5793 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5795 LDKLogger logger_conv = *(LDKLogger*)logger;
5796 if (logger_conv.free == LDKLogger_JCalls_free) {
5797 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5798 LDKLogger_JCalls_clone(logger_conv.this_arg);
5800 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
5801 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
5802 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5803 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
5805 LDKChainMonitor ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
5806 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5809 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
5810 LDKChainMonitor this_arg_conv;
5811 this_arg_conv.inner = (void*)(this_arg & (~1));
5812 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5813 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
5814 *ret = ChainMonitor_as_Watch(&this_arg_conv);
5818 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5819 LDKChainMonitor this_arg_conv;
5820 this_arg_conv.inner = (void*)(this_arg & (~1));
5821 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5822 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5823 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
5827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5828 LDKChannelMonitorUpdate this_ptr_conv;
5829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5830 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5831 ChannelMonitorUpdate_free(this_ptr_conv);
5834 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5835 LDKChannelMonitorUpdate orig_conv;
5836 orig_conv.inner = (void*)(orig & (~1));
5837 orig_conv.is_owned = (orig & 1) || (orig == 0);
5838 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_clone(&orig_conv);
5839 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5842 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5843 LDKChannelMonitorUpdate this_ptr_conv;
5844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5845 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5846 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
5850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5851 LDKChannelMonitorUpdate this_ptr_conv;
5852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5853 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5854 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
5857 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5858 LDKChannelMonitorUpdate obj_conv;
5859 obj_conv.inner = (void*)(obj & (~1));
5860 obj_conv.is_owned = (obj & 1) || (obj == 0);
5861 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
5862 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5863 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5864 CVec_u8Z_free(arg_var);
5868 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5870 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5871 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5872 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_read(ser_ref);
5873 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5874 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5877 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5878 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
5879 jclass ret = LDKChannelMonitorUpdateErr_to_java(_env, ChannelMonitorUpdateErr_clone(orig_conv));
5883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5884 LDKMonitorUpdateError this_ptr_conv;
5885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5886 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5887 MonitorUpdateError_free(this_ptr_conv);
5890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5891 LDKMonitorEvent this_ptr_conv;
5892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5893 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5894 MonitorEvent_free(this_ptr_conv);
5897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5898 LDKHTLCUpdate this_ptr_conv;
5899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5900 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5901 HTLCUpdate_free(this_ptr_conv);
5904 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5905 LDKHTLCUpdate orig_conv;
5906 orig_conv.inner = (void*)(orig & (~1));
5907 orig_conv.is_owned = (orig & 1) || (orig == 0);
5908 LDKHTLCUpdate ret = HTLCUpdate_clone(&orig_conv);
5909 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5912 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5913 LDKHTLCUpdate obj_conv;
5914 obj_conv.inner = (void*)(obj & (~1));
5915 obj_conv.is_owned = (obj & 1) || (obj == 0);
5916 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
5917 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5918 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5919 CVec_u8Z_free(arg_var);
5923 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5925 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5926 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5927 LDKHTLCUpdate ret = HTLCUpdate_read(ser_ref);
5928 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5929 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5933 LDKChannelMonitor this_ptr_conv;
5934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5935 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5936 ChannelMonitor_free(this_ptr_conv);
5939 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
5940 LDKChannelMonitor this_arg_conv;
5941 this_arg_conv.inner = (void*)(this_arg & (~1));
5942 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5943 LDKChannelMonitorUpdate updates_conv;
5944 updates_conv.inner = (void*)(updates & (~1));
5945 updates_conv.is_owned = (updates & 1) || (updates == 0);
5946 if (updates_conv.inner != NULL)
5947 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
5948 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
5949 LDKLogger* logger_conv = (LDKLogger*)logger;
5950 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5951 *ret = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
5955 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5956 LDKChannelMonitor this_arg_conv;
5957 this_arg_conv.inner = (void*)(this_arg & (~1));
5958 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5959 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
5963 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
5964 LDKChannelMonitor this_arg_conv;
5965 this_arg_conv.inner = (void*)(this_arg & (~1));
5966 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5967 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5968 *ret = ChannelMonitor_get_funding_txo(&this_arg_conv);
5972 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5973 LDKChannelMonitor this_arg_conv;
5974 this_arg_conv.inner = (void*)(this_arg & (~1));
5975 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5976 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
5977 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
5978 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
5979 for (size_t o = 0; o < ret_var.datalen; o++) {
5980 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
5981 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5982 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5983 long arr_conv_14_ref;
5984 if (arr_conv_14_var.is_owned) {
5985 arr_conv_14_ref = (long)arr_conv_14_var.inner | 1;
5987 arr_conv_14_ref = (long)arr_conv_14_var.inner & ~1;
5989 ret_arr_ptr[o] = arr_conv_14_ref;
5991 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
5996 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5997 LDKChannelMonitor this_arg_conv;
5998 this_arg_conv.inner = (void*)(this_arg & (~1));
5999 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6000 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
6001 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6002 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6003 for (size_t h = 0; h < ret_var.datalen; h++) {
6004 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6005 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
6006 long arr_conv_7_ref = (long)arr_conv_7_copy;
6007 ret_arr_ptr[h] = arr_conv_7_ref;
6009 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6010 CVec_EventZ_free(ret_var);
6014 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
6015 LDKChannelMonitor this_arg_conv;
6016 this_arg_conv.inner = (void*)(this_arg & (~1));
6017 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6018 LDKLogger* logger_conv = (LDKLogger*)logger;
6019 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
6020 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6021 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6022 for (size_t n = 0; n < ret_var.datalen; n++) {
6023 long arr_conv_13_ref = (long)&ret_var.data[n];
6024 ret_arr_ptr[n] = arr_conv_13_ref;
6026 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6027 CVec_TransactionZ_free(ret_var);
6031 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) {
6032 LDKChannelMonitor this_arg_conv;
6033 this_arg_conv.inner = (void*)(this_arg & (~1));
6034 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6035 unsigned char header_arr[80];
6036 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6037 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6038 unsigned char (*header_ref)[80] = &header_arr;
6039 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6040 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6041 if (txdata_constr.datalen > 0)
6042 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6044 txdata_constr.data = NULL;
6045 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6046 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6047 long arr_conv_29 = txdata_vals[d];
6048 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6049 FREE((void*)arr_conv_29);
6050 txdata_constr.data[d] = arr_conv_29_conv;
6052 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6053 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6054 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6055 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6056 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6058 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6059 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6060 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6061 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6063 LDKLogger logger_conv = *(LDKLogger*)logger;
6064 if (logger_conv.free == LDKLogger_JCalls_free) {
6065 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6066 LDKLogger_JCalls_clone(logger_conv.this_arg);
6068 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6069 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6070 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6071 for (size_t b = 0; b < ret_var.datalen; b++) {
6072 /*XXX False */long arr_conv_27_ref = (long)&ret_var.data[b];
6073 ret_arr_ptr[b] = arr_conv_27_ref;
6075 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6076 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(ret_var);
6080 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) {
6081 LDKChannelMonitor this_arg_conv;
6082 this_arg_conv.inner = (void*)(this_arg & (~1));
6083 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6084 unsigned char header_arr[80];
6085 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6086 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6087 unsigned char (*header_ref)[80] = &header_arr;
6088 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6089 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6090 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6091 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6093 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6094 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6095 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6096 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6098 LDKLogger logger_conv = *(LDKLogger*)logger;
6099 if (logger_conv.free == LDKLogger_JCalls_free) {
6100 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6101 LDKLogger_JCalls_clone(logger_conv.this_arg);
6103 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6107 LDKOutPoint this_ptr_conv;
6108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6109 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6110 OutPoint_free(this_ptr_conv);
6113 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6114 LDKOutPoint orig_conv;
6115 orig_conv.inner = (void*)(orig & (~1));
6116 orig_conv.is_owned = (orig & 1) || (orig == 0);
6117 LDKOutPoint ret = OutPoint_clone(&orig_conv);
6118 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6121 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6122 LDKOutPoint this_ptr_conv;
6123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6124 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6125 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6126 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
6130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6131 LDKOutPoint this_ptr_conv;
6132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6133 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6134 LDKThirtyTwoBytes val_ref;
6135 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6136 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6137 OutPoint_set_txid(&this_ptr_conv, val_ref);
6140 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6141 LDKOutPoint this_ptr_conv;
6142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6143 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6144 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
6148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6149 LDKOutPoint this_ptr_conv;
6150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6151 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6152 OutPoint_set_index(&this_ptr_conv, val);
6155 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
6156 LDKThirtyTwoBytes txid_arg_ref;
6157 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
6158 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
6159 LDKOutPoint ret = OutPoint_new(txid_arg_ref, index_arg);
6160 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6163 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6164 LDKOutPoint this_arg_conv;
6165 this_arg_conv.inner = (void*)(this_arg & (~1));
6166 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6167 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
6168 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
6172 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
6173 LDKOutPoint obj_conv;
6174 obj_conv.inner = (void*)(obj & (~1));
6175 obj_conv.is_owned = (obj & 1) || (obj == 0);
6176 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
6177 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6178 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6179 CVec_u8Z_free(arg_var);
6183 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6185 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6186 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6187 LDKOutPoint ret = OutPoint_read(ser_ref);
6188 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6189 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6193 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
6194 FREE((void*)this_ptr);
6195 SpendableOutputDescriptor_free(this_ptr_conv);
6198 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6199 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
6200 LDKSpendableOutputDescriptor* ret = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
6201 *ret = SpendableOutputDescriptor_clone(orig_conv);
6205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6206 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
6207 FREE((void*)this_ptr);
6208 ChannelKeys_free(this_ptr_conv);
6211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6212 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
6213 FREE((void*)this_ptr);
6214 KeysInterface_free(this_ptr_conv);
6217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6218 LDKInMemoryChannelKeys this_ptr_conv;
6219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6220 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6221 InMemoryChannelKeys_free(this_ptr_conv);
6224 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6225 LDKInMemoryChannelKeys orig_conv;
6226 orig_conv.inner = (void*)(orig & (~1));
6227 orig_conv.is_owned = (orig & 1) || (orig == 0);
6228 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_clone(&orig_conv);
6229 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6232 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6233 LDKInMemoryChannelKeys this_ptr_conv;
6234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6235 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6236 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6237 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
6241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6242 LDKInMemoryChannelKeys this_ptr_conv;
6243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6244 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6245 LDKSecretKey val_ref;
6246 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6247 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6248 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
6251 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6252 LDKInMemoryChannelKeys this_ptr_conv;
6253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6254 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6255 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6256 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
6260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6261 LDKInMemoryChannelKeys this_ptr_conv;
6262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6263 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6264 LDKSecretKey val_ref;
6265 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6266 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6267 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
6270 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6271 LDKInMemoryChannelKeys this_ptr_conv;
6272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6273 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6274 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6275 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
6279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6280 LDKInMemoryChannelKeys this_ptr_conv;
6281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6282 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6283 LDKSecretKey val_ref;
6284 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6285 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6286 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
6289 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6290 LDKInMemoryChannelKeys this_ptr_conv;
6291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6292 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6293 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6294 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
6298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6299 LDKInMemoryChannelKeys this_ptr_conv;
6300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6301 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6302 LDKSecretKey val_ref;
6303 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6304 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6305 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
6308 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6309 LDKInMemoryChannelKeys this_ptr_conv;
6310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6311 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6312 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6313 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
6317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6318 LDKInMemoryChannelKeys this_ptr_conv;
6319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6320 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6321 LDKSecretKey val_ref;
6322 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6323 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6324 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6327 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
6328 LDKInMemoryChannelKeys this_ptr_conv;
6329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6330 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6331 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6332 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
6336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6337 LDKInMemoryChannelKeys this_ptr_conv;
6338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6339 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6340 LDKThirtyTwoBytes val_ref;
6341 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6342 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6343 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6346 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) {
6347 LDKSecretKey funding_key_ref;
6348 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
6349 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
6350 LDKSecretKey revocation_base_key_ref;
6351 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
6352 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
6353 LDKSecretKey payment_key_ref;
6354 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
6355 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
6356 LDKSecretKey delayed_payment_base_key_ref;
6357 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
6358 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
6359 LDKSecretKey htlc_base_key_ref;
6360 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
6361 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
6362 LDKThirtyTwoBytes commitment_seed_ref;
6363 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
6364 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
6365 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
6366 FREE((void*)key_derivation_params);
6367 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);
6368 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6371 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6372 LDKInMemoryChannelKeys this_arg_conv;
6373 this_arg_conv.inner = (void*)(this_arg & (~1));
6374 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6375 LDKChannelPublicKeys ret = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
6376 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6379 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6380 LDKInMemoryChannelKeys this_arg_conv;
6381 this_arg_conv.inner = (void*)(this_arg & (~1));
6382 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6383 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
6387 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6388 LDKInMemoryChannelKeys this_arg_conv;
6389 this_arg_conv.inner = (void*)(this_arg & (~1));
6390 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6391 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
6395 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6396 LDKInMemoryChannelKeys this_arg_conv;
6397 this_arg_conv.inner = (void*)(this_arg & (~1));
6398 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6399 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6400 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
6404 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
6405 LDKInMemoryChannelKeys obj_conv;
6406 obj_conv.inner = (void*)(obj & (~1));
6407 obj_conv.is_owned = (obj & 1) || (obj == 0);
6408 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
6409 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6410 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6411 CVec_u8Z_free(arg_var);
6415 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6417 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6418 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6419 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_read(ser_ref);
6420 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6421 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6425 LDKKeysManager this_ptr_conv;
6426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6427 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6428 KeysManager_free(this_ptr_conv);
6431 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) {
6432 unsigned char seed_arr[32];
6433 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
6434 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
6435 unsigned char (*seed_ref)[32] = &seed_arr;
6436 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6437 LDKKeysManager ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
6438 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6441 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) {
6442 LDKKeysManager this_arg_conv;
6443 this_arg_conv.inner = (void*)(this_arg & (~1));
6444 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6445 LDKInMemoryChannelKeys ret = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
6446 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6449 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
6450 LDKKeysManager this_arg_conv;
6451 this_arg_conv.inner = (void*)(this_arg & (~1));
6452 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6453 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6454 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
6458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6459 LDKChannelManager this_ptr_conv;
6460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6462 ChannelManager_free(this_ptr_conv);
6465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6466 LDKChannelDetails this_ptr_conv;
6467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6468 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6469 ChannelDetails_free(this_ptr_conv);
6472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6473 LDKChannelDetails orig_conv;
6474 orig_conv.inner = (void*)(orig & (~1));
6475 orig_conv.is_owned = (orig & 1) || (orig == 0);
6476 LDKChannelDetails ret = ChannelDetails_clone(&orig_conv);
6477 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6480 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6481 LDKChannelDetails this_ptr_conv;
6482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6483 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6484 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6485 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
6489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6490 LDKChannelDetails this_ptr_conv;
6491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6492 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6493 LDKThirtyTwoBytes val_ref;
6494 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6495 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6496 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
6499 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6500 LDKChannelDetails this_ptr_conv;
6501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6502 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6503 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6504 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
6508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6509 LDKChannelDetails this_ptr_conv;
6510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6511 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6512 LDKPublicKey val_ref;
6513 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6514 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6515 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
6518 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
6519 LDKChannelDetails this_ptr_conv;
6520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6521 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6522 LDKInitFeatures ret = ChannelDetails_get_counterparty_features(&this_ptr_conv);
6523 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6527 LDKChannelDetails this_ptr_conv;
6528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6529 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6530 LDKInitFeatures val_conv;
6531 val_conv.inner = (void*)(val & (~1));
6532 val_conv.is_owned = (val & 1) || (val == 0);
6533 // Warning: we may need a move here but can't clone!
6534 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
6537 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6538 LDKChannelDetails this_ptr_conv;
6539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6541 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
6545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6546 LDKChannelDetails this_ptr_conv;
6547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6548 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6549 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
6552 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6553 LDKChannelDetails this_ptr_conv;
6554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6555 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6556 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
6560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6561 LDKChannelDetails this_ptr_conv;
6562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6563 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6564 ChannelDetails_set_user_id(&this_ptr_conv, val);
6567 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6568 LDKChannelDetails this_ptr_conv;
6569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6570 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6571 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
6575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6576 LDKChannelDetails this_ptr_conv;
6577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6579 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
6582 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6583 LDKChannelDetails this_ptr_conv;
6584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6585 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6586 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
6590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6591 LDKChannelDetails this_ptr_conv;
6592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6593 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6594 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
6597 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
6598 LDKChannelDetails this_ptr_conv;
6599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6600 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6601 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
6605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6606 LDKChannelDetails this_ptr_conv;
6607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6608 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6609 ChannelDetails_set_is_live(&this_ptr_conv, val);
6612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6613 LDKPaymentSendFailure this_ptr_conv;
6614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6615 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6616 PaymentSendFailure_free(this_ptr_conv);
6619 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) {
6620 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6621 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
6622 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
6623 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6624 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
6626 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6627 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6628 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6629 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6631 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6632 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6633 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6634 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6636 LDKLogger logger_conv = *(LDKLogger*)logger;
6637 if (logger_conv.free == LDKLogger_JCalls_free) {
6638 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6639 LDKLogger_JCalls_clone(logger_conv.this_arg);
6641 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6642 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6643 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6644 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6646 LDKUserConfig config_conv;
6647 config_conv.inner = (void*)(config & (~1));
6648 config_conv.is_owned = (config & 1) || (config == 0);
6649 if (config_conv.inner != NULL)
6650 config_conv = UserConfig_clone(&config_conv);
6651 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);
6652 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6655 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) {
6656 LDKChannelManager this_arg_conv;
6657 this_arg_conv.inner = (void*)(this_arg & (~1));
6658 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6659 LDKPublicKey their_network_key_ref;
6660 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
6661 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
6662 LDKUserConfig override_config_conv;
6663 override_config_conv.inner = (void*)(override_config & (~1));
6664 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
6665 if (override_config_conv.inner != NULL)
6666 override_config_conv = UserConfig_clone(&override_config_conv);
6667 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6668 *ret = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
6672 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6673 LDKChannelManager this_arg_conv;
6674 this_arg_conv.inner = (void*)(this_arg & (~1));
6675 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6676 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
6677 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6678 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6679 for (size_t q = 0; q < ret_var.datalen; q++) {
6680 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
6681 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6682 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6683 long arr_conv_16_ref;
6684 if (arr_conv_16_var.is_owned) {
6685 arr_conv_16_ref = (long)arr_conv_16_var.inner | 1;
6687 arr_conv_16_ref = (long)arr_conv_16_var.inner & ~1;
6689 ret_arr_ptr[q] = arr_conv_16_ref;
6691 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6696 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6697 LDKChannelManager this_arg_conv;
6698 this_arg_conv.inner = (void*)(this_arg & (~1));
6699 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6700 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
6701 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6702 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6703 for (size_t q = 0; q < ret_var.datalen; q++) {
6704 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
6705 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6706 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6707 long arr_conv_16_ref;
6708 if (arr_conv_16_var.is_owned) {
6709 arr_conv_16_ref = (long)arr_conv_16_var.inner | 1;
6711 arr_conv_16_ref = (long)arr_conv_16_var.inner & ~1;
6713 ret_arr_ptr[q] = arr_conv_16_ref;
6715 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6720 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6721 LDKChannelManager this_arg_conv;
6722 this_arg_conv.inner = (void*)(this_arg & (~1));
6723 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6724 unsigned char channel_id_arr[32];
6725 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6726 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6727 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6728 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6729 *ret = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
6733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6734 LDKChannelManager this_arg_conv;
6735 this_arg_conv.inner = (void*)(this_arg & (~1));
6736 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6737 unsigned char channel_id_arr[32];
6738 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6739 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6740 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6741 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
6744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6745 LDKChannelManager this_arg_conv;
6746 this_arg_conv.inner = (void*)(this_arg & (~1));
6747 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6748 ChannelManager_force_close_all_channels(&this_arg_conv);
6751 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) {
6752 LDKChannelManager this_arg_conv;
6753 this_arg_conv.inner = (void*)(this_arg & (~1));
6754 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6755 LDKRoute route_conv;
6756 route_conv.inner = (void*)(route & (~1));
6757 route_conv.is_owned = (route & 1) || (route == 0);
6758 LDKThirtyTwoBytes payment_hash_ref;
6759 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6760 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
6761 LDKThirtyTwoBytes payment_secret_ref;
6762 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6763 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6764 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6765 *ret = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
6769 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) {
6770 LDKChannelManager this_arg_conv;
6771 this_arg_conv.inner = (void*)(this_arg & (~1));
6772 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6773 unsigned char temporary_channel_id_arr[32];
6774 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
6775 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
6776 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
6777 LDKOutPoint funding_txo_conv;
6778 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6779 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6780 if (funding_txo_conv.inner != NULL)
6781 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6782 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
6785 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) {
6786 LDKChannelManager this_arg_conv;
6787 this_arg_conv.inner = (void*)(this_arg & (~1));
6788 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6789 LDKThreeBytes rgb_ref;
6790 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
6791 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
6792 LDKThirtyTwoBytes alias_ref;
6793 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
6794 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
6795 LDKCVec_NetAddressZ addresses_constr;
6796 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
6797 if (addresses_constr.datalen > 0)
6798 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6800 addresses_constr.data = NULL;
6801 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
6802 for (size_t m = 0; m < addresses_constr.datalen; m++) {
6803 long arr_conv_12 = addresses_vals[m];
6804 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
6805 FREE((void*)arr_conv_12);
6806 addresses_constr.data[m] = arr_conv_12_conv;
6808 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
6809 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
6812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
6813 LDKChannelManager this_arg_conv;
6814 this_arg_conv.inner = (void*)(this_arg & (~1));
6815 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6816 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
6819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
6820 LDKChannelManager this_arg_conv;
6821 this_arg_conv.inner = (void*)(this_arg & (~1));
6822 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6823 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
6826 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) {
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 unsigned char payment_hash_arr[32];
6831 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6832 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
6833 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
6834 LDKThirtyTwoBytes payment_secret_ref;
6835 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6836 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6837 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
6841 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) {
6842 LDKChannelManager this_arg_conv;
6843 this_arg_conv.inner = (void*)(this_arg & (~1));
6844 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6845 LDKThirtyTwoBytes payment_preimage_ref;
6846 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
6847 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
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_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
6855 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6860 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
6864 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) {
6865 LDKChannelManager this_arg_conv;
6866 this_arg_conv.inner = (void*)(this_arg & (~1));
6867 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6868 LDKOutPoint funding_txo_conv;
6869 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6870 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6871 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
6874 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6875 LDKChannelManager this_arg_conv;
6876 this_arg_conv.inner = (void*)(this_arg & (~1));
6877 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6878 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6879 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
6883 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6884 LDKChannelManager this_arg_conv;
6885 this_arg_conv.inner = (void*)(this_arg & (~1));
6886 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6887 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6888 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
6892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
6893 LDKChannelManager this_arg_conv;
6894 this_arg_conv.inner = (void*)(this_arg & (~1));
6895 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6896 unsigned char header_arr[80];
6897 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6898 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6899 unsigned char (*header_ref)[80] = &header_arr;
6900 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6901 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6902 if (txdata_constr.datalen > 0)
6903 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6905 txdata_constr.data = NULL;
6906 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6907 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6908 long arr_conv_29 = txdata_vals[d];
6909 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6910 FREE((void*)arr_conv_29);
6911 txdata_constr.data[d] = arr_conv_29_conv;
6913 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6914 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
6918 LDKChannelManager this_arg_conv;
6919 this_arg_conv.inner = (void*)(this_arg & (~1));
6920 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6921 unsigned char header_arr[80];
6922 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6923 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6924 unsigned char (*header_ref)[80] = &header_arr;
6925 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
6928 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
6929 LDKChannelManager this_arg_conv;
6930 this_arg_conv.inner = (void*)(this_arg & (~1));
6931 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6932 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6933 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
6937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6938 LDKChannelManagerReadArgs this_ptr_conv;
6939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6940 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6941 ChannelManagerReadArgs_free(this_ptr_conv);
6944 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
6945 LDKChannelManagerReadArgs this_ptr_conv;
6946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6947 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6948 long ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
6952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6953 LDKChannelManagerReadArgs this_ptr_conv;
6954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6955 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6956 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
6957 if (val_conv.free == LDKKeysInterface_JCalls_free) {
6958 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6959 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
6961 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
6964 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
6965 LDKChannelManagerReadArgs this_ptr_conv;
6966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6967 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6968 long ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
6972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6973 LDKChannelManagerReadArgs this_ptr_conv;
6974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6975 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6976 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
6977 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
6978 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6979 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
6981 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
6984 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
6985 LDKChannelManagerReadArgs this_ptr_conv;
6986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6987 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6988 long ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
6992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6993 LDKChannelManagerReadArgs this_ptr_conv;
6994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6995 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6996 LDKWatch val_conv = *(LDKWatch*)val;
6997 if (val_conv.free == LDKWatch_JCalls_free) {
6998 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6999 LDKWatch_JCalls_clone(val_conv.this_arg);
7001 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
7004 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
7005 LDKChannelManagerReadArgs this_ptr_conv;
7006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7007 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7008 long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
7012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7013 LDKChannelManagerReadArgs this_ptr_conv;
7014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7015 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7016 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
7017 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
7018 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7019 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
7021 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
7024 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
7025 LDKChannelManagerReadArgs this_ptr_conv;
7026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7027 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7028 long ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
7032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7033 LDKChannelManagerReadArgs this_ptr_conv;
7034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7035 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7036 LDKLogger val_conv = *(LDKLogger*)val;
7037 if (val_conv.free == LDKLogger_JCalls_free) {
7038 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7039 LDKLogger_JCalls_clone(val_conv.this_arg);
7041 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
7044 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
7045 LDKChannelManagerReadArgs this_ptr_conv;
7046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7047 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7048 LDKUserConfig ret = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
7049 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7053 LDKChannelManagerReadArgs this_ptr_conv;
7054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7055 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7056 LDKUserConfig val_conv;
7057 val_conv.inner = (void*)(val & (~1));
7058 val_conv.is_owned = (val & 1) || (val == 0);
7059 if (val_conv.inner != NULL)
7060 val_conv = UserConfig_clone(&val_conv);
7061 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
7064 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) {
7065 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7066 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7067 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7068 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7070 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7071 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
7072 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7073 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
7075 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7076 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7077 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7078 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7080 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7081 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7082 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7083 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7085 LDKLogger logger_conv = *(LDKLogger*)logger;
7086 if (logger_conv.free == LDKLogger_JCalls_free) {
7087 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7088 LDKLogger_JCalls_clone(logger_conv.this_arg);
7090 LDKUserConfig default_config_conv;
7091 default_config_conv.inner = (void*)(default_config & (~1));
7092 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
7093 if (default_config_conv.inner != NULL)
7094 default_config_conv = UserConfig_clone(&default_config_conv);
7095 LDKCVec_ChannelMonitorZ channel_monitors_constr;
7096 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
7097 if (channel_monitors_constr.datalen > 0)
7098 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7100 channel_monitors_constr.data = NULL;
7101 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
7102 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
7103 long arr_conv_16 = channel_monitors_vals[q];
7104 LDKChannelMonitor arr_conv_16_conv;
7105 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7106 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7107 // Warning: we may need a move here but can't clone!
7108 channel_monitors_constr.data[q] = arr_conv_16_conv;
7110 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
7111 LDKChannelManagerReadArgs ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr);
7112 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7116 LDKDecodeError this_ptr_conv;
7117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7118 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7119 DecodeError_free(this_ptr_conv);
7122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7123 LDKInit this_ptr_conv;
7124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7125 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7126 Init_free(this_ptr_conv);
7129 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7131 orig_conv.inner = (void*)(orig & (~1));
7132 orig_conv.is_owned = (orig & 1) || (orig == 0);
7133 LDKInit ret = Init_clone(&orig_conv);
7134 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7138 LDKErrorMessage this_ptr_conv;
7139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7140 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7141 ErrorMessage_free(this_ptr_conv);
7144 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7145 LDKErrorMessage orig_conv;
7146 orig_conv.inner = (void*)(orig & (~1));
7147 orig_conv.is_owned = (orig & 1) || (orig == 0);
7148 LDKErrorMessage ret = ErrorMessage_clone(&orig_conv);
7149 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7152 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7153 LDKErrorMessage this_ptr_conv;
7154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7156 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7157 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
7161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7162 LDKErrorMessage this_ptr_conv;
7163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7164 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7165 LDKThirtyTwoBytes val_ref;
7166 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7167 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7168 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
7171 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
7172 LDKErrorMessage this_ptr_conv;
7173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7174 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7175 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
7176 char* _buf = MALLOC(_str.len + 1, "str conv buf");
7177 memcpy(_buf, _str.chars, _str.len);
7179 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
7184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7185 LDKErrorMessage this_ptr_conv;
7186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7187 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7188 LDKCVec_u8Z val_ref;
7189 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
7190 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7191 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7192 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
7195 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
7196 LDKThirtyTwoBytes channel_id_arg_ref;
7197 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7198 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7199 LDKCVec_u8Z data_arg_ref;
7200 data_arg_ref.data = (*_env)->GetByteArrayElements (_env, data_arg, NULL);
7201 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
7202 LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7203 (*_env)->ReleaseByteArrayElements(_env, data_arg, (int8_t*)data_arg_ref.data, 0);
7204 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7208 LDKPing this_ptr_conv;
7209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7210 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7211 Ping_free(this_ptr_conv);
7214 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7216 orig_conv.inner = (void*)(orig & (~1));
7217 orig_conv.is_owned = (orig & 1) || (orig == 0);
7218 LDKPing ret = Ping_clone(&orig_conv);
7219 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7222 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7223 LDKPing this_ptr_conv;
7224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7225 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7226 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7231 LDKPing this_ptr_conv;
7232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7233 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7234 Ping_set_ponglen(&this_ptr_conv, val);
7237 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7238 LDKPing this_ptr_conv;
7239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7240 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7241 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7246 LDKPing this_ptr_conv;
7247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7248 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7249 Ping_set_byteslen(&this_ptr_conv, val);
7252 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
7253 LDKPing ret = Ping_new(ponglen_arg, byteslen_arg);
7254 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7258 LDKPong this_ptr_conv;
7259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7261 Pong_free(this_ptr_conv);
7264 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7266 orig_conv.inner = (void*)(orig & (~1));
7267 orig_conv.is_owned = (orig & 1) || (orig == 0);
7268 LDKPong ret = Pong_clone(&orig_conv);
7269 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7272 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7273 LDKPong this_ptr_conv;
7274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7275 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7276 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
7280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7281 LDKPong this_ptr_conv;
7282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7283 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7284 Pong_set_byteslen(&this_ptr_conv, val);
7287 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
7288 LDKPong ret = Pong_new(byteslen_arg);
7289 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7293 LDKOpenChannel this_ptr_conv;
7294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7295 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7296 OpenChannel_free(this_ptr_conv);
7299 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7300 LDKOpenChannel orig_conv;
7301 orig_conv.inner = (void*)(orig & (~1));
7302 orig_conv.is_owned = (orig & 1) || (orig == 0);
7303 LDKOpenChannel ret = OpenChannel_clone(&orig_conv);
7304 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7307 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7308 LDKOpenChannel this_ptr_conv;
7309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7310 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7311 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7312 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
7316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7317 LDKOpenChannel this_ptr_conv;
7318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7319 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7320 LDKThirtyTwoBytes val_ref;
7321 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7322 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7323 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
7326 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7327 LDKOpenChannel this_ptr_conv;
7328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7329 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7330 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7331 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
7335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7336 LDKOpenChannel this_ptr_conv;
7337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7339 LDKThirtyTwoBytes val_ref;
7340 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7341 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7342 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7345 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7346 LDKOpenChannel this_ptr_conv;
7347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7348 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7349 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
7353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7354 LDKOpenChannel this_ptr_conv;
7355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7356 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7357 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
7360 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7361 LDKOpenChannel this_ptr_conv;
7362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7363 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7364 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
7368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7369 LDKOpenChannel this_ptr_conv;
7370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7371 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7372 OpenChannel_set_push_msat(&this_ptr_conv, val);
7375 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7376 LDKOpenChannel this_ptr_conv;
7377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7378 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7379 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
7383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7384 LDKOpenChannel this_ptr_conv;
7385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7387 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7390 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7391 LDKOpenChannel this_ptr_conv;
7392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7393 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7394 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7398 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) {
7399 LDKOpenChannel this_ptr_conv;
7400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7401 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7402 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7405 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7406 LDKOpenChannel this_ptr_conv;
7407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7408 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7409 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7414 LDKOpenChannel this_ptr_conv;
7415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7416 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7417 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7420 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7421 LDKOpenChannel this_ptr_conv;
7422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7423 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7424 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
7428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7429 LDKOpenChannel this_ptr_conv;
7430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7431 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7432 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7435 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7436 LDKOpenChannel this_ptr_conv;
7437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7438 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7439 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
7443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7444 LDKOpenChannel this_ptr_conv;
7445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7446 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7447 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
7450 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7451 LDKOpenChannel this_ptr_conv;
7452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7453 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7454 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
7458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7459 LDKOpenChannel this_ptr_conv;
7460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7462 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
7465 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7466 LDKOpenChannel this_ptr_conv;
7467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7468 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7469 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
7473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7474 LDKOpenChannel this_ptr_conv;
7475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7476 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7477 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7480 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7481 LDKOpenChannel this_ptr_conv;
7482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7483 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7484 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7485 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7490 LDKOpenChannel this_ptr_conv;
7491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7492 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7493 LDKPublicKey val_ref;
7494 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7495 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7496 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7499 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7500 LDKOpenChannel this_ptr_conv;
7501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7502 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7503 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7504 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7509 LDKOpenChannel this_ptr_conv;
7510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7511 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7512 LDKPublicKey val_ref;
7513 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7514 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7515 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7518 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7519 LDKOpenChannel this_ptr_conv;
7520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7521 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7522 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7523 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
7527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7528 LDKOpenChannel this_ptr_conv;
7529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7530 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7531 LDKPublicKey val_ref;
7532 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7533 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7534 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
7537 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7538 LDKOpenChannel this_ptr_conv;
7539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7541 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7542 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7547 LDKOpenChannel this_ptr_conv;
7548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7549 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7550 LDKPublicKey val_ref;
7551 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7552 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7553 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7556 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7557 LDKOpenChannel this_ptr_conv;
7558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7559 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7560 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7561 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
7565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7566 LDKOpenChannel this_ptr_conv;
7567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7569 LDKPublicKey val_ref;
7570 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7571 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7572 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7575 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7576 LDKOpenChannel this_ptr_conv;
7577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7579 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7580 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
7584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7585 LDKOpenChannel this_ptr_conv;
7586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7587 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7588 LDKPublicKey val_ref;
7589 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7590 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7591 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7594 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
7595 LDKOpenChannel this_ptr_conv;
7596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7597 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7598 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
7602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
7603 LDKOpenChannel this_ptr_conv;
7604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7605 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7606 OpenChannel_set_channel_flags(&this_ptr_conv, val);
7609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7610 LDKAcceptChannel this_ptr_conv;
7611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7612 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7613 AcceptChannel_free(this_ptr_conv);
7616 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7617 LDKAcceptChannel orig_conv;
7618 orig_conv.inner = (void*)(orig & (~1));
7619 orig_conv.is_owned = (orig & 1) || (orig == 0);
7620 LDKAcceptChannel ret = AcceptChannel_clone(&orig_conv);
7621 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7624 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7625 LDKAcceptChannel this_ptr_conv;
7626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7627 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7628 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7629 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
7633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7634 LDKAcceptChannel this_ptr_conv;
7635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7636 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7637 LDKThirtyTwoBytes val_ref;
7638 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7639 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7640 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7643 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7644 LDKAcceptChannel this_ptr_conv;
7645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7646 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7647 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
7651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7652 LDKAcceptChannel this_ptr_conv;
7653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7654 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7655 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7658 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7659 LDKAcceptChannel this_ptr_conv;
7660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7661 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7662 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7666 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) {
7667 LDKAcceptChannel this_ptr_conv;
7668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7670 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7673 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7674 LDKAcceptChannel this_ptr_conv;
7675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7676 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7677 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7682 LDKAcceptChannel this_ptr_conv;
7683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7684 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7685 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7688 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7689 LDKAcceptChannel this_ptr_conv;
7690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7691 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7692 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
7696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7697 LDKAcceptChannel this_ptr_conv;
7698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7699 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7700 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7703 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
7704 LDKAcceptChannel this_ptr_conv;
7705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7706 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7707 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
7711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7712 LDKAcceptChannel this_ptr_conv;
7713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7715 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
7718 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7719 LDKAcceptChannel this_ptr_conv;
7720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7721 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7722 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
7726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7727 LDKAcceptChannel this_ptr_conv;
7728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7729 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7730 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
7733 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7734 LDKAcceptChannel this_ptr_conv;
7735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7736 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7737 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
7741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7742 LDKAcceptChannel this_ptr_conv;
7743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7744 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7745 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7748 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7749 LDKAcceptChannel this_ptr_conv;
7750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7751 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7752 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7753 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7758 LDKAcceptChannel this_ptr_conv;
7759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7760 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7761 LDKPublicKey val_ref;
7762 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7763 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7764 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7767 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7768 LDKAcceptChannel this_ptr_conv;
7769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7770 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7771 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7772 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7777 LDKAcceptChannel this_ptr_conv;
7778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7779 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7780 LDKPublicKey val_ref;
7781 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7782 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7783 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7786 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7787 LDKAcceptChannel this_ptr_conv;
7788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7789 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7790 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7791 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
7795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7796 LDKAcceptChannel this_ptr_conv;
7797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7799 LDKPublicKey val_ref;
7800 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7801 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7802 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
7805 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7806 LDKAcceptChannel this_ptr_conv;
7807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7808 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7809 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7810 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7815 LDKAcceptChannel this_ptr_conv;
7816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7817 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7818 LDKPublicKey val_ref;
7819 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7820 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7821 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7824 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7825 LDKAcceptChannel this_ptr_conv;
7826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7827 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7828 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7829 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
7833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7834 LDKAcceptChannel this_ptr_conv;
7835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7836 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7837 LDKPublicKey val_ref;
7838 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7839 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7840 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7843 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7844 LDKAcceptChannel this_ptr_conv;
7845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7846 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7847 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7848 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
7852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7853 LDKAcceptChannel this_ptr_conv;
7854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7855 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7856 LDKPublicKey val_ref;
7857 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7858 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7859 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7863 LDKFundingCreated this_ptr_conv;
7864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7865 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7866 FundingCreated_free(this_ptr_conv);
7869 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7870 LDKFundingCreated orig_conv;
7871 orig_conv.inner = (void*)(orig & (~1));
7872 orig_conv.is_owned = (orig & 1) || (orig == 0);
7873 LDKFundingCreated ret = FundingCreated_clone(&orig_conv);
7874 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7877 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7878 LDKFundingCreated this_ptr_conv;
7879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7881 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7882 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
7886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7887 LDKFundingCreated this_ptr_conv;
7888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7889 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7890 LDKThirtyTwoBytes val_ref;
7891 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7892 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7893 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
7896 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
7897 LDKFundingCreated this_ptr_conv;
7898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7899 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7900 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7901 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
7905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7906 LDKFundingCreated this_ptr_conv;
7907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7908 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7909 LDKThirtyTwoBytes val_ref;
7910 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7911 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7912 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
7915 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
7916 LDKFundingCreated this_ptr_conv;
7917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7918 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7919 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
7923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7924 LDKFundingCreated this_ptr_conv;
7925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7926 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7927 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
7930 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7931 LDKFundingCreated this_ptr_conv;
7932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7933 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7934 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7935 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
7939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7940 LDKFundingCreated this_ptr_conv;
7941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7942 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7943 LDKSignature val_ref;
7944 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7945 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7946 FundingCreated_set_signature(&this_ptr_conv, val_ref);
7949 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) {
7950 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
7951 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
7952 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
7953 LDKThirtyTwoBytes funding_txid_arg_ref;
7954 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
7955 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
7956 LDKSignature signature_arg_ref;
7957 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7958 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7959 LDKFundingCreated ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
7960 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7964 LDKFundingSigned this_ptr_conv;
7965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7966 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7967 FundingSigned_free(this_ptr_conv);
7970 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7971 LDKFundingSigned orig_conv;
7972 orig_conv.inner = (void*)(orig & (~1));
7973 orig_conv.is_owned = (orig & 1) || (orig == 0);
7974 LDKFundingSigned ret = FundingSigned_clone(&orig_conv);
7975 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7978 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7979 LDKFundingSigned this_ptr_conv;
7980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7981 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7982 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7983 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
7987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7988 LDKFundingSigned this_ptr_conv;
7989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7990 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7991 LDKThirtyTwoBytes val_ref;
7992 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7993 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7994 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
7997 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7998 LDKFundingSigned this_ptr_conv;
7999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8000 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8001 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8002 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
8006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8007 LDKFundingSigned this_ptr_conv;
8008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8009 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8010 LDKSignature val_ref;
8011 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8012 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8013 FundingSigned_set_signature(&this_ptr_conv, val_ref);
8016 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
8017 LDKThirtyTwoBytes channel_id_arg_ref;
8018 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8019 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8020 LDKSignature signature_arg_ref;
8021 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8022 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8023 LDKFundingSigned ret = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
8024 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8028 LDKFundingLocked this_ptr_conv;
8029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8030 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8031 FundingLocked_free(this_ptr_conv);
8034 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8035 LDKFundingLocked orig_conv;
8036 orig_conv.inner = (void*)(orig & (~1));
8037 orig_conv.is_owned = (orig & 1) || (orig == 0);
8038 LDKFundingLocked ret = FundingLocked_clone(&orig_conv);
8039 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8042 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8043 LDKFundingLocked this_ptr_conv;
8044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8045 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8046 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8047 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
8051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8052 LDKFundingLocked this_ptr_conv;
8053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8054 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8055 LDKThirtyTwoBytes val_ref;
8056 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8057 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8058 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
8061 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8062 LDKFundingLocked this_ptr_conv;
8063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8064 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8065 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8066 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8071 LDKFundingLocked this_ptr_conv;
8072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8073 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8074 LDKPublicKey val_ref;
8075 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8076 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8077 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8080 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
8081 LDKThirtyTwoBytes channel_id_arg_ref;
8082 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8083 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8084 LDKPublicKey next_per_commitment_point_arg_ref;
8085 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8086 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8087 LDKFundingLocked ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
8088 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8092 LDKShutdown this_ptr_conv;
8093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8094 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8095 Shutdown_free(this_ptr_conv);
8098 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8099 LDKShutdown orig_conv;
8100 orig_conv.inner = (void*)(orig & (~1));
8101 orig_conv.is_owned = (orig & 1) || (orig == 0);
8102 LDKShutdown ret = Shutdown_clone(&orig_conv);
8103 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8106 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8107 LDKShutdown this_ptr_conv;
8108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8109 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8110 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8111 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
8115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8116 LDKShutdown this_ptr_conv;
8117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8118 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8119 LDKThirtyTwoBytes val_ref;
8120 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8121 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8122 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8125 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8126 LDKShutdown this_ptr_conv;
8127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8128 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8129 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8130 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8131 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8136 LDKShutdown this_ptr_conv;
8137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8138 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8139 LDKCVec_u8Z val_ref;
8140 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
8141 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
8142 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8143 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
8146 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
8147 LDKThirtyTwoBytes channel_id_arg_ref;
8148 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8149 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8150 LDKCVec_u8Z scriptpubkey_arg_ref;
8151 scriptpubkey_arg_ref.data = (*_env)->GetByteArrayElements (_env, scriptpubkey_arg, NULL);
8152 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
8153 LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8154 (*_env)->ReleaseByteArrayElements(_env, scriptpubkey_arg, (int8_t*)scriptpubkey_arg_ref.data, 0);
8155 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8159 LDKClosingSigned this_ptr_conv;
8160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8161 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8162 ClosingSigned_free(this_ptr_conv);
8165 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8166 LDKClosingSigned orig_conv;
8167 orig_conv.inner = (void*)(orig & (~1));
8168 orig_conv.is_owned = (orig & 1) || (orig == 0);
8169 LDKClosingSigned ret = ClosingSigned_clone(&orig_conv);
8170 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8173 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8174 LDKClosingSigned this_ptr_conv;
8175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8176 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8177 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8178 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
8182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8183 LDKClosingSigned this_ptr_conv;
8184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8185 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8186 LDKThirtyTwoBytes val_ref;
8187 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8188 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8189 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
8192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8193 LDKClosingSigned this_ptr_conv;
8194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8195 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8196 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
8200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8201 LDKClosingSigned this_ptr_conv;
8202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8203 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8204 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
8207 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8208 LDKClosingSigned this_ptr_conv;
8209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8210 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8211 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8212 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
8216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8217 LDKClosingSigned this_ptr_conv;
8218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8219 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8220 LDKSignature val_ref;
8221 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8222 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8223 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
8226 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) {
8227 LDKThirtyTwoBytes channel_id_arg_ref;
8228 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8229 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8230 LDKSignature signature_arg_ref;
8231 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8232 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8233 LDKClosingSigned ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
8234 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8238 LDKUpdateAddHTLC this_ptr_conv;
8239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8240 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8241 UpdateAddHTLC_free(this_ptr_conv);
8244 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8245 LDKUpdateAddHTLC orig_conv;
8246 orig_conv.inner = (void*)(orig & (~1));
8247 orig_conv.is_owned = (orig & 1) || (orig == 0);
8248 LDKUpdateAddHTLC ret = UpdateAddHTLC_clone(&orig_conv);
8249 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8252 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8253 LDKUpdateAddHTLC this_ptr_conv;
8254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8255 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8256 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8257 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
8261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8262 LDKUpdateAddHTLC this_ptr_conv;
8263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8264 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8265 LDKThirtyTwoBytes val_ref;
8266 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8267 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8268 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
8271 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8272 LDKUpdateAddHTLC this_ptr_conv;
8273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8274 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8275 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
8279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8280 LDKUpdateAddHTLC this_ptr_conv;
8281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8282 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8283 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
8286 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8287 LDKUpdateAddHTLC this_ptr_conv;
8288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8289 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8290 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
8294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8295 LDKUpdateAddHTLC this_ptr_conv;
8296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8297 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8298 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
8301 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8302 LDKUpdateAddHTLC this_ptr_conv;
8303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8304 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8305 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8306 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
8310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8311 LDKUpdateAddHTLC this_ptr_conv;
8312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8313 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8314 LDKThirtyTwoBytes val_ref;
8315 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8316 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8317 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
8320 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
8321 LDKUpdateAddHTLC this_ptr_conv;
8322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8323 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8324 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
8328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8329 LDKUpdateAddHTLC this_ptr_conv;
8330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8331 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8332 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
8335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8336 LDKUpdateFulfillHTLC this_ptr_conv;
8337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8339 UpdateFulfillHTLC_free(this_ptr_conv);
8342 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8343 LDKUpdateFulfillHTLC orig_conv;
8344 orig_conv.inner = (void*)(orig & (~1));
8345 orig_conv.is_owned = (orig & 1) || (orig == 0);
8346 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_clone(&orig_conv);
8347 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8350 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8351 LDKUpdateFulfillHTLC this_ptr_conv;
8352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8353 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8354 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8355 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
8359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8360 LDKUpdateFulfillHTLC this_ptr_conv;
8361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8362 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8363 LDKThirtyTwoBytes val_ref;
8364 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8365 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8366 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
8369 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8370 LDKUpdateFulfillHTLC this_ptr_conv;
8371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8372 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8373 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
8377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8378 LDKUpdateFulfillHTLC this_ptr_conv;
8379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8380 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8381 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
8384 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
8385 LDKUpdateFulfillHTLC this_ptr_conv;
8386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8388 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8389 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
8393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8394 LDKUpdateFulfillHTLC this_ptr_conv;
8395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8396 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8397 LDKThirtyTwoBytes val_ref;
8398 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8399 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8400 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
8403 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) {
8404 LDKThirtyTwoBytes channel_id_arg_ref;
8405 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8406 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8407 LDKThirtyTwoBytes payment_preimage_arg_ref;
8408 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
8409 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
8410 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
8411 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8415 LDKUpdateFailHTLC this_ptr_conv;
8416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8417 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8418 UpdateFailHTLC_free(this_ptr_conv);
8421 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8422 LDKUpdateFailHTLC orig_conv;
8423 orig_conv.inner = (void*)(orig & (~1));
8424 orig_conv.is_owned = (orig & 1) || (orig == 0);
8425 LDKUpdateFailHTLC ret = UpdateFailHTLC_clone(&orig_conv);
8426 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8429 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8430 LDKUpdateFailHTLC this_ptr_conv;
8431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8432 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8433 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8434 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
8438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8439 LDKUpdateFailHTLC this_ptr_conv;
8440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8441 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8442 LDKThirtyTwoBytes val_ref;
8443 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8444 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8445 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
8448 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8449 LDKUpdateFailHTLC this_ptr_conv;
8450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8452 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
8456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8457 LDKUpdateFailHTLC this_ptr_conv;
8458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8459 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8460 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
8463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8464 LDKUpdateFailMalformedHTLC this_ptr_conv;
8465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8467 UpdateFailMalformedHTLC_free(this_ptr_conv);
8470 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8471 LDKUpdateFailMalformedHTLC orig_conv;
8472 orig_conv.inner = (void*)(orig & (~1));
8473 orig_conv.is_owned = (orig & 1) || (orig == 0);
8474 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_clone(&orig_conv);
8475 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8478 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8479 LDKUpdateFailMalformedHTLC this_ptr_conv;
8480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8481 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8482 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8483 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
8487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8488 LDKUpdateFailMalformedHTLC this_ptr_conv;
8489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8491 LDKThirtyTwoBytes val_ref;
8492 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8493 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8494 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
8497 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8498 LDKUpdateFailMalformedHTLC this_ptr_conv;
8499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8500 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8501 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
8505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8506 LDKUpdateFailMalformedHTLC this_ptr_conv;
8507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8508 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8509 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
8512 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
8513 LDKUpdateFailMalformedHTLC this_ptr_conv;
8514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8515 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8516 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
8520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8521 LDKUpdateFailMalformedHTLC this_ptr_conv;
8522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8523 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8524 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
8527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8528 LDKCommitmentSigned this_ptr_conv;
8529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8530 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8531 CommitmentSigned_free(this_ptr_conv);
8534 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8535 LDKCommitmentSigned orig_conv;
8536 orig_conv.inner = (void*)(orig & (~1));
8537 orig_conv.is_owned = (orig & 1) || (orig == 0);
8538 LDKCommitmentSigned ret = CommitmentSigned_clone(&orig_conv);
8539 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8542 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8543 LDKCommitmentSigned this_ptr_conv;
8544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8545 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8546 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8547 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
8551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8552 LDKCommitmentSigned this_ptr_conv;
8553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8554 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8555 LDKThirtyTwoBytes val_ref;
8556 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8557 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8558 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
8561 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8562 LDKCommitmentSigned this_ptr_conv;
8563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8564 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8565 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8566 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
8570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8571 LDKCommitmentSigned this_ptr_conv;
8572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8573 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8574 LDKSignature val_ref;
8575 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8576 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8577 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
8580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
8581 LDKCommitmentSigned this_ptr_conv;
8582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8583 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8584 LDKCVec_SignatureZ val_constr;
8585 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
8586 if (val_constr.datalen > 0)
8587 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8589 val_constr.data = NULL;
8590 for (size_t i = 0; i < val_constr.datalen; i++) {
8591 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
8592 LDKSignature arr_conv_8_ref;
8593 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
8594 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
8595 val_constr.data[i] = arr_conv_8_ref;
8597 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
8600 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) {
8601 LDKThirtyTwoBytes channel_id_arg_ref;
8602 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8603 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8604 LDKSignature signature_arg_ref;
8605 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8606 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8607 LDKCVec_SignatureZ htlc_signatures_arg_constr;
8608 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
8609 if (htlc_signatures_arg_constr.datalen > 0)
8610 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8612 htlc_signatures_arg_constr.data = NULL;
8613 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
8614 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
8615 LDKSignature arr_conv_8_ref;
8616 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
8617 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
8618 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
8620 LDKCommitmentSigned ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
8621 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8625 LDKRevokeAndACK this_ptr_conv;
8626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8627 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8628 RevokeAndACK_free(this_ptr_conv);
8631 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8632 LDKRevokeAndACK orig_conv;
8633 orig_conv.inner = (void*)(orig & (~1));
8634 orig_conv.is_owned = (orig & 1) || (orig == 0);
8635 LDKRevokeAndACK ret = RevokeAndACK_clone(&orig_conv);
8636 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8639 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8640 LDKRevokeAndACK this_ptr_conv;
8641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8642 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8643 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8644 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
8648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8649 LDKRevokeAndACK this_ptr_conv;
8650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8651 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8652 LDKThirtyTwoBytes val_ref;
8653 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8654 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8655 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
8658 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
8659 LDKRevokeAndACK this_ptr_conv;
8660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8661 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8662 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8663 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
8667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8668 LDKRevokeAndACK this_ptr_conv;
8669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8670 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8671 LDKThirtyTwoBytes val_ref;
8672 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8673 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8674 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
8677 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8678 LDKRevokeAndACK this_ptr_conv;
8679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8680 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8681 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8682 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8687 LDKRevokeAndACK this_ptr_conv;
8688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8690 LDKPublicKey val_ref;
8691 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8692 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8693 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8696 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) {
8697 LDKThirtyTwoBytes channel_id_arg_ref;
8698 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8699 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8700 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
8701 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
8702 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
8703 LDKPublicKey next_per_commitment_point_arg_ref;
8704 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8705 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8706 LDKRevokeAndACK ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
8707 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8711 LDKUpdateFee this_ptr_conv;
8712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8713 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8714 UpdateFee_free(this_ptr_conv);
8717 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8718 LDKUpdateFee orig_conv;
8719 orig_conv.inner = (void*)(orig & (~1));
8720 orig_conv.is_owned = (orig & 1) || (orig == 0);
8721 LDKUpdateFee ret = UpdateFee_clone(&orig_conv);
8722 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8725 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8726 LDKUpdateFee this_ptr_conv;
8727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8728 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8729 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8730 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
8734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8735 LDKUpdateFee this_ptr_conv;
8736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8738 LDKThirtyTwoBytes val_ref;
8739 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8740 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8741 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
8744 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
8745 LDKUpdateFee this_ptr_conv;
8746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8747 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8748 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
8752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8753 LDKUpdateFee this_ptr_conv;
8754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8755 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8756 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
8759 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
8760 LDKThirtyTwoBytes channel_id_arg_ref;
8761 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8762 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8763 LDKUpdateFee ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
8764 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8768 LDKDataLossProtect this_ptr_conv;
8769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8770 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8771 DataLossProtect_free(this_ptr_conv);
8774 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8775 LDKDataLossProtect orig_conv;
8776 orig_conv.inner = (void*)(orig & (~1));
8777 orig_conv.is_owned = (orig & 1) || (orig == 0);
8778 LDKDataLossProtect ret = DataLossProtect_clone(&orig_conv);
8779 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8782 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
8783 LDKDataLossProtect this_ptr_conv;
8784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8785 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8786 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8787 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
8791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8792 LDKDataLossProtect this_ptr_conv;
8793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8794 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8795 LDKThirtyTwoBytes val_ref;
8796 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8797 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8798 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
8801 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8802 LDKDataLossProtect this_ptr_conv;
8803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8804 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8805 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8806 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
8810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8811 LDKDataLossProtect this_ptr_conv;
8812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8813 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8814 LDKPublicKey val_ref;
8815 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8816 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8817 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
8820 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) {
8821 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
8822 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
8823 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
8824 LDKPublicKey my_current_per_commitment_point_arg_ref;
8825 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
8826 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
8827 LDKDataLossProtect ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
8828 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8832 LDKChannelReestablish this_ptr_conv;
8833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8834 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8835 ChannelReestablish_free(this_ptr_conv);
8838 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8839 LDKChannelReestablish orig_conv;
8840 orig_conv.inner = (void*)(orig & (~1));
8841 orig_conv.is_owned = (orig & 1) || (orig == 0);
8842 LDKChannelReestablish ret = ChannelReestablish_clone(&orig_conv);
8843 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8846 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8847 LDKChannelReestablish this_ptr_conv;
8848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8849 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8850 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8851 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
8855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8856 LDKChannelReestablish this_ptr_conv;
8857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8858 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8859 LDKThirtyTwoBytes val_ref;
8860 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8861 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8862 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
8865 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8866 LDKChannelReestablish this_ptr_conv;
8867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8868 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8869 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
8873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8874 LDKChannelReestablish this_ptr_conv;
8875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8876 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8877 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
8880 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8881 LDKChannelReestablish this_ptr_conv;
8882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8883 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8884 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
8888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8889 LDKChannelReestablish this_ptr_conv;
8890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8891 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8892 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
8895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8896 LDKAnnouncementSignatures this_ptr_conv;
8897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8898 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8899 AnnouncementSignatures_free(this_ptr_conv);
8902 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8903 LDKAnnouncementSignatures orig_conv;
8904 orig_conv.inner = (void*)(orig & (~1));
8905 orig_conv.is_owned = (orig & 1) || (orig == 0);
8906 LDKAnnouncementSignatures ret = AnnouncementSignatures_clone(&orig_conv);
8907 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8910 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8911 LDKAnnouncementSignatures this_ptr_conv;
8912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8913 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8914 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8915 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
8919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8920 LDKAnnouncementSignatures this_ptr_conv;
8921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8922 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8923 LDKThirtyTwoBytes val_ref;
8924 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8925 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8926 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
8929 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8930 LDKAnnouncementSignatures this_ptr_conv;
8931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8932 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8933 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
8937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8938 LDKAnnouncementSignatures this_ptr_conv;
8939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8940 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8941 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
8944 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8945 LDKAnnouncementSignatures this_ptr_conv;
8946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8947 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8948 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8949 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
8953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8954 LDKAnnouncementSignatures this_ptr_conv;
8955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8956 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8957 LDKSignature val_ref;
8958 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8959 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8960 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
8963 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8964 LDKAnnouncementSignatures this_ptr_conv;
8965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8966 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8967 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8968 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
8972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8973 LDKAnnouncementSignatures this_ptr_conv;
8974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8975 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8976 LDKSignature val_ref;
8977 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8978 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8979 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
8982 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) {
8983 LDKThirtyTwoBytes channel_id_arg_ref;
8984 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8985 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8986 LDKSignature node_signature_arg_ref;
8987 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
8988 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
8989 LDKSignature bitcoin_signature_arg_ref;
8990 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
8991 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
8992 LDKAnnouncementSignatures ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
8993 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8997 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
8998 FREE((void*)this_ptr);
8999 NetAddress_free(this_ptr_conv);
9002 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9003 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
9004 LDKNetAddress* ret = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9005 *ret = NetAddress_clone(orig_conv);
9009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9010 LDKUnsignedNodeAnnouncement this_ptr_conv;
9011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9012 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9013 UnsignedNodeAnnouncement_free(this_ptr_conv);
9016 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9017 LDKUnsignedNodeAnnouncement orig_conv;
9018 orig_conv.inner = (void*)(orig & (~1));
9019 orig_conv.is_owned = (orig & 1) || (orig == 0);
9020 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_clone(&orig_conv);
9021 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9024 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9025 LDKUnsignedNodeAnnouncement this_ptr_conv;
9026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9027 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9028 LDKNodeFeatures ret = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9029 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9033 LDKUnsignedNodeAnnouncement this_ptr_conv;
9034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9035 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9036 LDKNodeFeatures val_conv;
9037 val_conv.inner = (void*)(val & (~1));
9038 val_conv.is_owned = (val & 1) || (val == 0);
9039 // Warning: we may need a move here but can't clone!
9040 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9043 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9044 LDKUnsignedNodeAnnouncement this_ptr_conv;
9045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9046 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9047 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9052 LDKUnsignedNodeAnnouncement this_ptr_conv;
9053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9054 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9055 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9058 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9059 LDKUnsignedNodeAnnouncement this_ptr_conv;
9060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9061 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9062 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9063 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
9067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9068 LDKUnsignedNodeAnnouncement this_ptr_conv;
9069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9070 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9071 LDKPublicKey val_ref;
9072 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9073 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9074 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
9077 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
9078 LDKUnsignedNodeAnnouncement this_ptr_conv;
9079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9080 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9081 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
9082 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
9086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9087 LDKUnsignedNodeAnnouncement this_ptr_conv;
9088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9089 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9090 LDKThreeBytes val_ref;
9091 CHECK((*_env)->GetArrayLength (_env, val) == 3);
9092 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
9093 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
9096 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
9097 LDKUnsignedNodeAnnouncement this_ptr_conv;
9098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9099 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9100 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9101 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
9105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9106 LDKUnsignedNodeAnnouncement this_ptr_conv;
9107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9109 LDKThirtyTwoBytes val_ref;
9110 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9111 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9112 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
9115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9116 LDKUnsignedNodeAnnouncement this_ptr_conv;
9117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9118 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9119 LDKCVec_NetAddressZ val_constr;
9120 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9121 if (val_constr.datalen > 0)
9122 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9124 val_constr.data = NULL;
9125 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9126 for (size_t m = 0; m < val_constr.datalen; m++) {
9127 long arr_conv_12 = val_vals[m];
9128 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9129 FREE((void*)arr_conv_12);
9130 val_constr.data[m] = arr_conv_12_conv;
9132 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9133 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
9136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9137 LDKNodeAnnouncement this_ptr_conv;
9138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9139 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9140 NodeAnnouncement_free(this_ptr_conv);
9143 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9144 LDKNodeAnnouncement orig_conv;
9145 orig_conv.inner = (void*)(orig & (~1));
9146 orig_conv.is_owned = (orig & 1) || (orig == 0);
9147 LDKNodeAnnouncement ret = NodeAnnouncement_clone(&orig_conv);
9148 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9151 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9152 LDKNodeAnnouncement this_ptr_conv;
9153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9154 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9155 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9156 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
9160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9161 LDKNodeAnnouncement this_ptr_conv;
9162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9163 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9164 LDKSignature val_ref;
9165 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9166 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9167 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
9170 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9171 LDKNodeAnnouncement this_ptr_conv;
9172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9173 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9174 LDKUnsignedNodeAnnouncement ret = NodeAnnouncement_get_contents(&this_ptr_conv);
9175 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9179 LDKNodeAnnouncement this_ptr_conv;
9180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9181 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9182 LDKUnsignedNodeAnnouncement val_conv;
9183 val_conv.inner = (void*)(val & (~1));
9184 val_conv.is_owned = (val & 1) || (val == 0);
9185 if (val_conv.inner != NULL)
9186 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
9187 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
9190 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9191 LDKSignature signature_arg_ref;
9192 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9193 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9194 LDKUnsignedNodeAnnouncement contents_arg_conv;
9195 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9196 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9197 if (contents_arg_conv.inner != NULL)
9198 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
9199 LDKNodeAnnouncement ret = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
9200 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9204 LDKUnsignedChannelAnnouncement this_ptr_conv;
9205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9206 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9207 UnsignedChannelAnnouncement_free(this_ptr_conv);
9210 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9211 LDKUnsignedChannelAnnouncement orig_conv;
9212 orig_conv.inner = (void*)(orig & (~1));
9213 orig_conv.is_owned = (orig & 1) || (orig == 0);
9214 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_clone(&orig_conv);
9215 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9218 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9219 LDKUnsignedChannelAnnouncement this_ptr_conv;
9220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9221 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9222 LDKChannelFeatures ret = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
9223 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9227 LDKUnsignedChannelAnnouncement this_ptr_conv;
9228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9229 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9230 LDKChannelFeatures val_conv;
9231 val_conv.inner = (void*)(val & (~1));
9232 val_conv.is_owned = (val & 1) || (val == 0);
9233 // Warning: we may need a move here but can't clone!
9234 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
9237 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9238 LDKUnsignedChannelAnnouncement this_ptr_conv;
9239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9240 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9241 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9242 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
9246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9247 LDKUnsignedChannelAnnouncement this_ptr_conv;
9248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9249 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9250 LDKThirtyTwoBytes val_ref;
9251 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9252 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9253 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
9256 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9257 LDKUnsignedChannelAnnouncement this_ptr_conv;
9258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9259 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9260 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
9264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9265 LDKUnsignedChannelAnnouncement this_ptr_conv;
9266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9268 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
9271 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9272 LDKUnsignedChannelAnnouncement this_ptr_conv;
9273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9274 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9275 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9276 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
9280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9281 LDKUnsignedChannelAnnouncement this_ptr_conv;
9282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9283 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9284 LDKPublicKey val_ref;
9285 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9286 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9287 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
9290 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9291 LDKUnsignedChannelAnnouncement this_ptr_conv;
9292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9293 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9294 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9295 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
9299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9300 LDKUnsignedChannelAnnouncement this_ptr_conv;
9301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9302 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9303 LDKPublicKey val_ref;
9304 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9305 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9306 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
9309 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9310 LDKUnsignedChannelAnnouncement this_ptr_conv;
9311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9312 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9313 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9314 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
9318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9319 LDKUnsignedChannelAnnouncement this_ptr_conv;
9320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9321 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9322 LDKPublicKey val_ref;
9323 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9324 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9325 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
9328 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9329 LDKUnsignedChannelAnnouncement this_ptr_conv;
9330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9331 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9332 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9333 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
9337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9338 LDKUnsignedChannelAnnouncement this_ptr_conv;
9339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9340 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9341 LDKPublicKey val_ref;
9342 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9343 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9344 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
9347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9348 LDKChannelAnnouncement this_ptr_conv;
9349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9351 ChannelAnnouncement_free(this_ptr_conv);
9354 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9355 LDKChannelAnnouncement orig_conv;
9356 orig_conv.inner = (void*)(orig & (~1));
9357 orig_conv.is_owned = (orig & 1) || (orig == 0);
9358 LDKChannelAnnouncement ret = ChannelAnnouncement_clone(&orig_conv);
9359 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9362 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9363 LDKChannelAnnouncement this_ptr_conv;
9364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9365 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9366 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9367 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
9371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9372 LDKChannelAnnouncement this_ptr_conv;
9373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9374 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9375 LDKSignature val_ref;
9376 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9377 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9378 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
9381 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9382 LDKChannelAnnouncement this_ptr_conv;
9383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9384 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9385 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9386 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
9390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9391 LDKChannelAnnouncement this_ptr_conv;
9392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9393 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9394 LDKSignature val_ref;
9395 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9396 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9397 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
9400 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9401 LDKChannelAnnouncement this_ptr_conv;
9402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9404 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9405 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
9409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9410 LDKChannelAnnouncement this_ptr_conv;
9411 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9412 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9413 LDKSignature val_ref;
9414 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9415 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9416 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
9419 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9420 LDKChannelAnnouncement this_ptr_conv;
9421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9422 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9423 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9424 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
9428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9429 LDKChannelAnnouncement this_ptr_conv;
9430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9431 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9432 LDKSignature val_ref;
9433 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9434 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9435 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
9438 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9439 LDKChannelAnnouncement this_ptr_conv;
9440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9441 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9442 LDKUnsignedChannelAnnouncement ret = ChannelAnnouncement_get_contents(&this_ptr_conv);
9443 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9447 LDKChannelAnnouncement this_ptr_conv;
9448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9449 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9450 LDKUnsignedChannelAnnouncement val_conv;
9451 val_conv.inner = (void*)(val & (~1));
9452 val_conv.is_owned = (val & 1) || (val == 0);
9453 if (val_conv.inner != NULL)
9454 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
9455 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
9458 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) {
9459 LDKSignature node_signature_1_arg_ref;
9460 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
9461 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
9462 LDKSignature node_signature_2_arg_ref;
9463 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
9464 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
9465 LDKSignature bitcoin_signature_1_arg_ref;
9466 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
9467 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
9468 LDKSignature bitcoin_signature_2_arg_ref;
9469 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
9470 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
9471 LDKUnsignedChannelAnnouncement contents_arg_conv;
9472 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9473 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9474 if (contents_arg_conv.inner != NULL)
9475 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
9476 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);
9477 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9481 LDKUnsignedChannelUpdate this_ptr_conv;
9482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9483 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9484 UnsignedChannelUpdate_free(this_ptr_conv);
9487 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9488 LDKUnsignedChannelUpdate orig_conv;
9489 orig_conv.inner = (void*)(orig & (~1));
9490 orig_conv.is_owned = (orig & 1) || (orig == 0);
9491 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_clone(&orig_conv);
9492 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9495 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9496 LDKUnsignedChannelUpdate this_ptr_conv;
9497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9498 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9499 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9500 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
9504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9505 LDKUnsignedChannelUpdate this_ptr_conv;
9506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9507 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9508 LDKThirtyTwoBytes val_ref;
9509 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9510 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9511 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
9514 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9515 LDKUnsignedChannelUpdate this_ptr_conv;
9516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9517 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9518 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
9522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9523 LDKUnsignedChannelUpdate this_ptr_conv;
9524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9525 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9526 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
9529 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9530 LDKUnsignedChannelUpdate this_ptr_conv;
9531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9532 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9533 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
9537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9538 LDKUnsignedChannelUpdate this_ptr_conv;
9539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9541 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
9544 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
9545 LDKUnsignedChannelUpdate this_ptr_conv;
9546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9547 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9548 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
9552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
9553 LDKUnsignedChannelUpdate this_ptr_conv;
9554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9555 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9556 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
9559 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
9560 LDKUnsignedChannelUpdate this_ptr_conv;
9561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9562 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9563 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
9567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9568 LDKUnsignedChannelUpdate this_ptr_conv;
9569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9570 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9571 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
9574 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9575 LDKUnsignedChannelUpdate this_ptr_conv;
9576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9577 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9578 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
9582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9583 LDKUnsignedChannelUpdate this_ptr_conv;
9584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9585 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9586 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
9589 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9590 LDKUnsignedChannelUpdate this_ptr_conv;
9591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9592 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9593 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
9597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9598 LDKUnsignedChannelUpdate this_ptr_conv;
9599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9600 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9601 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
9604 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
9605 LDKUnsignedChannelUpdate this_ptr_conv;
9606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9607 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9608 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
9612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9613 LDKUnsignedChannelUpdate this_ptr_conv;
9614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9615 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9616 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
9619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9620 LDKChannelUpdate this_ptr_conv;
9621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9623 ChannelUpdate_free(this_ptr_conv);
9626 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9627 LDKChannelUpdate orig_conv;
9628 orig_conv.inner = (void*)(orig & (~1));
9629 orig_conv.is_owned = (orig & 1) || (orig == 0);
9630 LDKChannelUpdate ret = ChannelUpdate_clone(&orig_conv);
9631 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9634 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9635 LDKChannelUpdate this_ptr_conv;
9636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9637 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9638 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9639 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
9643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9644 LDKChannelUpdate this_ptr_conv;
9645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9646 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9647 LDKSignature val_ref;
9648 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9649 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9650 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
9653 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9654 LDKChannelUpdate this_ptr_conv;
9655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9656 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9657 LDKUnsignedChannelUpdate ret = ChannelUpdate_get_contents(&this_ptr_conv);
9658 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9662 LDKChannelUpdate this_ptr_conv;
9663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9664 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9665 LDKUnsignedChannelUpdate val_conv;
9666 val_conv.inner = (void*)(val & (~1));
9667 val_conv.is_owned = (val & 1) || (val == 0);
9668 if (val_conv.inner != NULL)
9669 val_conv = UnsignedChannelUpdate_clone(&val_conv);
9670 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
9673 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9674 LDKSignature signature_arg_ref;
9675 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9676 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9677 LDKUnsignedChannelUpdate contents_arg_conv;
9678 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9679 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9680 if (contents_arg_conv.inner != NULL)
9681 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
9682 LDKChannelUpdate ret = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
9683 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9687 LDKQueryChannelRange this_ptr_conv;
9688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9690 QueryChannelRange_free(this_ptr_conv);
9693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9694 LDKQueryChannelRange orig_conv;
9695 orig_conv.inner = (void*)(orig & (~1));
9696 orig_conv.is_owned = (orig & 1) || (orig == 0);
9697 LDKQueryChannelRange ret = QueryChannelRange_clone(&orig_conv);
9698 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9701 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9702 LDKQueryChannelRange this_ptr_conv;
9703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9704 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9705 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9706 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
9710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9711 LDKQueryChannelRange this_ptr_conv;
9712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9713 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9714 LDKThirtyTwoBytes val_ref;
9715 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9716 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9717 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9720 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9721 LDKQueryChannelRange this_ptr_conv;
9722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9724 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
9728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9729 LDKQueryChannelRange this_ptr_conv;
9730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9731 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9732 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
9735 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9736 LDKQueryChannelRange this_ptr_conv;
9737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9739 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
9743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9744 LDKQueryChannelRange this_ptr_conv;
9745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9746 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9747 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9750 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) {
9751 LDKThirtyTwoBytes chain_hash_arg_ref;
9752 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9753 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9754 LDKQueryChannelRange ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
9755 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9759 LDKReplyChannelRange this_ptr_conv;
9760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9761 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9762 ReplyChannelRange_free(this_ptr_conv);
9765 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9766 LDKReplyChannelRange orig_conv;
9767 orig_conv.inner = (void*)(orig & (~1));
9768 orig_conv.is_owned = (orig & 1) || (orig == 0);
9769 LDKReplyChannelRange ret = ReplyChannelRange_clone(&orig_conv);
9770 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9773 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9774 LDKReplyChannelRange this_ptr_conv;
9775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9776 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9777 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9778 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
9782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9783 LDKReplyChannelRange this_ptr_conv;
9784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9785 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9786 LDKThirtyTwoBytes val_ref;
9787 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9788 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9789 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9792 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9793 LDKReplyChannelRange this_ptr_conv;
9794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9795 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9796 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
9800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9801 LDKReplyChannelRange this_ptr_conv;
9802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9803 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9804 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
9807 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9808 LDKReplyChannelRange this_ptr_conv;
9809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9810 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9811 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
9815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9816 LDKReplyChannelRange this_ptr_conv;
9817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9818 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9819 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9822 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9823 LDKReplyChannelRange this_ptr_conv;
9824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9825 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9826 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
9830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9831 LDKReplyChannelRange this_ptr_conv;
9832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9834 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
9837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9838 LDKReplyChannelRange this_ptr_conv;
9839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9840 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9841 LDKCVec_u64Z val_constr;
9842 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9843 if (val_constr.datalen > 0)
9844 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9846 val_constr.data = NULL;
9847 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9848 for (size_t g = 0; g < val_constr.datalen; g++) {
9849 long arr_conv_6 = val_vals[g];
9850 val_constr.data[g] = arr_conv_6;
9852 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9853 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
9856 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) {
9857 LDKThirtyTwoBytes chain_hash_arg_ref;
9858 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9859 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9860 LDKCVec_u64Z short_channel_ids_arg_constr;
9861 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
9862 if (short_channel_ids_arg_constr.datalen > 0)
9863 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9865 short_channel_ids_arg_constr.data = NULL;
9866 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
9867 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
9868 long arr_conv_6 = short_channel_ids_arg_vals[g];
9869 short_channel_ids_arg_constr.data[g] = arr_conv_6;
9871 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
9872 LDKReplyChannelRange ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
9873 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9877 LDKQueryShortChannelIds this_ptr_conv;
9878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9879 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9880 QueryShortChannelIds_free(this_ptr_conv);
9883 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9884 LDKQueryShortChannelIds orig_conv;
9885 orig_conv.inner = (void*)(orig & (~1));
9886 orig_conv.is_owned = (orig & 1) || (orig == 0);
9887 LDKQueryShortChannelIds ret = QueryShortChannelIds_clone(&orig_conv);
9888 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9891 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9892 LDKQueryShortChannelIds this_ptr_conv;
9893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9894 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9895 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9896 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
9900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9901 LDKQueryShortChannelIds this_ptr_conv;
9902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9903 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9904 LDKThirtyTwoBytes val_ref;
9905 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9906 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9907 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
9910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9911 LDKQueryShortChannelIds this_ptr_conv;
9912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9913 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9914 LDKCVec_u64Z val_constr;
9915 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9916 if (val_constr.datalen > 0)
9917 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9919 val_constr.data = NULL;
9920 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9921 for (size_t g = 0; g < val_constr.datalen; g++) {
9922 long arr_conv_6 = val_vals[g];
9923 val_constr.data[g] = arr_conv_6;
9925 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9926 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
9929 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
9930 LDKThirtyTwoBytes chain_hash_arg_ref;
9931 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9932 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9933 LDKCVec_u64Z short_channel_ids_arg_constr;
9934 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
9935 if (short_channel_ids_arg_constr.datalen > 0)
9936 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9938 short_channel_ids_arg_constr.data = NULL;
9939 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
9940 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
9941 long arr_conv_6 = short_channel_ids_arg_vals[g];
9942 short_channel_ids_arg_constr.data[g] = arr_conv_6;
9944 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
9945 LDKQueryShortChannelIds ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
9946 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9950 LDKReplyShortChannelIdsEnd this_ptr_conv;
9951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9952 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9953 ReplyShortChannelIdsEnd_free(this_ptr_conv);
9956 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9957 LDKReplyShortChannelIdsEnd orig_conv;
9958 orig_conv.inner = (void*)(orig & (~1));
9959 orig_conv.is_owned = (orig & 1) || (orig == 0);
9960 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_clone(&orig_conv);
9961 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9964 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9965 LDKReplyShortChannelIdsEnd this_ptr_conv;
9966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9967 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9968 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9969 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
9973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9974 LDKReplyShortChannelIdsEnd this_ptr_conv;
9975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9976 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9977 LDKThirtyTwoBytes val_ref;
9978 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9979 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9980 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
9983 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9984 LDKReplyShortChannelIdsEnd this_ptr_conv;
9985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9986 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9987 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
9991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9992 LDKReplyShortChannelIdsEnd this_ptr_conv;
9993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9994 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9995 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
9998 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
9999 LDKThirtyTwoBytes chain_hash_arg_ref;
10000 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10001 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10002 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
10003 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10007 LDKGossipTimestampFilter this_ptr_conv;
10008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10009 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10010 GossipTimestampFilter_free(this_ptr_conv);
10013 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10014 LDKGossipTimestampFilter orig_conv;
10015 orig_conv.inner = (void*)(orig & (~1));
10016 orig_conv.is_owned = (orig & 1) || (orig == 0);
10017 LDKGossipTimestampFilter ret = GossipTimestampFilter_clone(&orig_conv);
10018 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10021 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10022 LDKGossipTimestampFilter this_ptr_conv;
10023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10024 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10025 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10026 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
10030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10031 LDKGossipTimestampFilter this_ptr_conv;
10032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10034 LDKThirtyTwoBytes val_ref;
10035 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10036 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10037 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
10040 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10041 LDKGossipTimestampFilter this_ptr_conv;
10042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10043 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10044 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
10048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10049 LDKGossipTimestampFilter this_ptr_conv;
10050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10051 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10052 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
10055 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
10056 LDKGossipTimestampFilter this_ptr_conv;
10057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10058 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10059 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
10063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10064 LDKGossipTimestampFilter this_ptr_conv;
10065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10066 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10067 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
10070 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) {
10071 LDKThirtyTwoBytes chain_hash_arg_ref;
10072 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10073 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10074 LDKGossipTimestampFilter ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
10075 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10079 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
10080 FREE((void*)this_ptr);
10081 ErrorAction_free(this_ptr_conv);
10084 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10085 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
10086 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10087 *ret = ErrorAction_clone(orig_conv);
10091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10092 LDKLightningError this_ptr_conv;
10093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10094 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10095 LightningError_free(this_ptr_conv);
10098 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
10099 LDKLightningError this_ptr_conv;
10100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10101 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10102 LDKStr _str = LightningError_get_err(&this_ptr_conv);
10103 char* _buf = MALLOC(_str.len + 1, "str conv buf");
10104 memcpy(_buf, _str.chars, _str.len);
10105 _buf[_str.len] = 0;
10106 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
10111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10112 LDKLightningError this_ptr_conv;
10113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10114 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10115 LDKCVec_u8Z val_ref;
10116 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
10117 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
10118 LightningError_set_err(&this_ptr_conv, val_ref);
10119 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
10122 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
10123 LDKLightningError this_ptr_conv;
10124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10125 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10126 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10127 *ret = LightningError_get_action(&this_ptr_conv);
10131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10132 LDKLightningError this_ptr_conv;
10133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10134 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10135 LDKErrorAction val_conv = *(LDKErrorAction*)val;
10137 LightningError_set_action(&this_ptr_conv, val_conv);
10140 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
10141 LDKCVec_u8Z err_arg_ref;
10142 err_arg_ref.data = (*_env)->GetByteArrayElements (_env, err_arg, NULL);
10143 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
10144 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
10145 FREE((void*)action_arg);
10146 LDKLightningError ret = LightningError_new(err_arg_ref, action_arg_conv);
10147 (*_env)->ReleaseByteArrayElements(_env, err_arg, (int8_t*)err_arg_ref.data, 0);
10148 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10152 LDKCommitmentUpdate this_ptr_conv;
10153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10154 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10155 CommitmentUpdate_free(this_ptr_conv);
10158 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10159 LDKCommitmentUpdate orig_conv;
10160 orig_conv.inner = (void*)(orig & (~1));
10161 orig_conv.is_owned = (orig & 1) || (orig == 0);
10162 LDKCommitmentUpdate ret = CommitmentUpdate_clone(&orig_conv);
10163 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10167 LDKCommitmentUpdate this_ptr_conv;
10168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10169 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10170 LDKCVec_UpdateAddHTLCZ val_constr;
10171 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10172 if (val_constr.datalen > 0)
10173 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10175 val_constr.data = NULL;
10176 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10177 for (size_t p = 0; p < val_constr.datalen; p++) {
10178 long arr_conv_15 = val_vals[p];
10179 LDKUpdateAddHTLC arr_conv_15_conv;
10180 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10181 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10182 if (arr_conv_15_conv.inner != NULL)
10183 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10184 val_constr.data[p] = arr_conv_15_conv;
10186 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10187 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
10190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10191 LDKCommitmentUpdate this_ptr_conv;
10192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10193 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10194 LDKCVec_UpdateFulfillHTLCZ val_constr;
10195 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10196 if (val_constr.datalen > 0)
10197 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10199 val_constr.data = NULL;
10200 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10201 for (size_t t = 0; t < val_constr.datalen; t++) {
10202 long arr_conv_19 = val_vals[t];
10203 LDKUpdateFulfillHTLC arr_conv_19_conv;
10204 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10205 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10206 if (arr_conv_19_conv.inner != NULL)
10207 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10208 val_constr.data[t] = arr_conv_19_conv;
10210 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10211 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
10214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10215 LDKCommitmentUpdate this_ptr_conv;
10216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10217 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10218 LDKCVec_UpdateFailHTLCZ val_constr;
10219 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10220 if (val_constr.datalen > 0)
10221 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10223 val_constr.data = NULL;
10224 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10225 for (size_t q = 0; q < val_constr.datalen; q++) {
10226 long arr_conv_16 = val_vals[q];
10227 LDKUpdateFailHTLC arr_conv_16_conv;
10228 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10229 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10230 if (arr_conv_16_conv.inner != NULL)
10231 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
10232 val_constr.data[q] = arr_conv_16_conv;
10234 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10235 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
10238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10239 LDKCommitmentUpdate this_ptr_conv;
10240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10241 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10242 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
10243 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10244 if (val_constr.datalen > 0)
10245 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10247 val_constr.data = NULL;
10248 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10249 for (size_t z = 0; z < val_constr.datalen; z++) {
10250 long arr_conv_25 = val_vals[z];
10251 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
10252 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
10253 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
10254 if (arr_conv_25_conv.inner != NULL)
10255 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
10256 val_constr.data[z] = arr_conv_25_conv;
10258 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10259 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
10262 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
10263 LDKCommitmentUpdate this_ptr_conv;
10264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10265 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10266 LDKUpdateFee ret = CommitmentUpdate_get_update_fee(&this_ptr_conv);
10267 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10271 LDKCommitmentUpdate this_ptr_conv;
10272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10273 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10274 LDKUpdateFee val_conv;
10275 val_conv.inner = (void*)(val & (~1));
10276 val_conv.is_owned = (val & 1) || (val == 0);
10277 if (val_conv.inner != NULL)
10278 val_conv = UpdateFee_clone(&val_conv);
10279 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
10282 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
10283 LDKCommitmentUpdate this_ptr_conv;
10284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10285 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10286 LDKCommitmentSigned ret = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
10287 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10291 LDKCommitmentUpdate this_ptr_conv;
10292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10293 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10294 LDKCommitmentSigned val_conv;
10295 val_conv.inner = (void*)(val & (~1));
10296 val_conv.is_owned = (val & 1) || (val == 0);
10297 if (val_conv.inner != NULL)
10298 val_conv = CommitmentSigned_clone(&val_conv);
10299 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
10302 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) {
10303 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
10304 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
10305 if (update_add_htlcs_arg_constr.datalen > 0)
10306 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10308 update_add_htlcs_arg_constr.data = NULL;
10309 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
10310 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
10311 long arr_conv_15 = update_add_htlcs_arg_vals[p];
10312 LDKUpdateAddHTLC arr_conv_15_conv;
10313 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10314 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10315 if (arr_conv_15_conv.inner != NULL)
10316 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10317 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
10319 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
10320 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
10321 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
10322 if (update_fulfill_htlcs_arg_constr.datalen > 0)
10323 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10325 update_fulfill_htlcs_arg_constr.data = NULL;
10326 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
10327 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
10328 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
10329 LDKUpdateFulfillHTLC arr_conv_19_conv;
10330 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10331 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10332 if (arr_conv_19_conv.inner != NULL)
10333 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10334 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
10336 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
10337 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
10338 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
10339 if (update_fail_htlcs_arg_constr.datalen > 0)
10340 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10342 update_fail_htlcs_arg_constr.data = NULL;
10343 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
10344 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
10345 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
10346 LDKUpdateFailHTLC arr_conv_16_conv;
10347 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10348 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10349 if (arr_conv_16_conv.inner != NULL)
10350 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
10351 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
10353 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
10354 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
10355 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
10356 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
10357 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10359 update_fail_malformed_htlcs_arg_constr.data = NULL;
10360 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
10361 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
10362 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
10363 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
10364 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
10365 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
10366 if (arr_conv_25_conv.inner != NULL)
10367 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
10368 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
10370 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
10371 LDKUpdateFee update_fee_arg_conv;
10372 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
10373 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
10374 if (update_fee_arg_conv.inner != NULL)
10375 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
10376 LDKCommitmentSigned commitment_signed_arg_conv;
10377 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
10378 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
10379 if (commitment_signed_arg_conv.inner != NULL)
10380 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
10381 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);
10382 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10386 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
10387 FREE((void*)this_ptr);
10388 HTLCFailChannelUpdate_free(this_ptr_conv);
10391 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10392 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
10393 LDKHTLCFailChannelUpdate* ret = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
10394 *ret = HTLCFailChannelUpdate_clone(orig_conv);
10398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10399 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
10400 FREE((void*)this_ptr);
10401 ChannelMessageHandler_free(this_ptr_conv);
10404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10405 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
10406 FREE((void*)this_ptr);
10407 RoutingMessageHandler_free(this_ptr_conv);
10410 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
10411 LDKAcceptChannel obj_conv;
10412 obj_conv.inner = (void*)(obj & (~1));
10413 obj_conv.is_owned = (obj & 1) || (obj == 0);
10414 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
10415 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10416 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10417 CVec_u8Z_free(arg_var);
10421 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10422 LDKu8slice ser_ref;
10423 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10424 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10425 LDKAcceptChannel ret = AcceptChannel_read(ser_ref);
10426 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10427 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10430 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
10431 LDKAnnouncementSignatures obj_conv;
10432 obj_conv.inner = (void*)(obj & (~1));
10433 obj_conv.is_owned = (obj & 1) || (obj == 0);
10434 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
10435 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10436 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10437 CVec_u8Z_free(arg_var);
10441 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10442 LDKu8slice ser_ref;
10443 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10444 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10445 LDKAnnouncementSignatures ret = AnnouncementSignatures_read(ser_ref);
10446 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10447 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10450 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
10451 LDKChannelReestablish obj_conv;
10452 obj_conv.inner = (void*)(obj & (~1));
10453 obj_conv.is_owned = (obj & 1) || (obj == 0);
10454 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
10455 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10456 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10457 CVec_u8Z_free(arg_var);
10461 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10462 LDKu8slice ser_ref;
10463 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10464 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10465 LDKChannelReestablish ret = ChannelReestablish_read(ser_ref);
10466 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10467 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10470 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10471 LDKClosingSigned obj_conv;
10472 obj_conv.inner = (void*)(obj & (~1));
10473 obj_conv.is_owned = (obj & 1) || (obj == 0);
10474 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
10475 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10476 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10477 CVec_u8Z_free(arg_var);
10481 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10482 LDKu8slice ser_ref;
10483 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10484 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10485 LDKClosingSigned ret = ClosingSigned_read(ser_ref);
10486 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10487 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10490 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10491 LDKCommitmentSigned obj_conv;
10492 obj_conv.inner = (void*)(obj & (~1));
10493 obj_conv.is_owned = (obj & 1) || (obj == 0);
10494 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
10495 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10496 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10497 CVec_u8Z_free(arg_var);
10501 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10502 LDKu8slice ser_ref;
10503 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10504 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10505 LDKCommitmentSigned ret = CommitmentSigned_read(ser_ref);
10506 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10507 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10510 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
10511 LDKFundingCreated obj_conv;
10512 obj_conv.inner = (void*)(obj & (~1));
10513 obj_conv.is_owned = (obj & 1) || (obj == 0);
10514 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
10515 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10516 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10517 CVec_u8Z_free(arg_var);
10521 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10522 LDKu8slice ser_ref;
10523 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10524 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10525 LDKFundingCreated ret = FundingCreated_read(ser_ref);
10526 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10527 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10530 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10531 LDKFundingSigned obj_conv;
10532 obj_conv.inner = (void*)(obj & (~1));
10533 obj_conv.is_owned = (obj & 1) || (obj == 0);
10534 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
10535 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10536 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10537 CVec_u8Z_free(arg_var);
10541 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10542 LDKu8slice ser_ref;
10543 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10544 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10545 LDKFundingSigned ret = FundingSigned_read(ser_ref);
10546 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10547 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10550 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
10551 LDKFundingLocked obj_conv;
10552 obj_conv.inner = (void*)(obj & (~1));
10553 obj_conv.is_owned = (obj & 1) || (obj == 0);
10554 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
10555 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10556 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10557 CVec_u8Z_free(arg_var);
10561 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10562 LDKu8slice ser_ref;
10563 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10564 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10565 LDKFundingLocked ret = FundingLocked_read(ser_ref);
10566 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10567 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10570 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
10572 obj_conv.inner = (void*)(obj & (~1));
10573 obj_conv.is_owned = (obj & 1) || (obj == 0);
10574 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
10575 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10576 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10577 CVec_u8Z_free(arg_var);
10581 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10582 LDKu8slice ser_ref;
10583 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10584 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10585 LDKInit ret = Init_read(ser_ref);
10586 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10587 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10590 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
10591 LDKOpenChannel obj_conv;
10592 obj_conv.inner = (void*)(obj & (~1));
10593 obj_conv.is_owned = (obj & 1) || (obj == 0);
10594 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
10595 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10596 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10597 CVec_u8Z_free(arg_var);
10601 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10602 LDKu8slice ser_ref;
10603 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10604 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10605 LDKOpenChannel ret = OpenChannel_read(ser_ref);
10606 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10607 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10610 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
10611 LDKRevokeAndACK obj_conv;
10612 obj_conv.inner = (void*)(obj & (~1));
10613 obj_conv.is_owned = (obj & 1) || (obj == 0);
10614 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
10615 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10616 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10617 CVec_u8Z_free(arg_var);
10621 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10622 LDKu8slice ser_ref;
10623 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10624 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10625 LDKRevokeAndACK ret = RevokeAndACK_read(ser_ref);
10626 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10627 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10630 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
10631 LDKShutdown obj_conv;
10632 obj_conv.inner = (void*)(obj & (~1));
10633 obj_conv.is_owned = (obj & 1) || (obj == 0);
10634 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
10635 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10636 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10637 CVec_u8Z_free(arg_var);
10641 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10642 LDKu8slice ser_ref;
10643 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10644 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10645 LDKShutdown ret = Shutdown_read(ser_ref);
10646 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10647 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10650 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10651 LDKUpdateFailHTLC obj_conv;
10652 obj_conv.inner = (void*)(obj & (~1));
10653 obj_conv.is_owned = (obj & 1) || (obj == 0);
10654 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
10655 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10656 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10657 CVec_u8Z_free(arg_var);
10661 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10662 LDKu8slice ser_ref;
10663 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10664 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10665 LDKUpdateFailHTLC ret = UpdateFailHTLC_read(ser_ref);
10666 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10667 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10670 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10671 LDKUpdateFailMalformedHTLC obj_conv;
10672 obj_conv.inner = (void*)(obj & (~1));
10673 obj_conv.is_owned = (obj & 1) || (obj == 0);
10674 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
10675 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10676 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10677 CVec_u8Z_free(arg_var);
10681 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10682 LDKu8slice ser_ref;
10683 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10684 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10685 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_read(ser_ref);
10686 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10687 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10690 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
10691 LDKUpdateFee obj_conv;
10692 obj_conv.inner = (void*)(obj & (~1));
10693 obj_conv.is_owned = (obj & 1) || (obj == 0);
10694 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
10695 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10696 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10697 CVec_u8Z_free(arg_var);
10701 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10702 LDKu8slice ser_ref;
10703 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10704 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10705 LDKUpdateFee ret = UpdateFee_read(ser_ref);
10706 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10707 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10710 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10711 LDKUpdateFulfillHTLC obj_conv;
10712 obj_conv.inner = (void*)(obj & (~1));
10713 obj_conv.is_owned = (obj & 1) || (obj == 0);
10714 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
10715 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10716 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10717 CVec_u8Z_free(arg_var);
10721 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10722 LDKu8slice ser_ref;
10723 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10724 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10725 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_read(ser_ref);
10726 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10727 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10730 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10731 LDKUpdateAddHTLC obj_conv;
10732 obj_conv.inner = (void*)(obj & (~1));
10733 obj_conv.is_owned = (obj & 1) || (obj == 0);
10734 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
10735 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10736 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10737 CVec_u8Z_free(arg_var);
10741 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10742 LDKu8slice ser_ref;
10743 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10744 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10745 LDKUpdateAddHTLC ret = UpdateAddHTLC_read(ser_ref);
10746 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10747 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10750 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
10752 obj_conv.inner = (void*)(obj & (~1));
10753 obj_conv.is_owned = (obj & 1) || (obj == 0);
10754 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
10755 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10756 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10757 CVec_u8Z_free(arg_var);
10761 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10762 LDKu8slice ser_ref;
10763 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10764 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10765 LDKPing ret = Ping_read(ser_ref);
10766 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10767 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10770 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
10772 obj_conv.inner = (void*)(obj & (~1));
10773 obj_conv.is_owned = (obj & 1) || (obj == 0);
10774 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
10775 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10776 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10777 CVec_u8Z_free(arg_var);
10781 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10782 LDKu8slice ser_ref;
10783 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10784 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10785 LDKPong ret = Pong_read(ser_ref);
10786 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10787 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10790 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10791 LDKUnsignedChannelAnnouncement obj_conv;
10792 obj_conv.inner = (void*)(obj & (~1));
10793 obj_conv.is_owned = (obj & 1) || (obj == 0);
10794 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
10795 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10796 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10797 CVec_u8Z_free(arg_var);
10801 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10802 LDKu8slice ser_ref;
10803 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10804 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10805 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_read(ser_ref);
10806 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10807 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10810 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10811 LDKChannelAnnouncement obj_conv;
10812 obj_conv.inner = (void*)(obj & (~1));
10813 obj_conv.is_owned = (obj & 1) || (obj == 0);
10814 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
10815 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10816 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10817 CVec_u8Z_free(arg_var);
10821 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10822 LDKu8slice ser_ref;
10823 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10824 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10825 LDKChannelAnnouncement ret = ChannelAnnouncement_read(ser_ref);
10826 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10827 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10830 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
10831 LDKUnsignedChannelUpdate obj_conv;
10832 obj_conv.inner = (void*)(obj & (~1));
10833 obj_conv.is_owned = (obj & 1) || (obj == 0);
10834 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
10835 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10836 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10837 CVec_u8Z_free(arg_var);
10841 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10842 LDKu8slice ser_ref;
10843 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10844 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10845 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_read(ser_ref);
10846 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10847 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10850 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
10851 LDKChannelUpdate obj_conv;
10852 obj_conv.inner = (void*)(obj & (~1));
10853 obj_conv.is_owned = (obj & 1) || (obj == 0);
10854 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
10855 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10856 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10857 CVec_u8Z_free(arg_var);
10861 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10862 LDKu8slice ser_ref;
10863 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10864 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10865 LDKChannelUpdate ret = ChannelUpdate_read(ser_ref);
10866 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10867 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10870 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
10871 LDKErrorMessage obj_conv;
10872 obj_conv.inner = (void*)(obj & (~1));
10873 obj_conv.is_owned = (obj & 1) || (obj == 0);
10874 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
10875 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10876 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10877 CVec_u8Z_free(arg_var);
10881 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10882 LDKu8slice ser_ref;
10883 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10884 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10885 LDKErrorMessage ret = ErrorMessage_read(ser_ref);
10886 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10887 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10890 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10891 LDKUnsignedNodeAnnouncement obj_conv;
10892 obj_conv.inner = (void*)(obj & (~1));
10893 obj_conv.is_owned = (obj & 1) || (obj == 0);
10894 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
10895 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10896 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10897 CVec_u8Z_free(arg_var);
10901 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10902 LDKu8slice ser_ref;
10903 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10904 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10905 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_read(ser_ref);
10906 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10907 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10910 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10911 LDKNodeAnnouncement obj_conv;
10912 obj_conv.inner = (void*)(obj & (~1));
10913 obj_conv.is_owned = (obj & 1) || (obj == 0);
10914 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
10915 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10916 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10917 CVec_u8Z_free(arg_var);
10921 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10922 LDKu8slice ser_ref;
10923 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10924 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10925 LDKNodeAnnouncement ret = NodeAnnouncement_read(ser_ref);
10926 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10927 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10930 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10931 LDKu8slice ser_ref;
10932 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10933 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10934 LDKQueryShortChannelIds ret = QueryShortChannelIds_read(ser_ref);
10935 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10936 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10939 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
10940 LDKQueryShortChannelIds obj_conv;
10941 obj_conv.inner = (void*)(obj & (~1));
10942 obj_conv.is_owned = (obj & 1) || (obj == 0);
10943 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
10944 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10945 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10946 CVec_u8Z_free(arg_var);
10950 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10951 LDKu8slice ser_ref;
10952 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10953 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10954 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_read(ser_ref);
10955 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10956 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10959 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
10960 LDKReplyShortChannelIdsEnd obj_conv;
10961 obj_conv.inner = (void*)(obj & (~1));
10962 obj_conv.is_owned = (obj & 1) || (obj == 0);
10963 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
10964 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10965 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10966 CVec_u8Z_free(arg_var);
10970 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10971 LDKu8slice ser_ref;
10972 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10973 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10974 LDKQueryChannelRange ret = QueryChannelRange_read(ser_ref);
10975 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10976 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10979 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
10980 LDKQueryChannelRange obj_conv;
10981 obj_conv.inner = (void*)(obj & (~1));
10982 obj_conv.is_owned = (obj & 1) || (obj == 0);
10983 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
10984 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10985 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10986 CVec_u8Z_free(arg_var);
10990 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10991 LDKu8slice ser_ref;
10992 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10993 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10994 LDKReplyChannelRange ret = ReplyChannelRange_read(ser_ref);
10995 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10996 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10999 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
11000 LDKReplyChannelRange obj_conv;
11001 obj_conv.inner = (void*)(obj & (~1));
11002 obj_conv.is_owned = (obj & 1) || (obj == 0);
11003 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
11004 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11005 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11006 CVec_u8Z_free(arg_var);
11010 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11011 LDKu8slice ser_ref;
11012 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11013 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11014 LDKGossipTimestampFilter ret = GossipTimestampFilter_read(ser_ref);
11015 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11016 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11019 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
11020 LDKGossipTimestampFilter obj_conv;
11021 obj_conv.inner = (void*)(obj & (~1));
11022 obj_conv.is_owned = (obj & 1) || (obj == 0);
11023 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
11024 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11025 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11026 CVec_u8Z_free(arg_var);
11030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11031 LDKMessageHandler this_ptr_conv;
11032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11034 MessageHandler_free(this_ptr_conv);
11037 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
11038 LDKMessageHandler this_ptr_conv;
11039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11040 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11041 long ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
11045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11046 LDKMessageHandler this_ptr_conv;
11047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11048 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11049 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
11050 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
11051 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11052 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
11054 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
11057 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
11058 LDKMessageHandler this_ptr_conv;
11059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11060 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11061 long ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
11065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11066 LDKMessageHandler this_ptr_conv;
11067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11068 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11069 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
11070 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
11071 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11072 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
11074 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
11077 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
11078 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
11079 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
11080 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11081 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
11083 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
11084 if (route_handler_arg_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(route_handler_arg_conv.this_arg);
11088 LDKMessageHandler ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
11089 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11093 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
11094 FREE((void*)this_ptr);
11095 SocketDescriptor_free(this_ptr_conv);
11098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11099 LDKPeerHandleError this_ptr_conv;
11100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11101 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11102 PeerHandleError_free(this_ptr_conv);
11105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
11106 LDKPeerHandleError this_ptr_conv;
11107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11109 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
11113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11114 LDKPeerHandleError this_ptr_conv;
11115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11116 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11117 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
11120 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
11121 LDKPeerHandleError ret = PeerHandleError_new(no_connection_possible_arg);
11122 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11126 LDKPeerManager this_ptr_conv;
11127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11128 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11129 PeerManager_free(this_ptr_conv);
11132 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) {
11133 LDKMessageHandler message_handler_conv;
11134 message_handler_conv.inner = (void*)(message_handler & (~1));
11135 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
11136 // Warning: we may need a move here but can't clone!
11137 LDKSecretKey our_node_secret_ref;
11138 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
11139 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
11140 unsigned char ephemeral_random_data_arr[32];
11141 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
11142 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
11143 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
11144 LDKLogger logger_conv = *(LDKLogger*)logger;
11145 if (logger_conv.free == LDKLogger_JCalls_free) {
11146 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11147 LDKLogger_JCalls_clone(logger_conv.this_arg);
11149 LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
11150 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11153 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
11154 LDKPeerManager this_arg_conv;
11155 this_arg_conv.inner = (void*)(this_arg & (~1));
11156 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11157 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
11158 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, NULL, NULL);
11159 for (size_t i = 0; i < ret_var.datalen; i++) {
11160 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
11161 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
11162 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
11164 CVec_PublicKeyZ_free(ret_var);
11168 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) {
11169 LDKPeerManager this_arg_conv;
11170 this_arg_conv.inner = (void*)(this_arg & (~1));
11171 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11172 LDKPublicKey their_node_id_ref;
11173 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
11174 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11175 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
11176 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
11177 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11178 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
11180 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11181 *ret = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
11185 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
11186 LDKPeerManager this_arg_conv;
11187 this_arg_conv.inner = (void*)(this_arg & (~1));
11188 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
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_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11195 *ret = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
11199 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(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 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11205 *ret = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
11209 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
11210 LDKPeerManager this_arg_conv;
11211 this_arg_conv.inner = (void*)(this_arg & (~1));
11212 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11213 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
11214 LDKu8slice data_ref;
11215 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
11216 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
11217 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11218 *ret = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
11219 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
11223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
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 PeerManager_process_events(&this_arg_conv);
11230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
11231 LDKPeerManager this_arg_conv;
11232 this_arg_conv.inner = (void*)(this_arg & (~1));
11233 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11234 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
11235 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
11238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
11239 LDKPeerManager this_arg_conv;
11240 this_arg_conv.inner = (void*)(this_arg & (~1));
11241 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11242 PeerManager_timer_tick_occured(&this_arg_conv);
11245 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
11246 unsigned char commitment_seed_arr[32];
11247 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
11248 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
11249 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
11250 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
11251 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
11255 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
11256 LDKPublicKey per_commitment_point_ref;
11257 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11258 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11259 unsigned char base_secret_arr[32];
11260 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
11261 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
11262 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
11263 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
11264 *ret = derive_private_key(per_commitment_point_ref, base_secret_ref);
11268 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
11269 LDKPublicKey per_commitment_point_ref;
11270 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11271 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11272 LDKPublicKey base_point_ref;
11273 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
11274 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
11275 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
11276 *ret = derive_public_key(per_commitment_point_ref, base_point_ref);
11280 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) {
11281 unsigned char per_commitment_secret_arr[32];
11282 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
11283 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
11284 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
11285 unsigned char countersignatory_revocation_base_secret_arr[32];
11286 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
11287 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
11288 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
11289 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
11290 *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
11294 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) {
11295 LDKPublicKey per_commitment_point_ref;
11296 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11297 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11298 LDKPublicKey countersignatory_revocation_base_point_ref;
11299 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
11300 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
11301 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
11302 *ret = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
11306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11307 LDKTxCreationKeys this_ptr_conv;
11308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11309 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11310 TxCreationKeys_free(this_ptr_conv);
11313 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11314 LDKTxCreationKeys orig_conv;
11315 orig_conv.inner = (void*)(orig & (~1));
11316 orig_conv.is_owned = (orig & 1) || (orig == 0);
11317 LDKTxCreationKeys ret = TxCreationKeys_clone(&orig_conv);
11318 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11321 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
11322 LDKTxCreationKeys this_ptr_conv;
11323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11324 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11325 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11326 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
11330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11331 LDKTxCreationKeys this_ptr_conv;
11332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11333 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11334 LDKPublicKey val_ref;
11335 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11336 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11337 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
11340 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11341 LDKTxCreationKeys this_ptr_conv;
11342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11343 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11344 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11345 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
11349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11350 LDKTxCreationKeys this_ptr_conv;
11351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11352 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11353 LDKPublicKey val_ref;
11354 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11355 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11356 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
11359 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11360 LDKTxCreationKeys this_ptr_conv;
11361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11362 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11363 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11364 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
11368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11369 LDKTxCreationKeys this_ptr_conv;
11370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11371 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11372 LDKPublicKey val_ref;
11373 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11374 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11375 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
11378 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11379 LDKTxCreationKeys this_ptr_conv;
11380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11381 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11382 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11383 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
11387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11388 LDKTxCreationKeys this_ptr_conv;
11389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11390 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11391 LDKPublicKey val_ref;
11392 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11393 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11394 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
11397 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11398 LDKTxCreationKeys this_ptr_conv;
11399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11401 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11402 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
11406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11407 LDKTxCreationKeys this_ptr_conv;
11408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11409 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11410 LDKPublicKey val_ref;
11411 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11412 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11413 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
11416 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) {
11417 LDKPublicKey per_commitment_point_arg_ref;
11418 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
11419 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
11420 LDKPublicKey revocation_key_arg_ref;
11421 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
11422 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
11423 LDKPublicKey broadcaster_htlc_key_arg_ref;
11424 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
11425 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
11426 LDKPublicKey countersignatory_htlc_key_arg_ref;
11427 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
11428 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
11429 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
11430 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
11431 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
11432 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);
11433 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11436 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
11437 LDKTxCreationKeys obj_conv;
11438 obj_conv.inner = (void*)(obj & (~1));
11439 obj_conv.is_owned = (obj & 1) || (obj == 0);
11440 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
11441 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11442 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11443 CVec_u8Z_free(arg_var);
11447 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11448 LDKu8slice ser_ref;
11449 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11450 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11451 LDKTxCreationKeys ret = TxCreationKeys_read(ser_ref);
11452 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11453 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11457 LDKPreCalculatedTxCreationKeys this_ptr_conv;
11458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11459 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11460 PreCalculatedTxCreationKeys_free(this_ptr_conv);
11463 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
11464 LDKTxCreationKeys keys_conv;
11465 keys_conv.inner = (void*)(keys & (~1));
11466 keys_conv.is_owned = (keys & 1) || (keys == 0);
11467 if (keys_conv.inner != NULL)
11468 keys_conv = TxCreationKeys_clone(&keys_conv);
11469 LDKPreCalculatedTxCreationKeys ret = PreCalculatedTxCreationKeys_new(keys_conv);
11470 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
11474 LDKPreCalculatedTxCreationKeys this_arg_conv;
11475 this_arg_conv.inner = (void*)(this_arg & (~1));
11476 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11477 LDKTxCreationKeys ret = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
11478 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11481 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
11482 LDKPreCalculatedTxCreationKeys this_arg_conv;
11483 this_arg_conv.inner = (void*)(this_arg & (~1));
11484 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11485 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11486 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
11490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11491 LDKChannelPublicKeys this_ptr_conv;
11492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11493 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11494 ChannelPublicKeys_free(this_ptr_conv);
11497 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11498 LDKChannelPublicKeys orig_conv;
11499 orig_conv.inner = (void*)(orig & (~1));
11500 orig_conv.is_owned = (orig & 1) || (orig == 0);
11501 LDKChannelPublicKeys ret = ChannelPublicKeys_clone(&orig_conv);
11502 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11505 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
11506 LDKChannelPublicKeys this_ptr_conv;
11507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11508 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11509 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11510 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
11514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11515 LDKChannelPublicKeys this_ptr_conv;
11516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11517 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11518 LDKPublicKey val_ref;
11519 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11520 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11521 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
11524 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
11525 LDKChannelPublicKeys this_ptr_conv;
11526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11527 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11528 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11529 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
11533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11534 LDKChannelPublicKeys this_ptr_conv;
11535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11536 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11537 LDKPublicKey val_ref;
11538 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11539 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11540 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
11543 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
11544 LDKChannelPublicKeys this_ptr_conv;
11545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11546 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11547 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11548 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
11552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11553 LDKChannelPublicKeys this_ptr_conv;
11554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11555 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11556 LDKPublicKey val_ref;
11557 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11558 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11559 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
11562 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
11563 LDKChannelPublicKeys this_ptr_conv;
11564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11565 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11566 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11567 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
11571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11572 LDKChannelPublicKeys this_ptr_conv;
11573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11574 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11575 LDKPublicKey val_ref;
11576 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11577 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11578 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
11581 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
11582 LDKChannelPublicKeys this_ptr_conv;
11583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11585 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11586 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
11590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11591 LDKChannelPublicKeys this_ptr_conv;
11592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11593 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11594 LDKPublicKey val_ref;
11595 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11596 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11597 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
11600 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) {
11601 LDKPublicKey funding_pubkey_arg_ref;
11602 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
11603 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
11604 LDKPublicKey revocation_basepoint_arg_ref;
11605 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
11606 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
11607 LDKPublicKey payment_point_arg_ref;
11608 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
11609 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
11610 LDKPublicKey delayed_payment_basepoint_arg_ref;
11611 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
11612 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
11613 LDKPublicKey htlc_basepoint_arg_ref;
11614 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
11615 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
11616 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);
11617 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11620 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
11621 LDKChannelPublicKeys obj_conv;
11622 obj_conv.inner = (void*)(obj & (~1));
11623 obj_conv.is_owned = (obj & 1) || (obj == 0);
11624 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
11625 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11626 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11627 CVec_u8Z_free(arg_var);
11631 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11632 LDKu8slice ser_ref;
11633 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11634 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11635 LDKChannelPublicKeys ret = ChannelPublicKeys_read(ser_ref);
11636 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11637 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11640 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) {
11641 LDKPublicKey per_commitment_point_ref;
11642 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11643 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11644 LDKPublicKey broadcaster_delayed_payment_base_ref;
11645 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
11646 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
11647 LDKPublicKey broadcaster_htlc_base_ref;
11648 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
11649 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
11650 LDKPublicKey countersignatory_revocation_base_ref;
11651 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
11652 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
11653 LDKPublicKey countersignatory_htlc_base_ref;
11654 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
11655 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
11656 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
11657 *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);
11661 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) {
11662 LDKPublicKey revocation_key_ref;
11663 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
11664 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
11665 LDKPublicKey broadcaster_delayed_payment_key_ref;
11666 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
11667 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
11668 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
11669 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11670 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11671 CVec_u8Z_free(arg_var);
11675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11676 LDKHTLCOutputInCommitment this_ptr_conv;
11677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11678 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11679 HTLCOutputInCommitment_free(this_ptr_conv);
11682 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11683 LDKHTLCOutputInCommitment orig_conv;
11684 orig_conv.inner = (void*)(orig & (~1));
11685 orig_conv.is_owned = (orig & 1) || (orig == 0);
11686 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_clone(&orig_conv);
11687 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11690 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
11691 LDKHTLCOutputInCommitment this_ptr_conv;
11692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11693 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11694 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
11698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11699 LDKHTLCOutputInCommitment this_ptr_conv;
11700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11701 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11702 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
11705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11706 LDKHTLCOutputInCommitment this_ptr_conv;
11707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11709 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
11713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11714 LDKHTLCOutputInCommitment this_ptr_conv;
11715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11717 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
11720 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
11721 LDKHTLCOutputInCommitment this_ptr_conv;
11722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11724 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
11728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11729 LDKHTLCOutputInCommitment this_ptr_conv;
11730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11731 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11732 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
11735 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
11736 LDKHTLCOutputInCommitment this_ptr_conv;
11737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11739 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11740 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
11744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11745 LDKHTLCOutputInCommitment this_ptr_conv;
11746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11747 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11748 LDKThirtyTwoBytes val_ref;
11749 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11750 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11751 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
11754 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
11755 LDKHTLCOutputInCommitment obj_conv;
11756 obj_conv.inner = (void*)(obj & (~1));
11757 obj_conv.is_owned = (obj & 1) || (obj == 0);
11758 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
11759 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11760 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11761 CVec_u8Z_free(arg_var);
11765 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11766 LDKu8slice ser_ref;
11767 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11768 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11769 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_read(ser_ref);
11770 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11771 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11774 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
11775 LDKHTLCOutputInCommitment htlc_conv;
11776 htlc_conv.inner = (void*)(htlc & (~1));
11777 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
11778 LDKTxCreationKeys keys_conv;
11779 keys_conv.inner = (void*)(keys & (~1));
11780 keys_conv.is_owned = (keys & 1) || (keys == 0);
11781 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
11782 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11783 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11784 CVec_u8Z_free(arg_var);
11788 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
11789 LDKPublicKey broadcaster_ref;
11790 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
11791 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
11792 LDKPublicKey countersignatory_ref;
11793 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
11794 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
11795 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
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 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) {
11803 unsigned char prev_hash_arr[32];
11804 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
11805 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
11806 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
11807 LDKHTLCOutputInCommitment htlc_conv;
11808 htlc_conv.inner = (void*)(htlc & (~1));
11809 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
11810 LDKPublicKey broadcaster_delayed_payment_key_ref;
11811 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
11812 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
11813 LDKPublicKey revocation_key_ref;
11814 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
11815 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
11816 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
11817 *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
11821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11822 LDKHolderCommitmentTransaction this_ptr_conv;
11823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11824 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11825 HolderCommitmentTransaction_free(this_ptr_conv);
11828 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11829 LDKHolderCommitmentTransaction orig_conv;
11830 orig_conv.inner = (void*)(orig & (~1));
11831 orig_conv.is_owned = (orig & 1) || (orig == 0);
11832 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_clone(&orig_conv);
11833 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
11837 LDKHolderCommitmentTransaction this_ptr_conv;
11838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11839 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11840 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
11841 *ret = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
11845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11846 LDKHolderCommitmentTransaction this_ptr_conv;
11847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11848 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11849 LDKTransaction val_conv = *(LDKTransaction*)val;
11851 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
11854 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
11855 LDKHolderCommitmentTransaction this_ptr_conv;
11856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11857 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11858 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
11859 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
11863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11864 LDKHolderCommitmentTransaction this_ptr_conv;
11865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11866 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11867 LDKSignature val_ref;
11868 CHECK((*_env)->GetArrayLength (_env, val) == 64);
11869 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
11870 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
11873 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
11874 LDKHolderCommitmentTransaction this_ptr_conv;
11875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11876 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11877 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
11881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11882 LDKHolderCommitmentTransaction this_ptr_conv;
11883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11884 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11885 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
11888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11889 LDKHolderCommitmentTransaction this_ptr_conv;
11890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11891 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11892 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_constr;
11893 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11894 if (val_constr.datalen > 0)
11895 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
11897 val_constr.data = NULL;
11898 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11899 for (size_t q = 0; q < val_constr.datalen; q++) {
11900 long arr_conv_42 = val_vals[q];
11901 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
11902 FREE((void*)arr_conv_42);
11903 val_constr.data[q] = arr_conv_42_conv;
11905 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11906 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_constr);
11909 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) {
11910 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
11911 FREE((void*)unsigned_tx);
11912 LDKSignature counterparty_sig_ref;
11913 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
11914 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
11915 LDKPublicKey holder_funding_key_ref;
11916 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
11917 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
11918 LDKPublicKey counterparty_funding_key_ref;
11919 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
11920 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
11921 LDKTxCreationKeys keys_conv;
11922 keys_conv.inner = (void*)(keys & (~1));
11923 keys_conv.is_owned = (keys & 1) || (keys == 0);
11924 if (keys_conv.inner != NULL)
11925 keys_conv = TxCreationKeys_clone(&keys_conv);
11926 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_constr;
11927 htlc_data_constr.datalen = (*_env)->GetArrayLength (_env, htlc_data);
11928 if (htlc_data_constr.datalen > 0)
11929 htlc_data_constr.data = MALLOC(htlc_data_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
11931 htlc_data_constr.data = NULL;
11932 long* htlc_data_vals = (*_env)->GetLongArrayElements (_env, htlc_data, NULL);
11933 for (size_t q = 0; q < htlc_data_constr.datalen; q++) {
11934 long arr_conv_42 = htlc_data_vals[q];
11935 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
11936 FREE((void*)arr_conv_42);
11937 htlc_data_constr.data[q] = arr_conv_42_conv;
11939 (*_env)->ReleaseLongArrayElements (_env, htlc_data, htlc_data_vals, 0);
11940 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);
11941 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11944 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
11945 LDKHolderCommitmentTransaction this_arg_conv;
11946 this_arg_conv.inner = (void*)(this_arg & (~1));
11947 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11948 LDKTxCreationKeys ret = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
11949 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11952 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
11953 LDKHolderCommitmentTransaction this_arg_conv;
11954 this_arg_conv.inner = (void*)(this_arg & (~1));
11955 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11956 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
11957 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
11961 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) {
11962 LDKHolderCommitmentTransaction this_arg_conv;
11963 this_arg_conv.inner = (void*)(this_arg & (~1));
11964 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11965 unsigned char funding_key_arr[32];
11966 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
11967 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
11968 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
11969 LDKu8slice funding_redeemscript_ref;
11970 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
11971 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
11972 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
11973 (*_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);
11974 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
11978 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) {
11979 LDKHolderCommitmentTransaction this_arg_conv;
11980 this_arg_conv.inner = (void*)(this_arg & (~1));
11981 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11982 unsigned char htlc_base_key_arr[32];
11983 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
11984 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
11985 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
11986 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11987 *ret = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
11991 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
11992 LDKHolderCommitmentTransaction obj_conv;
11993 obj_conv.inner = (void*)(obj & (~1));
11994 obj_conv.is_owned = (obj & 1) || (obj == 0);
11995 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
11996 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11997 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11998 CVec_u8Z_free(arg_var);
12002 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12003 LDKu8slice ser_ref;
12004 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12005 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12006 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_read(ser_ref);
12007 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12008 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12012 LDKInitFeatures this_ptr_conv;
12013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12014 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12015 InitFeatures_free(this_ptr_conv);
12018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12019 LDKNodeFeatures this_ptr_conv;
12020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12021 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12022 NodeFeatures_free(this_ptr_conv);
12025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12026 LDKChannelFeatures this_ptr_conv;
12027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12028 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12029 ChannelFeatures_free(this_ptr_conv);
12032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12033 LDKRouteHop this_ptr_conv;
12034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12035 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12036 RouteHop_free(this_ptr_conv);
12039 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12040 LDKRouteHop orig_conv;
12041 orig_conv.inner = (void*)(orig & (~1));
12042 orig_conv.is_owned = (orig & 1) || (orig == 0);
12043 LDKRouteHop ret = RouteHop_clone(&orig_conv);
12044 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12047 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
12048 LDKRouteHop this_ptr_conv;
12049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12051 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12052 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
12056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12057 LDKRouteHop this_ptr_conv;
12058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12059 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12060 LDKPublicKey val_ref;
12061 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12062 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12063 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
12066 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12067 LDKRouteHop this_ptr_conv;
12068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12069 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12070 LDKNodeFeatures ret = RouteHop_get_node_features(&this_ptr_conv);
12071 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12075 LDKRouteHop this_ptr_conv;
12076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12077 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12078 LDKNodeFeatures val_conv;
12079 val_conv.inner = (void*)(val & (~1));
12080 val_conv.is_owned = (val & 1) || (val == 0);
12081 // Warning: we may need a move here but can't clone!
12082 RouteHop_set_node_features(&this_ptr_conv, val_conv);
12085 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12086 LDKRouteHop this_ptr_conv;
12087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12088 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12089 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
12093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12094 LDKRouteHop this_ptr_conv;
12095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12096 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12097 RouteHop_set_short_channel_id(&this_ptr_conv, val);
12100 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12101 LDKRouteHop this_ptr_conv;
12102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12103 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12104 LDKChannelFeatures ret = RouteHop_get_channel_features(&this_ptr_conv);
12105 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12109 LDKRouteHop this_ptr_conv;
12110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12111 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12112 LDKChannelFeatures val_conv;
12113 val_conv.inner = (void*)(val & (~1));
12114 val_conv.is_owned = (val & 1) || (val == 0);
12115 // Warning: we may need a move here but can't clone!
12116 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
12119 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12120 LDKRouteHop this_ptr_conv;
12121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12122 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12123 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
12127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12128 LDKRouteHop this_ptr_conv;
12129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12130 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12131 RouteHop_set_fee_msat(&this_ptr_conv, val);
12134 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
12135 LDKRouteHop this_ptr_conv;
12136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12137 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12138 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
12142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12143 LDKRouteHop this_ptr_conv;
12144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12145 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12146 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
12149 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) {
12150 LDKPublicKey pubkey_arg_ref;
12151 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
12152 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
12153 LDKNodeFeatures node_features_arg_conv;
12154 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
12155 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
12156 // Warning: we may need a move here but can't clone!
12157 LDKChannelFeatures channel_features_arg_conv;
12158 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
12159 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
12160 // Warning: we may need a move here but can't clone!
12161 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);
12162 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12166 LDKRoute this_ptr_conv;
12167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12168 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12169 Route_free(this_ptr_conv);
12172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12173 LDKRoute orig_conv;
12174 orig_conv.inner = (void*)(orig & (~1));
12175 orig_conv.is_owned = (orig & 1) || (orig == 0);
12176 LDKRoute ret = Route_clone(&orig_conv);
12177 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
12181 LDKRoute this_ptr_conv;
12182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12183 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12184 LDKCVec_CVec_RouteHopZZ val_constr;
12185 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12186 if (val_constr.datalen > 0)
12187 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12189 val_constr.data = NULL;
12190 for (size_t m = 0; m < val_constr.datalen; m++) {
12191 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
12192 LDKCVec_RouteHopZ arr_conv_12_constr;
12193 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
12194 if (arr_conv_12_constr.datalen > 0)
12195 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12197 arr_conv_12_constr.data = NULL;
12198 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
12199 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
12200 long arr_conv_10 = arr_conv_12_vals[k];
12201 LDKRouteHop arr_conv_10_conv;
12202 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
12203 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
12204 if (arr_conv_10_conv.inner != NULL)
12205 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
12206 arr_conv_12_constr.data[k] = arr_conv_10_conv;
12208 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
12209 val_constr.data[m] = arr_conv_12_constr;
12211 Route_set_paths(&this_ptr_conv, val_constr);
12214 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
12215 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
12216 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
12217 if (paths_arg_constr.datalen > 0)
12218 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12220 paths_arg_constr.data = NULL;
12221 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
12222 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
12223 LDKCVec_RouteHopZ arr_conv_12_constr;
12224 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
12225 if (arr_conv_12_constr.datalen > 0)
12226 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12228 arr_conv_12_constr.data = NULL;
12229 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
12230 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
12231 long arr_conv_10 = arr_conv_12_vals[k];
12232 LDKRouteHop arr_conv_10_conv;
12233 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
12234 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
12235 if (arr_conv_10_conv.inner != NULL)
12236 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
12237 arr_conv_12_constr.data[k] = arr_conv_10_conv;
12239 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
12240 paths_arg_constr.data[m] = arr_conv_12_constr;
12242 LDKRoute ret = Route_new(paths_arg_constr);
12243 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12246 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
12248 obj_conv.inner = (void*)(obj & (~1));
12249 obj_conv.is_owned = (obj & 1) || (obj == 0);
12250 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
12251 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12252 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12253 CVec_u8Z_free(arg_var);
12257 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12258 LDKu8slice ser_ref;
12259 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12260 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12261 LDKRoute ret = Route_read(ser_ref);
12262 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12263 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12267 LDKRouteHint this_ptr_conv;
12268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12269 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12270 RouteHint_free(this_ptr_conv);
12273 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12274 LDKRouteHint orig_conv;
12275 orig_conv.inner = (void*)(orig & (~1));
12276 orig_conv.is_owned = (orig & 1) || (orig == 0);
12277 LDKRouteHint ret = RouteHint_clone(&orig_conv);
12278 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12281 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12282 LDKRouteHint this_ptr_conv;
12283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12284 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12285 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12286 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
12290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12291 LDKRouteHint this_ptr_conv;
12292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12293 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12294 LDKPublicKey val_ref;
12295 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12296 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12297 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
12300 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12301 LDKRouteHint this_ptr_conv;
12302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12303 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12304 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
12308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12309 LDKRouteHint this_ptr_conv;
12310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12311 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12312 RouteHint_set_short_channel_id(&this_ptr_conv, val);
12315 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
12316 LDKRouteHint this_ptr_conv;
12317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12319 LDKRoutingFees ret = RouteHint_get_fees(&this_ptr_conv);
12320 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12324 LDKRouteHint this_ptr_conv;
12325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12326 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12327 LDKRoutingFees val_conv;
12328 val_conv.inner = (void*)(val & (~1));
12329 val_conv.is_owned = (val & 1) || (val == 0);
12330 if (val_conv.inner != NULL)
12331 val_conv = RoutingFees_clone(&val_conv);
12332 RouteHint_set_fees(&this_ptr_conv, val_conv);
12335 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
12343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
12344 LDKRouteHint this_ptr_conv;
12345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12346 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12347 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
12350 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12351 LDKRouteHint this_ptr_conv;
12352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12353 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12354 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
12358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12359 LDKRouteHint this_ptr_conv;
12360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12361 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12362 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
12365 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) {
12366 LDKPublicKey src_node_id_arg_ref;
12367 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
12368 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
12369 LDKRoutingFees fees_arg_conv;
12370 fees_arg_conv.inner = (void*)(fees_arg & (~1));
12371 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
12372 if (fees_arg_conv.inner != NULL)
12373 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
12374 LDKRouteHint ret = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
12375 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12378 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) {
12379 LDKPublicKey our_node_id_ref;
12380 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
12381 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
12382 LDKNetworkGraph network_conv;
12383 network_conv.inner = (void*)(network & (~1));
12384 network_conv.is_owned = (network & 1) || (network == 0);
12385 LDKPublicKey target_ref;
12386 CHECK((*_env)->GetArrayLength (_env, target) == 33);
12387 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
12388 LDKCVec_ChannelDetailsZ first_hops_constr;
12389 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
12390 if (first_hops_constr.datalen > 0)
12391 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12393 first_hops_constr.data = NULL;
12394 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
12395 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
12396 long arr_conv_16 = first_hops_vals[q];
12397 LDKChannelDetails arr_conv_16_conv;
12398 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
12399 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
12400 first_hops_constr.data[q] = arr_conv_16_conv;
12402 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
12403 LDKCVec_RouteHintZ last_hops_constr;
12404 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
12405 if (last_hops_constr.datalen > 0)
12406 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12408 last_hops_constr.data = NULL;
12409 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
12410 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
12411 long arr_conv_11 = last_hops_vals[l];
12412 LDKRouteHint arr_conv_11_conv;
12413 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
12414 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
12415 if (arr_conv_11_conv.inner != NULL)
12416 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
12417 last_hops_constr.data[l] = arr_conv_11_conv;
12419 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
12420 LDKLogger logger_conv = *(LDKLogger*)logger;
12421 if (logger_conv.free == LDKLogger_JCalls_free) {
12422 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12423 LDKLogger_JCalls_clone(logger_conv.this_arg);
12425 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12426 *ret = get_route(our_node_id_ref, &network_conv, target_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
12427 FREE(first_hops_constr.data);
12431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12432 LDKNetworkGraph this_ptr_conv;
12433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12434 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12435 NetworkGraph_free(this_ptr_conv);
12438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12439 LDKLockedNetworkGraph this_ptr_conv;
12440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12441 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12442 LockedNetworkGraph_free(this_ptr_conv);
12445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12446 LDKNetGraphMsgHandler this_ptr_conv;
12447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12448 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12449 NetGraphMsgHandler_free(this_ptr_conv);
12452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
12453 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
12454 LDKLogger logger_conv = *(LDKLogger*)logger;
12455 if (logger_conv.free == LDKLogger_JCalls_free) {
12456 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12457 LDKLogger_JCalls_clone(logger_conv.this_arg);
12459 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
12460 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12463 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
12464 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
12465 LDKLogger logger_conv = *(LDKLogger*)logger;
12466 if (logger_conv.free == LDKLogger_JCalls_free) {
12467 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12468 LDKLogger_JCalls_clone(logger_conv.this_arg);
12470 LDKNetworkGraph network_graph_conv;
12471 network_graph_conv.inner = (void*)(network_graph & (~1));
12472 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
12473 // Warning: we may need a move here but can't clone!
12474 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
12475 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12478 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
12479 LDKNetGraphMsgHandler this_arg_conv;
12480 this_arg_conv.inner = (void*)(this_arg & (~1));
12481 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12482 LDKLockedNetworkGraph ret = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
12483 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
12487 LDKLockedNetworkGraph this_arg_conv;
12488 this_arg_conv.inner = (void*)(this_arg & (~1));
12489 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12490 LDKNetworkGraph ret = LockedNetworkGraph_graph(&this_arg_conv);
12491 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12494 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
12495 LDKNetGraphMsgHandler this_arg_conv;
12496 this_arg_conv.inner = (void*)(this_arg & (~1));
12497 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12498 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
12499 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
12503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12504 LDKDirectionalChannelInfo this_ptr_conv;
12505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12506 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12507 DirectionalChannelInfo_free(this_ptr_conv);
12510 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
12511 LDKDirectionalChannelInfo this_ptr_conv;
12512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12513 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12514 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
12518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12519 LDKDirectionalChannelInfo this_ptr_conv;
12520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12521 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12522 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
12525 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
12526 LDKDirectionalChannelInfo this_ptr_conv;
12527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12528 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12529 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
12533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12534 LDKDirectionalChannelInfo this_ptr_conv;
12535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12536 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12537 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
12540 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
12541 LDKDirectionalChannelInfo this_ptr_conv;
12542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12544 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
12548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
12549 LDKDirectionalChannelInfo this_ptr_conv;
12550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12551 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12552 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
12555 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12556 LDKDirectionalChannelInfo this_ptr_conv;
12557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12558 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12559 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
12563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12564 LDKDirectionalChannelInfo this_ptr_conv;
12565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12566 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12567 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
12570 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
12571 LDKDirectionalChannelInfo this_ptr_conv;
12572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12573 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12574 LDKChannelUpdate ret = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
12575 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12579 LDKDirectionalChannelInfo this_ptr_conv;
12580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12582 LDKChannelUpdate val_conv;
12583 val_conv.inner = (void*)(val & (~1));
12584 val_conv.is_owned = (val & 1) || (val == 0);
12585 if (val_conv.inner != NULL)
12586 val_conv = ChannelUpdate_clone(&val_conv);
12587 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
12590 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12591 LDKDirectionalChannelInfo obj_conv;
12592 obj_conv.inner = (void*)(obj & (~1));
12593 obj_conv.is_owned = (obj & 1) || (obj == 0);
12594 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
12595 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12596 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12597 CVec_u8Z_free(arg_var);
12601 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12602 LDKu8slice ser_ref;
12603 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12604 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12605 LDKDirectionalChannelInfo ret = DirectionalChannelInfo_read(ser_ref);
12606 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12607 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12611 LDKChannelInfo this_ptr_conv;
12612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12613 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12614 ChannelInfo_free(this_ptr_conv);
12617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12618 LDKChannelInfo this_ptr_conv;
12619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12620 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12621 LDKChannelFeatures ret = ChannelInfo_get_features(&this_ptr_conv);
12622 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12626 LDKChannelInfo this_ptr_conv;
12627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12628 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12629 LDKChannelFeatures val_conv;
12630 val_conv.inner = (void*)(val & (~1));
12631 val_conv.is_owned = (val & 1) || (val == 0);
12632 // Warning: we may need a move here but can't clone!
12633 ChannelInfo_set_features(&this_ptr_conv, val_conv);
12636 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
12637 LDKChannelInfo this_ptr_conv;
12638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12639 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12640 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12641 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
12645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12646 LDKChannelInfo this_ptr_conv;
12647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12648 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12649 LDKPublicKey val_ref;
12650 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12651 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12652 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
12655 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
12656 LDKChannelInfo this_ptr_conv;
12657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12658 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12659 LDKDirectionalChannelInfo ret = ChannelInfo_get_one_to_two(&this_ptr_conv);
12660 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12664 LDKChannelInfo this_ptr_conv;
12665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12666 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12667 LDKDirectionalChannelInfo val_conv;
12668 val_conv.inner = (void*)(val & (~1));
12669 val_conv.is_owned = (val & 1) || (val == 0);
12670 // Warning: we may need a move here but can't clone!
12671 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
12674 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
12675 LDKChannelInfo this_ptr_conv;
12676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12677 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12678 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12679 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
12683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12684 LDKChannelInfo this_ptr_conv;
12685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12686 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12687 LDKPublicKey val_ref;
12688 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12689 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12690 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
12693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
12694 LDKChannelInfo this_ptr_conv;
12695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12696 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12697 LDKDirectionalChannelInfo ret = ChannelInfo_get_two_to_one(&this_ptr_conv);
12698 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12702 LDKChannelInfo this_ptr_conv;
12703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12704 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12705 LDKDirectionalChannelInfo val_conv;
12706 val_conv.inner = (void*)(val & (~1));
12707 val_conv.is_owned = (val & 1) || (val == 0);
12708 // Warning: we may need a move here but can't clone!
12709 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
12712 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
12713 LDKChannelInfo this_ptr_conv;
12714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12715 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12716 LDKChannelAnnouncement ret = ChannelInfo_get_announcement_message(&this_ptr_conv);
12717 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12721 LDKChannelInfo this_ptr_conv;
12722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12724 LDKChannelAnnouncement val_conv;
12725 val_conv.inner = (void*)(val & (~1));
12726 val_conv.is_owned = (val & 1) || (val == 0);
12727 if (val_conv.inner != NULL)
12728 val_conv = ChannelAnnouncement_clone(&val_conv);
12729 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
12732 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12733 LDKChannelInfo obj_conv;
12734 obj_conv.inner = (void*)(obj & (~1));
12735 obj_conv.is_owned = (obj & 1) || (obj == 0);
12736 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
12737 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12738 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12739 CVec_u8Z_free(arg_var);
12743 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12744 LDKu8slice ser_ref;
12745 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12746 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12747 LDKChannelInfo ret = ChannelInfo_read(ser_ref);
12748 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12749 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12753 LDKRoutingFees this_ptr_conv;
12754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12755 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12756 RoutingFees_free(this_ptr_conv);
12759 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12760 LDKRoutingFees orig_conv;
12761 orig_conv.inner = (void*)(orig & (~1));
12762 orig_conv.is_owned = (orig & 1) || (orig == 0);
12763 LDKRoutingFees ret = RoutingFees_clone(&orig_conv);
12764 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12767 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12768 LDKRoutingFees this_ptr_conv;
12769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12770 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12771 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
12775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12776 LDKRoutingFees this_ptr_conv;
12777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12778 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12779 RoutingFees_set_base_msat(&this_ptr_conv, val);
12782 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
12783 LDKRoutingFees this_ptr_conv;
12784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12785 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12786 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
12790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12791 LDKRoutingFees this_ptr_conv;
12792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12793 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12794 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
12797 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
12798 LDKRoutingFees ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
12799 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12802 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12803 LDKu8slice ser_ref;
12804 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12805 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12806 LDKRoutingFees ret = RoutingFees_read(ser_ref);
12807 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12808 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12811 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
12812 LDKRoutingFees obj_conv;
12813 obj_conv.inner = (void*)(obj & (~1));
12814 obj_conv.is_owned = (obj & 1) || (obj == 0);
12815 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
12816 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12817 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12818 CVec_u8Z_free(arg_var);
12822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12823 LDKNodeAnnouncementInfo this_ptr_conv;
12824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12825 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12826 NodeAnnouncementInfo_free(this_ptr_conv);
12829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12830 LDKNodeAnnouncementInfo this_ptr_conv;
12831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12832 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12833 LDKNodeFeatures ret = NodeAnnouncementInfo_get_features(&this_ptr_conv);
12834 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12838 LDKNodeAnnouncementInfo this_ptr_conv;
12839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12840 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12841 LDKNodeFeatures val_conv;
12842 val_conv.inner = (void*)(val & (~1));
12843 val_conv.is_owned = (val & 1) || (val == 0);
12844 // Warning: we may need a move here but can't clone!
12845 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
12848 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
12849 LDKNodeAnnouncementInfo this_ptr_conv;
12850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12851 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12852 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
12856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12857 LDKNodeAnnouncementInfo this_ptr_conv;
12858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12859 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12860 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
12863 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
12864 LDKNodeAnnouncementInfo this_ptr_conv;
12865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12866 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12867 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
12868 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
12872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12873 LDKNodeAnnouncementInfo this_ptr_conv;
12874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12875 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12876 LDKThreeBytes val_ref;
12877 CHECK((*_env)->GetArrayLength (_env, val) == 3);
12878 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
12879 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
12882 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
12883 LDKNodeAnnouncementInfo this_ptr_conv;
12884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12885 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12886 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12887 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
12891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12892 LDKNodeAnnouncementInfo this_ptr_conv;
12893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12894 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12895 LDKThirtyTwoBytes val_ref;
12896 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12897 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12898 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
12901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
12902 LDKNodeAnnouncementInfo this_ptr_conv;
12903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12905 LDKCVec_NetAddressZ val_constr;
12906 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12907 if (val_constr.datalen > 0)
12908 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12910 val_constr.data = NULL;
12911 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
12912 for (size_t m = 0; m < val_constr.datalen; m++) {
12913 long arr_conv_12 = val_vals[m];
12914 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
12915 FREE((void*)arr_conv_12);
12916 val_constr.data[m] = arr_conv_12_conv;
12918 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
12919 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
12922 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
12923 LDKNodeAnnouncementInfo this_ptr_conv;
12924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12925 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12926 LDKNodeAnnouncement ret = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
12927 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12931 LDKNodeAnnouncementInfo this_ptr_conv;
12932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12933 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12934 LDKNodeAnnouncement val_conv;
12935 val_conv.inner = (void*)(val & (~1));
12936 val_conv.is_owned = (val & 1) || (val == 0);
12937 if (val_conv.inner != NULL)
12938 val_conv = NodeAnnouncement_clone(&val_conv);
12939 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
12942 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) {
12943 LDKNodeFeatures features_arg_conv;
12944 features_arg_conv.inner = (void*)(features_arg & (~1));
12945 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
12946 // Warning: we may need a move here but can't clone!
12947 LDKThreeBytes rgb_arg_ref;
12948 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
12949 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
12950 LDKThirtyTwoBytes alias_arg_ref;
12951 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
12952 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
12953 LDKCVec_NetAddressZ addresses_arg_constr;
12954 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
12955 if (addresses_arg_constr.datalen > 0)
12956 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12958 addresses_arg_constr.data = NULL;
12959 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
12960 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
12961 long arr_conv_12 = addresses_arg_vals[m];
12962 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
12963 FREE((void*)arr_conv_12);
12964 addresses_arg_constr.data[m] = arr_conv_12_conv;
12966 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
12967 LDKNodeAnnouncement announcement_message_arg_conv;
12968 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
12969 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
12970 if (announcement_message_arg_conv.inner != NULL)
12971 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
12972 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
12973 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12976 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12977 LDKNodeAnnouncementInfo obj_conv;
12978 obj_conv.inner = (void*)(obj & (~1));
12979 obj_conv.is_owned = (obj & 1) || (obj == 0);
12980 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
12981 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12982 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12983 CVec_u8Z_free(arg_var);
12987 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12988 LDKu8slice ser_ref;
12989 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12990 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12991 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_read(ser_ref);
12992 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12993 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12997 LDKNodeInfo this_ptr_conv;
12998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12999 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13000 NodeInfo_free(this_ptr_conv);
13003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
13004 LDKNodeInfo this_ptr_conv;
13005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13006 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13007 LDKCVec_u64Z val_constr;
13008 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13009 if (val_constr.datalen > 0)
13010 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
13012 val_constr.data = NULL;
13013 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
13014 for (size_t g = 0; g < val_constr.datalen; g++) {
13015 long arr_conv_6 = val_vals[g];
13016 val_constr.data[g] = arr_conv_6;
13018 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
13019 NodeInfo_set_channels(&this_ptr_conv, val_constr);
13022 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
13023 LDKNodeInfo this_ptr_conv;
13024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13025 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13026 LDKRoutingFees ret = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
13027 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13031 LDKNodeInfo this_ptr_conv;
13032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13034 LDKRoutingFees val_conv;
13035 val_conv.inner = (void*)(val & (~1));
13036 val_conv.is_owned = (val & 1) || (val == 0);
13037 if (val_conv.inner != NULL)
13038 val_conv = RoutingFees_clone(&val_conv);
13039 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
13042 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 LDKNodeAnnouncementInfo ret = NodeInfo_get_announcement_info(&this_ptr_conv);
13047 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13051 LDKNodeInfo this_ptr_conv;
13052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13053 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13054 LDKNodeAnnouncementInfo val_conv;
13055 val_conv.inner = (void*)(val & (~1));
13056 val_conv.is_owned = (val & 1) || (val == 0);
13057 // Warning: we may need a move here but can't clone!
13058 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
13061 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) {
13062 LDKCVec_u64Z channels_arg_constr;
13063 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
13064 if (channels_arg_constr.datalen > 0)
13065 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
13067 channels_arg_constr.data = NULL;
13068 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
13069 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
13070 long arr_conv_6 = channels_arg_vals[g];
13071 channels_arg_constr.data[g] = arr_conv_6;
13073 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
13074 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
13075 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
13076 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
13077 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
13078 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
13079 LDKNodeAnnouncementInfo announcement_info_arg_conv;
13080 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
13081 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
13082 // Warning: we may need a move here but can't clone!
13083 LDKNodeInfo ret = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
13084 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13087 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13088 LDKNodeInfo obj_conv;
13089 obj_conv.inner = (void*)(obj & (~1));
13090 obj_conv.is_owned = (obj & 1) || (obj == 0);
13091 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
13092 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13093 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13094 CVec_u8Z_free(arg_var);
13098 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13099 LDKu8slice ser_ref;
13100 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13101 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13102 LDKNodeInfo ret = NodeInfo_read(ser_ref);
13103 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13104 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13107 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
13108 LDKNetworkGraph obj_conv;
13109 obj_conv.inner = (void*)(obj & (~1));
13110 obj_conv.is_owned = (obj & 1) || (obj == 0);
13111 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
13112 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13113 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13114 CVec_u8Z_free(arg_var);
13118 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13119 LDKu8slice ser_ref;
13120 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13121 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13122 LDKNetworkGraph ret = NetworkGraph_read(ser_ref);
13123 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13124 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13127 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
13128 LDKNetworkGraph ret = NetworkGraph_new();
13129 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13132 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) {
13133 LDKNetworkGraph this_arg_conv;
13134 this_arg_conv.inner = (void*)(this_arg & (~1));
13135 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13136 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);