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);
2712 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2713 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2714 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2715 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2719 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) {
2720 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2721 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2722 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2726 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2727 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2728 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2729 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2733 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2734 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2735 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2736 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2737 for (size_t i = 0; i < vec->datalen; i++) {
2738 CHECK((((long)vec->data[i].inner) & 1) == 0);
2739 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2741 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2744 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2745 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2746 ret->datalen = (*env)->GetArrayLength(env, elems);
2747 if (ret->datalen == 0) {
2750 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2751 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2752 for (size_t i = 0; i < ret->datalen; i++) {
2753 jlong arr_elem = java_elems[i];
2754 LDKChannelDetails arr_elem_conv;
2755 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2756 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2757 if (arr_elem_conv.inner != NULL)
2758 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2759 ret->data[i] = arr_elem_conv;
2761 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2765 static jclass LDKNetAddress_IPv4_class = NULL;
2766 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2767 static jclass LDKNetAddress_IPv6_class = NULL;
2768 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2769 static jclass LDKNetAddress_OnionV2_class = NULL;
2770 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2771 static jclass LDKNetAddress_OnionV3_class = NULL;
2772 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2774 LDKNetAddress_IPv4_class =
2775 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2776 CHECK(LDKNetAddress_IPv4_class != NULL);
2777 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2778 CHECK(LDKNetAddress_IPv4_meth != NULL);
2779 LDKNetAddress_IPv6_class =
2780 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2781 CHECK(LDKNetAddress_IPv6_class != NULL);
2782 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2783 CHECK(LDKNetAddress_IPv6_meth != NULL);
2784 LDKNetAddress_OnionV2_class =
2785 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2786 CHECK(LDKNetAddress_OnionV2_class != NULL);
2787 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2788 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2789 LDKNetAddress_OnionV3_class =
2790 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2791 CHECK(LDKNetAddress_OnionV3_class != NULL);
2792 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2793 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2795 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
2796 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2798 case LDKNetAddress_IPv4: {
2799 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 4);
2800 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 4, obj->i_pv4.addr.data);
2801 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
2803 case LDKNetAddress_IPv6: {
2804 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 16);
2805 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 16, obj->i_pv6.addr.data);
2806 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
2808 case LDKNetAddress_OnionV2: {
2809 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 10);
2810 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 10, obj->onion_v2.addr.data);
2811 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
2813 case LDKNetAddress_OnionV3: {
2814 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
2815 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2816 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);
2821 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2822 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2823 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2825 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2826 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2827 ret->datalen = (*env)->GetArrayLength(env, elems);
2828 if (ret->datalen == 0) {
2831 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2832 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2833 for (size_t i = 0; i < ret->datalen; i++) {
2834 jlong arr_elem = java_elems[i];
2835 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2836 FREE((void*)arr_elem);
2837 ret->data[i] = arr_elem_conv;
2839 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2843 typedef struct LDKChannelMessageHandler_JCalls {
2844 atomic_size_t refcnt;
2847 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2848 jmethodID handle_open_channel_meth;
2849 jmethodID handle_accept_channel_meth;
2850 jmethodID handle_funding_created_meth;
2851 jmethodID handle_funding_signed_meth;
2852 jmethodID handle_funding_locked_meth;
2853 jmethodID handle_shutdown_meth;
2854 jmethodID handle_closing_signed_meth;
2855 jmethodID handle_update_add_htlc_meth;
2856 jmethodID handle_update_fulfill_htlc_meth;
2857 jmethodID handle_update_fail_htlc_meth;
2858 jmethodID handle_update_fail_malformed_htlc_meth;
2859 jmethodID handle_commitment_signed_meth;
2860 jmethodID handle_revoke_and_ack_meth;
2861 jmethodID handle_update_fee_meth;
2862 jmethodID handle_announcement_signatures_meth;
2863 jmethodID peer_disconnected_meth;
2864 jmethodID peer_connected_meth;
2865 jmethodID handle_channel_reestablish_meth;
2866 jmethodID handle_error_meth;
2867 } LDKChannelMessageHandler_JCalls;
2868 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
2869 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2871 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2872 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2873 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2874 LDKInitFeatures their_features_var = their_features;
2875 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2876 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2877 long their_features_ref;
2878 if (their_features_var.is_owned) {
2879 their_features_ref = (long)their_features_var.inner | 1;
2881 their_features_ref = (long)their_features_var.inner & ~1;
2883 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2885 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg);
2887 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
2888 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2890 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2891 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2892 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2893 LDKInitFeatures their_features_var = their_features;
2894 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2895 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2896 long their_features_ref;
2897 if (their_features_var.is_owned) {
2898 their_features_ref = (long)their_features_var.inner | 1;
2900 their_features_ref = (long)their_features_var.inner & ~1;
2902 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2904 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg);
2906 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
2907 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2909 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2910 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2911 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2912 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2914 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg);
2916 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
2917 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2919 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2920 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2921 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2922 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2924 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg);
2926 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
2927 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2929 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2930 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2931 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2932 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2934 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg);
2936 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
2937 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2939 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2940 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2941 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2942 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2944 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg);
2946 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
2947 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2949 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2950 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2951 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2952 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2954 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg);
2956 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
2957 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2959 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2960 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2961 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2962 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2964 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg);
2966 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
2967 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2969 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2970 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2971 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2972 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2974 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg);
2976 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
2977 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2979 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2980 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2981 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2982 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2984 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg);
2986 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
2987 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2989 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2990 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2991 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2992 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2994 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg);
2996 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
2997 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2999 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3000 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3001 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3002 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3004 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg);
3006 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
3007 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3009 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3010 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3011 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3012 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3014 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg);
3016 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
3017 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3019 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3020 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3021 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3022 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3024 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg);
3026 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
3027 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3029 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3030 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3031 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3032 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3034 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg);
3036 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3037 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3039 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3040 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3041 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3042 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3044 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
3046 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
3047 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3049 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3050 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3051 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3052 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3054 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg);
3056 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3057 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3059 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3060 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3061 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3062 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3064 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg);
3066 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
3067 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3069 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3070 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3071 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3072 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3074 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, msg);
3076 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3077 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3078 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3080 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3081 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3085 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3086 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3087 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3088 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3089 return (void*) this_arg;
3091 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3092 jclass c = (*env)->GetObjectClass(env, o);
3094 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3095 atomic_init(&calls->refcnt, 1);
3096 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3097 calls->o = (*env)->NewWeakGlobalRef(env, o);
3098 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3099 CHECK(calls->handle_open_channel_meth != NULL);
3100 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3101 CHECK(calls->handle_accept_channel_meth != NULL);
3102 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3103 CHECK(calls->handle_funding_created_meth != NULL);
3104 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3105 CHECK(calls->handle_funding_signed_meth != NULL);
3106 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3107 CHECK(calls->handle_funding_locked_meth != NULL);
3108 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3109 CHECK(calls->handle_shutdown_meth != NULL);
3110 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3111 CHECK(calls->handle_closing_signed_meth != NULL);
3112 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3113 CHECK(calls->handle_update_add_htlc_meth != NULL);
3114 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3115 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3116 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3117 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3118 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3119 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3120 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3121 CHECK(calls->handle_commitment_signed_meth != NULL);
3122 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3123 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3124 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3125 CHECK(calls->handle_update_fee_meth != NULL);
3126 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3127 CHECK(calls->handle_announcement_signatures_meth != NULL);
3128 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3129 CHECK(calls->peer_disconnected_meth != NULL);
3130 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3131 CHECK(calls->peer_connected_meth != NULL);
3132 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3133 CHECK(calls->handle_channel_reestablish_meth != NULL);
3134 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3135 CHECK(calls->handle_error_meth != NULL);
3137 LDKChannelMessageHandler ret = {
3138 .this_arg = (void*) calls,
3139 .handle_open_channel = handle_open_channel_jcall,
3140 .handle_accept_channel = handle_accept_channel_jcall,
3141 .handle_funding_created = handle_funding_created_jcall,
3142 .handle_funding_signed = handle_funding_signed_jcall,
3143 .handle_funding_locked = handle_funding_locked_jcall,
3144 .handle_shutdown = handle_shutdown_jcall,
3145 .handle_closing_signed = handle_closing_signed_jcall,
3146 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3147 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3148 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3149 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3150 .handle_commitment_signed = handle_commitment_signed_jcall,
3151 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3152 .handle_update_fee = handle_update_fee_jcall,
3153 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3154 .peer_disconnected = peer_disconnected_jcall,
3155 .peer_connected = peer_connected_jcall,
3156 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3157 .handle_error = handle_error_jcall,
3158 .free = LDKChannelMessageHandler_JCalls_free,
3159 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3161 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3164 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3165 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3166 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3167 return (long)res_ptr;
3169 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3170 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3174 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) {
3175 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3176 LDKPublicKey their_node_id_ref;
3177 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3178 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3179 LDKInitFeatures their_features_conv;
3180 their_features_conv.inner = (void*)(their_features & (~1));
3181 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3182 // Warning: we may need a move here but can't clone!
3183 LDKOpenChannel msg_conv;
3184 msg_conv.inner = (void*)(msg & (~1));
3185 msg_conv.is_owned = (msg & 1) || (msg == 0);
3186 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3189 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) {
3190 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3191 LDKPublicKey their_node_id_ref;
3192 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3193 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3194 LDKInitFeatures their_features_conv;
3195 their_features_conv.inner = (void*)(their_features & (~1));
3196 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3197 // Warning: we may need a move here but can't clone!
3198 LDKAcceptChannel msg_conv;
3199 msg_conv.inner = (void*)(msg & (~1));
3200 msg_conv.is_owned = (msg & 1) || (msg == 0);
3201 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3204 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) {
3205 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3206 LDKPublicKey their_node_id_ref;
3207 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3208 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3209 LDKFundingCreated msg_conv;
3210 msg_conv.inner = (void*)(msg & (~1));
3211 msg_conv.is_owned = (msg & 1) || (msg == 0);
3212 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3215 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) {
3216 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3217 LDKPublicKey their_node_id_ref;
3218 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3219 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3220 LDKFundingSigned msg_conv;
3221 msg_conv.inner = (void*)(msg & (~1));
3222 msg_conv.is_owned = (msg & 1) || (msg == 0);
3223 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3226 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) {
3227 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3228 LDKPublicKey their_node_id_ref;
3229 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3230 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3231 LDKFundingLocked msg_conv;
3232 msg_conv.inner = (void*)(msg & (~1));
3233 msg_conv.is_owned = (msg & 1) || (msg == 0);
3234 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3238 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3239 LDKPublicKey their_node_id_ref;
3240 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3241 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3242 LDKShutdown msg_conv;
3243 msg_conv.inner = (void*)(msg & (~1));
3244 msg_conv.is_owned = (msg & 1) || (msg == 0);
3245 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3248 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) {
3249 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3250 LDKPublicKey their_node_id_ref;
3251 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3252 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3253 LDKClosingSigned msg_conv;
3254 msg_conv.inner = (void*)(msg & (~1));
3255 msg_conv.is_owned = (msg & 1) || (msg == 0);
3256 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3259 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) {
3260 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3261 LDKPublicKey their_node_id_ref;
3262 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3263 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3264 LDKUpdateAddHTLC msg_conv;
3265 msg_conv.inner = (void*)(msg & (~1));
3266 msg_conv.is_owned = (msg & 1) || (msg == 0);
3267 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3270 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) {
3271 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3272 LDKPublicKey their_node_id_ref;
3273 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3274 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3275 LDKUpdateFulfillHTLC msg_conv;
3276 msg_conv.inner = (void*)(msg & (~1));
3277 msg_conv.is_owned = (msg & 1) || (msg == 0);
3278 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3281 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) {
3282 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3283 LDKPublicKey their_node_id_ref;
3284 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3285 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3286 LDKUpdateFailHTLC msg_conv;
3287 msg_conv.inner = (void*)(msg & (~1));
3288 msg_conv.is_owned = (msg & 1) || (msg == 0);
3289 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3292 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) {
3293 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3294 LDKPublicKey their_node_id_ref;
3295 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3296 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3297 LDKUpdateFailMalformedHTLC msg_conv;
3298 msg_conv.inner = (void*)(msg & (~1));
3299 msg_conv.is_owned = (msg & 1) || (msg == 0);
3300 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3303 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) {
3304 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3305 LDKPublicKey their_node_id_ref;
3306 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3307 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3308 LDKCommitmentSigned msg_conv;
3309 msg_conv.inner = (void*)(msg & (~1));
3310 msg_conv.is_owned = (msg & 1) || (msg == 0);
3311 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3314 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) {
3315 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3316 LDKPublicKey their_node_id_ref;
3317 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3318 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3319 LDKRevokeAndACK msg_conv;
3320 msg_conv.inner = (void*)(msg & (~1));
3321 msg_conv.is_owned = (msg & 1) || (msg == 0);
3322 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3325 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) {
3326 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3327 LDKPublicKey their_node_id_ref;
3328 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3329 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3330 LDKUpdateFee msg_conv;
3331 msg_conv.inner = (void*)(msg & (~1));
3332 msg_conv.is_owned = (msg & 1) || (msg == 0);
3333 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3336 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) {
3337 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3338 LDKPublicKey their_node_id_ref;
3339 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3340 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3341 LDKAnnouncementSignatures msg_conv;
3342 msg_conv.inner = (void*)(msg & (~1));
3343 msg_conv.is_owned = (msg & 1) || (msg == 0);
3344 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3347 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) {
3348 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3349 LDKPublicKey their_node_id_ref;
3350 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3351 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3352 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3356 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3357 LDKPublicKey their_node_id_ref;
3358 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3359 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3361 msg_conv.inner = (void*)(msg & (~1));
3362 msg_conv.is_owned = (msg & 1) || (msg == 0);
3363 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3366 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) {
3367 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3368 LDKPublicKey their_node_id_ref;
3369 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3370 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3371 LDKChannelReestablish msg_conv;
3372 msg_conv.inner = (void*)(msg & (~1));
3373 msg_conv.is_owned = (msg & 1) || (msg == 0);
3374 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3378 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3379 LDKPublicKey their_node_id_ref;
3380 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3381 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3382 LDKErrorMessage msg_conv;
3383 msg_conv.inner = (void*)(msg & (~1));
3384 msg_conv.is_owned = (msg & 1) || (msg == 0);
3385 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3388 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3389 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3390 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3391 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3392 for (size_t i = 0; i < vec->datalen; i++) {
3393 CHECK((((long)vec->data[i].inner) & 1) == 0);
3394 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3396 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3399 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3400 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3401 ret->datalen = (*env)->GetArrayLength(env, elems);
3402 if (ret->datalen == 0) {
3405 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3406 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3407 for (size_t i = 0; i < ret->datalen; i++) {
3408 jlong arr_elem = java_elems[i];
3409 LDKChannelMonitor arr_elem_conv;
3410 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3411 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3412 // Warning: we may need a move here but can't clone!
3413 ret->data[i] = arr_elem_conv;
3415 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3419 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3420 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3421 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3423 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3424 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3425 ret->datalen = (*env)->GetArrayLength(env, elems);
3426 if (ret->datalen == 0) {
3429 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3430 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3431 for (size_t i = 0; i < ret->datalen; i++) {
3432 ret->data[i] = java_elems[i];
3434 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3438 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3439 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3440 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3441 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3442 for (size_t i = 0; i < vec->datalen; i++) {
3443 CHECK((((long)vec->data[i].inner) & 1) == 0);
3444 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3446 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3449 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3450 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3451 ret->datalen = (*env)->GetArrayLength(env, elems);
3452 if (ret->datalen == 0) {
3455 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3456 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3457 for (size_t i = 0; i < ret->datalen; i++) {
3458 jlong arr_elem = java_elems[i];
3459 LDKUpdateAddHTLC arr_elem_conv;
3460 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3461 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3462 if (arr_elem_conv.inner != NULL)
3463 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3464 ret->data[i] = arr_elem_conv;
3466 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3470 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3471 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3472 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3473 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3474 for (size_t i = 0; i < vec->datalen; i++) {
3475 CHECK((((long)vec->data[i].inner) & 1) == 0);
3476 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3478 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3481 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3482 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3483 ret->datalen = (*env)->GetArrayLength(env, elems);
3484 if (ret->datalen == 0) {
3487 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3488 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3489 for (size_t i = 0; i < ret->datalen; i++) {
3490 jlong arr_elem = java_elems[i];
3491 LDKUpdateFulfillHTLC arr_elem_conv;
3492 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3493 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3494 if (arr_elem_conv.inner != NULL)
3495 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3496 ret->data[i] = arr_elem_conv;
3498 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3502 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3503 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3504 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3505 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3506 for (size_t i = 0; i < vec->datalen; i++) {
3507 CHECK((((long)vec->data[i].inner) & 1) == 0);
3508 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3510 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3513 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3514 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3515 ret->datalen = (*env)->GetArrayLength(env, elems);
3516 if (ret->datalen == 0) {
3519 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3520 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3521 for (size_t i = 0; i < ret->datalen; i++) {
3522 jlong arr_elem = java_elems[i];
3523 LDKUpdateFailHTLC arr_elem_conv;
3524 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3525 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3526 if (arr_elem_conv.inner != NULL)
3527 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3528 ret->data[i] = arr_elem_conv;
3530 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3534 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3535 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3536 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3537 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3538 for (size_t i = 0; i < vec->datalen; i++) {
3539 CHECK((((long)vec->data[i].inner) & 1) == 0);
3540 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3542 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3545 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3546 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3547 ret->datalen = (*env)->GetArrayLength(env, elems);
3548 if (ret->datalen == 0) {
3551 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3552 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3553 for (size_t i = 0; i < ret->datalen; i++) {
3554 jlong arr_elem = java_elems[i];
3555 LDKUpdateFailMalformedHTLC arr_elem_conv;
3556 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3557 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3558 if (arr_elem_conv.inner != NULL)
3559 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3560 ret->data[i] = arr_elem_conv;
3562 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3567 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3569 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3570 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3571 CHECK(val->result_ok);
3572 return *val->contents.result;
3574 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3575 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3576 CHECK(!val->result_ok);
3577 LDKLightningError err_var = (*val->contents.err);
3578 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3579 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3580 long err_ref = (long)err_var.inner & ~1;
3583 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3584 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3585 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3587 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3588 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3589 ret->datalen = (*env)->GetArrayLength(env, elems);
3590 if (ret->datalen == 0) {
3593 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3594 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3595 for (size_t i = 0; i < ret->datalen; i++) {
3596 jlong arr_elem = java_elems[i];
3597 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3598 FREE((void*)arr_elem);
3599 ret->data[i] = arr_elem_conv;
3601 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3605 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3606 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3607 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3608 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3609 for (size_t i = 0; i < vec->datalen; i++) {
3610 CHECK((((long)vec->data[i].inner) & 1) == 0);
3611 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3613 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3616 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3617 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3618 ret->datalen = (*env)->GetArrayLength(env, elems);
3619 if (ret->datalen == 0) {
3622 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3623 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3624 for (size_t i = 0; i < ret->datalen; i++) {
3625 jlong arr_elem = java_elems[i];
3626 LDKNodeAnnouncement arr_elem_conv;
3627 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3628 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3629 if (arr_elem_conv.inner != NULL)
3630 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3631 ret->data[i] = arr_elem_conv;
3633 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3637 typedef struct LDKRoutingMessageHandler_JCalls {
3638 atomic_size_t refcnt;
3641 jmethodID handle_node_announcement_meth;
3642 jmethodID handle_channel_announcement_meth;
3643 jmethodID handle_channel_update_meth;
3644 jmethodID handle_htlc_fail_channel_update_meth;
3645 jmethodID get_next_channel_announcements_meth;
3646 jmethodID get_next_node_announcements_meth;
3647 jmethodID should_request_full_sync_meth;
3648 } LDKRoutingMessageHandler_JCalls;
3649 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3650 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3652 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3653 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3655 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, msg);
3656 LDKCResult_boolLightningErrorZ res = *ret;
3660 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3661 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3663 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3664 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3666 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, msg);
3667 LDKCResult_boolLightningErrorZ res = *ret;
3671 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3672 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3674 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3675 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3677 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, msg);
3678 LDKCResult_boolLightningErrorZ res = *ret;
3682 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3683 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3685 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3686 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3688 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, update);
3690 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3691 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3693 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3694 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3696 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3697 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
3698 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
3699 if (ret_constr.datalen > 0)
3700 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
3702 ret_constr.data = NULL;
3703 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
3704 for (size_t l = 0; l < ret_constr.datalen; l++) {
3705 long arr_conv_63 = ret_vals[l];
3706 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
3707 FREE((void*)arr_conv_63);
3708 ret_constr.data[l] = arr_conv_63_conv;
3710 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
3713 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3714 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3716 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3717 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
3718 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
3719 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3721 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3722 LDKCVec_NodeAnnouncementZ ret_constr;
3723 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
3724 if (ret_constr.datalen > 0)
3725 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
3727 ret_constr.data = NULL;
3728 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
3729 for (size_t s = 0; s < ret_constr.datalen; s++) {
3730 long arr_conv_18 = ret_vals[s];
3731 LDKNodeAnnouncement arr_conv_18_conv;
3732 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
3733 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
3734 if (arr_conv_18_conv.inner != NULL)
3735 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
3736 ret_constr.data[s] = arr_conv_18_conv;
3738 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
3741 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3742 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3744 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3745 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
3746 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form);
3747 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3749 return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3751 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3752 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3753 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3755 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3756 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3760 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3761 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3762 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3763 return (void*) this_arg;
3765 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3766 jclass c = (*env)->GetObjectClass(env, o);
3768 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3769 atomic_init(&calls->refcnt, 1);
3770 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3771 calls->o = (*env)->NewWeakGlobalRef(env, o);
3772 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3773 CHECK(calls->handle_node_announcement_meth != NULL);
3774 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3775 CHECK(calls->handle_channel_announcement_meth != NULL);
3776 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3777 CHECK(calls->handle_channel_update_meth != NULL);
3778 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3779 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
3780 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
3781 CHECK(calls->get_next_channel_announcements_meth != NULL);
3782 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
3783 CHECK(calls->get_next_node_announcements_meth != NULL);
3784 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3785 CHECK(calls->should_request_full_sync_meth != NULL);
3787 LDKRoutingMessageHandler ret = {
3788 .this_arg = (void*) calls,
3789 .handle_node_announcement = handle_node_announcement_jcall,
3790 .handle_channel_announcement = handle_channel_announcement_jcall,
3791 .handle_channel_update = handle_channel_update_jcall,
3792 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3793 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3794 .get_next_node_announcements = get_next_node_announcements_jcall,
3795 .should_request_full_sync = should_request_full_sync_jcall,
3796 .free = LDKRoutingMessageHandler_JCalls_free,
3800 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3801 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3802 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3803 return (long)res_ptr;
3805 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3806 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3810 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3811 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3812 LDKNodeAnnouncement msg_conv;
3813 msg_conv.inner = (void*)(msg & (~1));
3814 msg_conv.is_owned = (msg & 1) || (msg == 0);
3815 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3816 *ret = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
3820 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3821 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3822 LDKChannelAnnouncement msg_conv;
3823 msg_conv.inner = (void*)(msg & (~1));
3824 msg_conv.is_owned = (msg & 1) || (msg == 0);
3825 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3826 *ret = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3830 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3831 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3832 LDKChannelUpdate msg_conv;
3833 msg_conv.inner = (void*)(msg & (~1));
3834 msg_conv.is_owned = (msg & 1) || (msg == 0);
3835 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3836 *ret = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
3840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
3841 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3842 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3843 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
3846 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) {
3847 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3848 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
3849 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
3850 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
3851 for (size_t l = 0; l < ret_var.datalen; l++) {
3852 /*XXX False */long arr_conv_63_ref = (long)&ret_var.data[l];
3853 ret_arr_ptr[l] = arr_conv_63_ref;
3855 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
3856 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(ret_var);
3860 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) {
3861 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3862 LDKPublicKey starting_point_ref;
3863 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
3864 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
3865 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
3866 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
3867 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
3868 for (size_t s = 0; s < ret_var.datalen; s++) {
3869 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
3870 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3871 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3872 long arr_conv_18_ref;
3873 if (arr_conv_18_var.is_owned) {
3874 arr_conv_18_ref = (long)arr_conv_18_var.inner | 1;
3876 arr_conv_18_ref = (long)arr_conv_18_var.inner & ~1;
3878 ret_arr_ptr[s] = arr_conv_18_ref;
3880 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
3885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
3886 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3887 LDKPublicKey node_id_ref;
3888 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
3889 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
3890 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
3894 typedef struct LDKSocketDescriptor_JCalls {
3895 atomic_size_t refcnt;
3898 jmethodID send_data_meth;
3899 jmethodID disconnect_socket_meth;
3901 jmethodID hash_meth;
3902 } LDKSocketDescriptor_JCalls;
3903 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
3904 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3906 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3907 LDKu8slice data_var = data;
3908 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
3909 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
3910 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3912 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
3914 void disconnect_socket_jcall(void* this_arg) {
3915 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3917 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3918 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3920 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
3922 bool eq_jcall(const void* this_arg, const void *other_arg) {
3923 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3925 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3926 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3928 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, other_arg);
3930 uint64_t hash_jcall(const void* this_arg) {
3931 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3933 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3934 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3936 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
3938 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
3939 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3940 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3942 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3943 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3947 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
3948 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3949 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3950 return (void*) this_arg;
3952 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
3953 jclass c = (*env)->GetObjectClass(env, o);
3955 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
3956 atomic_init(&calls->refcnt, 1);
3957 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3958 calls->o = (*env)->NewWeakGlobalRef(env, o);
3959 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
3960 CHECK(calls->send_data_meth != NULL);
3961 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
3962 CHECK(calls->disconnect_socket_meth != NULL);
3963 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
3964 CHECK(calls->eq_meth != NULL);
3965 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
3966 CHECK(calls->hash_meth != NULL);
3968 LDKSocketDescriptor ret = {
3969 .this_arg = (void*) calls,
3970 .send_data = send_data_jcall,
3971 .disconnect_socket = disconnect_socket_jcall,
3974 .clone = LDKSocketDescriptor_JCalls_clone,
3975 .free = LDKSocketDescriptor_JCalls_free,
3979 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
3980 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
3981 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
3982 return (long)res_ptr;
3984 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3985 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
3989 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
3990 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3991 LDKu8slice data_ref;
3992 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
3993 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
3994 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
3995 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
3999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
4000 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4001 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4004 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
4005 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4006 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4010 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4011 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
4012 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
4014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4015 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4017 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4018 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4019 CHECK(val->result_ok);
4020 LDKCVecTempl_u8 res_var = (*val->contents.result);
4021 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
4022 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
4025 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4026 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4027 CHECK(!val->result_ok);
4028 LDKPeerHandleError err_var = (*val->contents.err);
4029 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4030 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4031 long err_ref = (long)err_var.inner & ~1;
4034 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4035 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4037 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4038 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4039 CHECK(val->result_ok);
4040 return *val->contents.result;
4042 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4043 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4044 CHECK(!val->result_ok);
4045 LDKPeerHandleError err_var = (*val->contents.err);
4046 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4047 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4048 long err_ref = (long)err_var.inner & ~1;
4051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4052 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
4054 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4055 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4056 CHECK(val->result_ok);
4057 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
4058 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
4061 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4062 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4063 CHECK(!val->result_ok);
4064 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4067 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4068 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
4070 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4071 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4072 CHECK(val->result_ok);
4073 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
4074 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
4077 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4078 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4079 CHECK(!val->result_ok);
4080 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4083 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4084 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
4086 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4087 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4088 CHECK(val->result_ok);
4089 LDKTxCreationKeys res_var = (*val->contents.result);
4090 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4091 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4092 long res_ref = (long)res_var.inner & ~1;
4095 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4096 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4097 CHECK(!val->result_ok);
4098 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4101 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4102 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4103 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4105 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4106 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4107 ret->datalen = (*env)->GetArrayLength(env, elems);
4108 if (ret->datalen == 0) {
4111 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4112 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4113 for (size_t i = 0; i < ret->datalen; i++) {
4114 jlong arr_elem = java_elems[i];
4115 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4116 FREE((void*)arr_elem);
4117 ret->data[i] = arr_elem_conv;
4119 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4123 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4124 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4125 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4126 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4127 for (size_t i = 0; i < vec->datalen; i++) {
4128 CHECK((((long)vec->data[i].inner) & 1) == 0);
4129 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4131 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4134 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4135 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4136 ret->datalen = (*env)->GetArrayLength(env, elems);
4137 if (ret->datalen == 0) {
4140 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4141 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4142 for (size_t i = 0; i < ret->datalen; i++) {
4143 jlong arr_elem = java_elems[i];
4144 LDKRouteHop arr_elem_conv;
4145 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4146 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4147 if (arr_elem_conv.inner != NULL)
4148 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4149 ret->data[i] = arr_elem_conv;
4151 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4155 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4156 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4157 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4159 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4160 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4162 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4163 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4164 CHECK(val->result_ok);
4165 LDKRoute res_var = (*val->contents.result);
4166 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4167 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4168 long res_ref = (long)res_var.inner & ~1;
4171 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4172 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4173 CHECK(!val->result_ok);
4174 LDKLightningError err_var = (*val->contents.err);
4175 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4176 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4177 long err_ref = (long)err_var.inner & ~1;
4180 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4181 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4182 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4183 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4184 for (size_t i = 0; i < vec->datalen; i++) {
4185 CHECK((((long)vec->data[i].inner) & 1) == 0);
4186 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4188 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4191 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4192 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4193 ret->datalen = (*env)->GetArrayLength(env, elems);
4194 if (ret->datalen == 0) {
4197 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4198 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4199 for (size_t i = 0; i < ret->datalen; i++) {
4200 jlong arr_elem = java_elems[i];
4201 LDKRouteHint arr_elem_conv;
4202 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4203 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4204 if (arr_elem_conv.inner != NULL)
4205 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4206 ret->data[i] = arr_elem_conv;
4208 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4213 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4215 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4219 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4221 C2Tuple_OutPointScriptZ_free(arg_conv);
4224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4225 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4227 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4231 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4233 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4237 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4239 C2Tuple_u64u64Z_free(arg_conv);
4242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4243 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4245 C2Tuple_usizeTransactionZ_free(arg_conv);
4248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4249 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4251 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4255 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4257 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4260 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4261 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4263 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4264 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4269 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4271 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4274 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray arg) {
4275 LDKCVec_SignatureZ arg_constr;
4276 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4277 if (arg_constr.datalen > 0)
4278 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4280 arg_constr.data = NULL;
4281 for (size_t i = 0; i < arg_constr.datalen; i++) {
4282 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4283 LDKSignature arr_conv_8_ref;
4284 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4285 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4286 arg_constr.data[i] = arr_conv_8_ref;
4288 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4289 *ret = CResult_CVec_SignatureZNoneZ_ok(arg_constr);
4293 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4294 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4296 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4297 *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4302 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4304 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4307 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4308 LDKCVec_u8Z arg_ref;
4309 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
4310 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4311 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4312 *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4313 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
4317 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4318 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4320 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4321 *ret = CResult_NoneAPIErrorZ_err(arg_conv);
4325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4326 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4328 CResult_NoneAPIErrorZ_free(arg_conv);
4331 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4332 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4334 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4335 *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4340 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4342 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4345 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4346 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4348 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4349 *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4354 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4356 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4359 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4360 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4362 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4363 *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
4367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4368 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4370 CResult_NonePaymentSendFailureZ_free(arg_conv);
4373 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4374 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4376 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4377 *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
4381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4382 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4384 CResult_NonePeerHandleErrorZ_free(arg_conv);
4387 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4388 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4390 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4391 *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
4395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4396 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4398 CResult_PublicKeySecpErrorZ_free(arg_conv);
4401 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4402 LDKPublicKey arg_ref;
4403 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4404 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4405 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4406 *ret = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4410 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4411 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4413 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4414 *ret = CResult_RouteLightningErrorZ_err(arg_conv);
4418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4419 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4421 CResult_RouteLightningErrorZ_free(arg_conv);
4424 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4425 LDKRoute arg_conv = *(LDKRoute*)arg;
4427 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4428 *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
4432 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4433 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4435 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4436 *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
4440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4441 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4443 CResult_SecretKeySecpErrorZ_free(arg_conv);
4446 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4447 LDKSecretKey arg_ref;
4448 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4449 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4450 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4451 *ret = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4456 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4458 CResult_SignatureNoneZ_free(arg_conv);
4461 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4462 LDKSignature arg_ref;
4463 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4464 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4465 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4466 *ret = CResult_SignatureNoneZ_ok(arg_ref);
4470 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4471 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4473 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4474 *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4479 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4481 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4484 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4485 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4487 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4488 *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4492 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4493 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4495 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4496 *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
4500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4501 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4503 CResult_TxOutAccessErrorZ_free(arg_conv);
4506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4507 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4509 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4510 *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
4514 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4515 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4517 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4518 *ret = CResult_boolLightningErrorZ_err(arg_conv);
4522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4523 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4525 CResult_boolLightningErrorZ_free(arg_conv);
4528 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4529 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4530 *ret = CResult_boolLightningErrorZ_ok(arg);
4534 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4535 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4537 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4538 *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
4542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4543 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4545 CResult_boolPeerHandleErrorZ_free(arg_conv);
4548 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4549 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4550 *ret = CResult_boolPeerHandleErrorZ_ok(arg);
4554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4555 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_constr;
4556 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4557 if (arg_constr.datalen > 0)
4558 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
4560 arg_constr.data = NULL;
4561 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4562 for (size_t q = 0; q < arg_constr.datalen; q++) {
4563 long arr_conv_42 = arg_vals[q];
4564 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
4565 FREE((void*)arr_conv_42);
4566 arg_constr.data[q] = arr_conv_42_conv;
4568 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4569 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_constr);
4572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4573 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_constr;
4574 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4575 if (arg_constr.datalen > 0)
4576 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ Elements");
4578 arg_constr.data = NULL;
4579 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4580 for (size_t b = 0; b < arg_constr.datalen; b++) {
4581 long arr_conv_27 = arg_vals[b];
4582 LDKC2Tuple_TxidCVec_TxOutZZ arr_conv_27_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arr_conv_27;
4583 FREE((void*)arr_conv_27);
4584 arg_constr.data[b] = arr_conv_27_conv;
4586 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4587 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_constr);
4590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4591 LDKCVec_C2Tuple_usizeTransactionZZ arg_constr;
4592 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4593 if (arg_constr.datalen > 0)
4594 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
4596 arg_constr.data = NULL;
4597 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4598 for (size_t d = 0; d < arg_constr.datalen; d++) {
4599 long arr_conv_29 = arg_vals[d];
4600 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
4601 FREE((void*)arr_conv_29);
4602 arg_constr.data[d] = arr_conv_29_conv;
4604 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4605 CVec_C2Tuple_usizeTransactionZZ_free(arg_constr);
4608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4609 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4610 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4611 if (arg_constr.datalen > 0)
4612 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4614 arg_constr.data = NULL;
4615 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4616 for (size_t l = 0; l < arg_constr.datalen; l++) {
4617 long arr_conv_63 = arg_vals[l];
4618 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4619 FREE((void*)arr_conv_63);
4620 arg_constr.data[l] = arr_conv_63_conv;
4622 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4623 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_constr);
4626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4627 LDKCVec_CVec_RouteHopZZ arg_constr;
4628 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4629 if (arg_constr.datalen > 0)
4630 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
4632 arg_constr.data = NULL;
4633 for (size_t m = 0; m < arg_constr.datalen; m++) {
4634 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, arg, m);
4635 LDKCVec_RouteHopZ arr_conv_12_constr;
4636 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
4637 if (arr_conv_12_constr.datalen > 0)
4638 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4640 arr_conv_12_constr.data = NULL;
4641 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
4642 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
4643 long arr_conv_10 = arr_conv_12_vals[k];
4644 LDKRouteHop arr_conv_10_conv;
4645 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4646 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4647 arr_conv_12_constr.data[k] = arr_conv_10_conv;
4649 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
4650 arg_constr.data[m] = arr_conv_12_constr;
4652 CVec_CVec_RouteHopZZ_free(arg_constr);
4655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4656 LDKCVec_ChannelDetailsZ arg_constr;
4657 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4658 if (arg_constr.datalen > 0)
4659 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
4661 arg_constr.data = NULL;
4662 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4663 for (size_t q = 0; q < arg_constr.datalen; q++) {
4664 long arr_conv_16 = arg_vals[q];
4665 LDKChannelDetails arr_conv_16_conv;
4666 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4667 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4668 arg_constr.data[q] = arr_conv_16_conv;
4670 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4671 CVec_ChannelDetailsZ_free(arg_constr);
4674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4675 LDKCVec_ChannelMonitorZ arg_constr;
4676 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4677 if (arg_constr.datalen > 0)
4678 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
4680 arg_constr.data = NULL;
4681 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4682 for (size_t q = 0; q < arg_constr.datalen; q++) {
4683 long arr_conv_16 = arg_vals[q];
4684 LDKChannelMonitor arr_conv_16_conv;
4685 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4686 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4687 arg_constr.data[q] = arr_conv_16_conv;
4689 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4690 CVec_ChannelMonitorZ_free(arg_constr);
4693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4694 LDKCVec_EventZ arg_constr;
4695 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4696 if (arg_constr.datalen > 0)
4697 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4699 arg_constr.data = NULL;
4700 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4701 for (size_t h = 0; h < arg_constr.datalen; h++) {
4702 long arr_conv_7 = arg_vals[h];
4703 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
4704 FREE((void*)arr_conv_7);
4705 arg_constr.data[h] = arr_conv_7_conv;
4707 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4708 CVec_EventZ_free(arg_constr);
4711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4712 LDKCVec_HTLCOutputInCommitmentZ arg_constr;
4713 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4714 if (arg_constr.datalen > 0)
4715 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
4717 arg_constr.data = NULL;
4718 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4719 for (size_t y = 0; y < arg_constr.datalen; y++) {
4720 long arr_conv_24 = arg_vals[y];
4721 LDKHTLCOutputInCommitment arr_conv_24_conv;
4722 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
4723 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
4724 arg_constr.data[y] = arr_conv_24_conv;
4726 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4727 CVec_HTLCOutputInCommitmentZ_free(arg_constr);
4730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4731 LDKCVec_MessageSendEventZ arg_constr;
4732 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4733 if (arg_constr.datalen > 0)
4734 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4736 arg_constr.data = NULL;
4737 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4738 for (size_t s = 0; s < arg_constr.datalen; s++) {
4739 long arr_conv_18 = arg_vals[s];
4740 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
4741 FREE((void*)arr_conv_18);
4742 arg_constr.data[s] = arr_conv_18_conv;
4744 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4745 CVec_MessageSendEventZ_free(arg_constr);
4748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4749 LDKCVec_MonitorEventZ arg_constr;
4750 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4751 if (arg_constr.datalen > 0)
4752 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
4754 arg_constr.data = NULL;
4755 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4756 for (size_t o = 0; o < arg_constr.datalen; o++) {
4757 long arr_conv_14 = arg_vals[o];
4758 LDKMonitorEvent arr_conv_14_conv;
4759 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
4760 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
4761 arg_constr.data[o] = arr_conv_14_conv;
4763 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4764 CVec_MonitorEventZ_free(arg_constr);
4767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4768 LDKCVec_NetAddressZ arg_constr;
4769 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4770 if (arg_constr.datalen > 0)
4771 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
4773 arg_constr.data = NULL;
4774 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4775 for (size_t m = 0; m < arg_constr.datalen; m++) {
4776 long arr_conv_12 = arg_vals[m];
4777 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
4778 FREE((void*)arr_conv_12);
4779 arg_constr.data[m] = arr_conv_12_conv;
4781 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4782 CVec_NetAddressZ_free(arg_constr);
4785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4786 LDKCVec_NodeAnnouncementZ arg_constr;
4787 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4788 if (arg_constr.datalen > 0)
4789 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4791 arg_constr.data = NULL;
4792 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4793 for (size_t s = 0; s < arg_constr.datalen; s++) {
4794 long arr_conv_18 = arg_vals[s];
4795 LDKNodeAnnouncement arr_conv_18_conv;
4796 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4797 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4798 arg_constr.data[s] = arr_conv_18_conv;
4800 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4801 CVec_NodeAnnouncementZ_free(arg_constr);
4804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4805 LDKCVec_PublicKeyZ arg_constr;
4806 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4807 if (arg_constr.datalen > 0)
4808 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
4810 arg_constr.data = NULL;
4811 for (size_t i = 0; i < arg_constr.datalen; i++) {
4812 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4813 LDKPublicKey arr_conv_8_ref;
4814 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
4815 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
4816 arg_constr.data[i] = arr_conv_8_ref;
4818 CVec_PublicKeyZ_free(arg_constr);
4821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4822 LDKCVec_RouteHintZ arg_constr;
4823 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4824 if (arg_constr.datalen > 0)
4825 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
4827 arg_constr.data = NULL;
4828 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4829 for (size_t l = 0; l < arg_constr.datalen; l++) {
4830 long arr_conv_11 = arg_vals[l];
4831 LDKRouteHint arr_conv_11_conv;
4832 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
4833 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
4834 arg_constr.data[l] = arr_conv_11_conv;
4836 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4837 CVec_RouteHintZ_free(arg_constr);
4840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4841 LDKCVec_RouteHopZ arg_constr;
4842 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4843 if (arg_constr.datalen > 0)
4844 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4846 arg_constr.data = NULL;
4847 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4848 for (size_t k = 0; k < arg_constr.datalen; k++) {
4849 long arr_conv_10 = arg_vals[k];
4850 LDKRouteHop arr_conv_10_conv;
4851 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4852 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4853 arg_constr.data[k] = arr_conv_10_conv;
4855 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4856 CVec_RouteHopZ_free(arg_constr);
4859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4860 LDKCVec_SignatureZ arg_constr;
4861 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4862 if (arg_constr.datalen > 0)
4863 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4865 arg_constr.data = NULL;
4866 for (size_t i = 0; i < arg_constr.datalen; i++) {
4867 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4868 LDKSignature arr_conv_8_ref;
4869 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4870 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4871 arg_constr.data[i] = arr_conv_8_ref;
4873 CVec_SignatureZ_free(arg_constr);
4876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4877 LDKCVec_SpendableOutputDescriptorZ arg_constr;
4878 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4879 if (arg_constr.datalen > 0)
4880 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
4882 arg_constr.data = NULL;
4883 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4884 for (size_t b = 0; b < arg_constr.datalen; b++) {
4885 long arr_conv_27 = arg_vals[b];
4886 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
4887 FREE((void*)arr_conv_27);
4888 arg_constr.data[b] = arr_conv_27_conv;
4890 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4891 CVec_SpendableOutputDescriptorZ_free(arg_constr);
4894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4895 LDKCVec_TransactionZ arg_constr;
4896 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4897 if (arg_constr.datalen > 0)
4898 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
4900 arg_constr.data = NULL;
4901 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4902 for (size_t n = 0; n < arg_constr.datalen; n++) {
4903 long arr_conv_13 = arg_vals[n];
4904 LDKTransaction arr_conv_13_conv = *(LDKTransaction*)arr_conv_13;
4905 FREE((void*)arr_conv_13);
4906 arg_constr.data[n] = arr_conv_13_conv;
4908 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4909 CVec_TransactionZ_free(arg_constr);
4912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4913 LDKCVec_TxOutZ arg_constr;
4914 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4915 if (arg_constr.datalen > 0)
4916 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
4918 arg_constr.data = NULL;
4919 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4920 for (size_t h = 0; h < arg_constr.datalen; h++) {
4921 long arr_conv_7 = arg_vals[h];
4922 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
4923 FREE((void*)arr_conv_7);
4924 arg_constr.data[h] = arr_conv_7_conv;
4926 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4927 CVec_TxOutZ_free(arg_constr);
4930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4931 LDKCVec_UpdateAddHTLCZ arg_constr;
4932 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4933 if (arg_constr.datalen > 0)
4934 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
4936 arg_constr.data = NULL;
4937 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4938 for (size_t p = 0; p < arg_constr.datalen; p++) {
4939 long arr_conv_15 = arg_vals[p];
4940 LDKUpdateAddHTLC arr_conv_15_conv;
4941 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
4942 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
4943 arg_constr.data[p] = arr_conv_15_conv;
4945 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4946 CVec_UpdateAddHTLCZ_free(arg_constr);
4949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4950 LDKCVec_UpdateFailHTLCZ arg_constr;
4951 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4952 if (arg_constr.datalen > 0)
4953 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
4955 arg_constr.data = NULL;
4956 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4957 for (size_t q = 0; q < arg_constr.datalen; q++) {
4958 long arr_conv_16 = arg_vals[q];
4959 LDKUpdateFailHTLC arr_conv_16_conv;
4960 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4961 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4962 arg_constr.data[q] = arr_conv_16_conv;
4964 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4965 CVec_UpdateFailHTLCZ_free(arg_constr);
4968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4969 LDKCVec_UpdateFailMalformedHTLCZ arg_constr;
4970 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4971 if (arg_constr.datalen > 0)
4972 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
4974 arg_constr.data = NULL;
4975 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4976 for (size_t z = 0; z < arg_constr.datalen; z++) {
4977 long arr_conv_25 = arg_vals[z];
4978 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
4979 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
4980 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
4981 arg_constr.data[z] = arr_conv_25_conv;
4983 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4984 CVec_UpdateFailMalformedHTLCZ_free(arg_constr);
4987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4988 LDKCVec_UpdateFulfillHTLCZ arg_constr;
4989 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4990 if (arg_constr.datalen > 0)
4991 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
4993 arg_constr.data = NULL;
4994 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4995 for (size_t t = 0; t < arg_constr.datalen; t++) {
4996 long arr_conv_19 = arg_vals[t];
4997 LDKUpdateFulfillHTLC arr_conv_19_conv;
4998 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
4999 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5000 arg_constr.data[t] = arr_conv_19_conv;
5002 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5003 CVec_UpdateFulfillHTLCZ_free(arg_constr);
5006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5007 LDKCVec_u64Z arg_constr;
5008 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5009 if (arg_constr.datalen > 0)
5010 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
5012 arg_constr.data = NULL;
5013 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5014 for (size_t g = 0; g < arg_constr.datalen; g++) {
5015 long arr_conv_6 = arg_vals[g];
5016 arg_constr.data[g] = arr_conv_6;
5018 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5019 CVec_u64Z_free(arg_constr);
5022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
5023 LDKCVec_u8Z arg_ref;
5024 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
5025 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
5026 CVec_u8Z_free(arg_ref);
5027 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
5030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
5031 LDKTransaction _res_conv = *(LDKTransaction*)_res;
5033 Transaction_free(_res_conv);
5036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5037 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5039 TxOut_free(_res_conv);
5042 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5043 LDKTransaction b_conv = *(LDKTransaction*)b;
5045 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5046 *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
5050 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5051 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5052 *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
5056 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5057 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5058 *ret = CResult_NoneMonitorUpdateErrorZ_ok();
5062 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5064 a_conv.inner = (void*)(a & (~1));
5065 a_conv.is_owned = (a & 1) || (a == 0);
5066 if (a_conv.inner != NULL)
5067 a_conv = OutPoint_clone(&a_conv);
5069 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
5070 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5071 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5072 *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5073 (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0);
5077 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5078 LDKThirtyTwoBytes a_ref;
5079 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5080 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5081 LDKCVec_TxOutZ b_constr;
5082 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5083 if (b_constr.datalen > 0)
5084 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5086 b_constr.data = NULL;
5087 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5088 for (size_t h = 0; h < b_constr.datalen; h++) {
5089 long arr_conv_7 = b_vals[h];
5090 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5091 FREE((void*)arr_conv_7);
5092 b_constr.data[h] = arr_conv_7_conv;
5094 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5095 LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
5096 *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_constr);
5100 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5101 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5102 *ret = C2Tuple_u64u64Z_new(a, b);
5106 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5108 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5109 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5110 LDKCVec_SignatureZ b_constr;
5111 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5112 if (b_constr.datalen > 0)
5113 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5115 b_constr.data = NULL;
5116 for (size_t i = 0; i < b_constr.datalen; i++) {
5117 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5118 LDKSignature arr_conv_8_ref;
5119 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5120 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5121 b_constr.data[i] = arr_conv_8_ref;
5123 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5124 *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5128 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
5129 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5130 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5134 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
5135 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5136 *ret = CResult_SignatureNoneZ_err();
5140 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
5141 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5142 *ret = CResult_CVec_SignatureZNoneZ_err();
5146 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
5147 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5148 *ret = CResult_NoneAPIErrorZ_ok();
5152 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
5153 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5154 *ret = CResult_NonePaymentSendFailureZ_ok();
5158 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
5159 LDKChannelAnnouncement a_conv;
5160 a_conv.inner = (void*)(a & (~1));
5161 a_conv.is_owned = (a & 1) || (a == 0);
5162 if (a_conv.inner != NULL)
5163 a_conv = ChannelAnnouncement_clone(&a_conv);
5164 LDKChannelUpdate b_conv;
5165 b_conv.inner = (void*)(b & (~1));
5166 b_conv.is_owned = (b & 1) || (b == 0);
5167 if (b_conv.inner != NULL)
5168 b_conv = ChannelUpdate_clone(&b_conv);
5169 LDKChannelUpdate c_conv;
5170 c_conv.inner = (void*)(c & (~1));
5171 c_conv.is_owned = (c & 1) || (c == 0);
5172 if (c_conv.inner != NULL)
5173 c_conv = ChannelUpdate_clone(&c_conv);
5174 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5175 *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5179 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
5180 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5181 *ret = CResult_NonePeerHandleErrorZ_ok();
5185 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5186 LDKHTLCOutputInCommitment a_conv;
5187 a_conv.inner = (void*)(a & (~1));
5188 a_conv.is_owned = (a & 1) || (a == 0);
5189 if (a_conv.inner != NULL)
5190 a_conv = HTLCOutputInCommitment_clone(&a_conv);
5192 CHECK((*_env)->GetArrayLength (_env, b) == 64);
5193 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
5194 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
5195 *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
5199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5200 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
5201 FREE((void*)this_ptr);
5202 Event_free(this_ptr_conv);
5205 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5206 LDKEvent* orig_conv = (LDKEvent*)orig;
5207 LDKEvent* ret = MALLOC(sizeof(LDKEvent), "LDKEvent");
5208 *ret = Event_clone(orig_conv);
5212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5213 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
5214 FREE((void*)this_ptr);
5215 MessageSendEvent_free(this_ptr_conv);
5218 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5219 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
5220 LDKMessageSendEvent* ret = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5221 *ret = MessageSendEvent_clone(orig_conv);
5225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5226 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
5227 FREE((void*)this_ptr);
5228 MessageSendEventsProvider_free(this_ptr_conv);
5231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5232 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
5233 FREE((void*)this_ptr);
5234 EventsProvider_free(this_ptr_conv);
5237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5238 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
5239 FREE((void*)this_ptr);
5240 APIError_free(this_ptr_conv);
5243 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5244 LDKAPIError* orig_conv = (LDKAPIError*)orig;
5245 LDKAPIError* ret = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5246 *ret = APIError_clone(orig_conv);
5250 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5251 LDKLevel* orig_conv = (LDKLevel*)orig;
5252 jclass ret = LDKLevel_to_java(_env, Level_clone(orig_conv));
5256 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
5257 jclass ret = LDKLevel_to_java(_env, Level_max());
5261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5262 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
5263 FREE((void*)this_ptr);
5264 Logger_free(this_ptr_conv);
5267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5268 LDKChannelHandshakeConfig this_ptr_conv;
5269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5270 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5271 ChannelHandshakeConfig_free(this_ptr_conv);
5274 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5275 LDKChannelHandshakeConfig orig_conv;
5276 orig_conv.inner = (void*)(orig & (~1));
5277 orig_conv.is_owned = (orig & 1) || (orig == 0);
5278 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_clone(&orig_conv);
5279 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5282 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5283 LDKChannelHandshakeConfig this_ptr_conv;
5284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5285 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5286 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
5290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5291 LDKChannelHandshakeConfig this_ptr_conv;
5292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5293 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5294 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
5297 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5298 LDKChannelHandshakeConfig this_ptr_conv;
5299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5300 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5301 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
5305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5306 LDKChannelHandshakeConfig this_ptr_conv;
5307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5308 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5309 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
5312 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5313 LDKChannelHandshakeConfig this_ptr_conv;
5314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5316 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
5320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5321 LDKChannelHandshakeConfig this_ptr_conv;
5322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5323 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5324 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
5327 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) {
5328 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
5329 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5332 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
5333 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_default();
5334 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5338 LDKChannelHandshakeLimits this_ptr_conv;
5339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5340 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5341 ChannelHandshakeLimits_free(this_ptr_conv);
5344 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5345 LDKChannelHandshakeLimits orig_conv;
5346 orig_conv.inner = (void*)(orig & (~1));
5347 orig_conv.is_owned = (orig & 1) || (orig == 0);
5348 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_clone(&orig_conv);
5349 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5352 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5353 LDKChannelHandshakeLimits this_ptr_conv;
5354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5355 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5356 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
5360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5361 LDKChannelHandshakeLimits this_ptr_conv;
5362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5363 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5364 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
5367 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5368 LDKChannelHandshakeLimits this_ptr_conv;
5369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5370 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5371 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
5375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5376 LDKChannelHandshakeLimits this_ptr_conv;
5377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5378 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5379 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
5382 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5383 LDKChannelHandshakeLimits this_ptr_conv;
5384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5385 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5386 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
5390 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) {
5391 LDKChannelHandshakeLimits this_ptr_conv;
5392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5393 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5394 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
5397 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5398 LDKChannelHandshakeLimits this_ptr_conv;
5399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5401 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
5405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5406 LDKChannelHandshakeLimits this_ptr_conv;
5407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5408 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5409 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
5412 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
5413 LDKChannelHandshakeLimits this_ptr_conv;
5414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5415 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5416 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
5420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5421 LDKChannelHandshakeLimits this_ptr_conv;
5422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5423 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5424 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
5427 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5428 LDKChannelHandshakeLimits this_ptr_conv;
5429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5431 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
5435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5436 LDKChannelHandshakeLimits this_ptr_conv;
5437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5438 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5439 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
5442 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5443 LDKChannelHandshakeLimits this_ptr_conv;
5444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5445 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5446 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
5450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5451 LDKChannelHandshakeLimits this_ptr_conv;
5452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5453 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5454 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
5457 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5458 LDKChannelHandshakeLimits this_ptr_conv;
5459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5460 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5461 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
5465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5466 LDKChannelHandshakeLimits this_ptr_conv;
5467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5468 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5469 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
5473 LDKChannelHandshakeLimits this_ptr_conv;
5474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5475 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5476 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5481 LDKChannelHandshakeLimits this_ptr_conv;
5482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5483 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5484 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5487 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5488 LDKChannelHandshakeLimits this_ptr_conv;
5489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5491 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5496 LDKChannelHandshakeLimits this_ptr_conv;
5497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5498 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5499 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5502 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) {
5503 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);
5504 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5507 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5508 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_default();
5509 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5513 LDKChannelConfig this_ptr_conv;
5514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5515 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5516 ChannelConfig_free(this_ptr_conv);
5519 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5520 LDKChannelConfig orig_conv;
5521 orig_conv.inner = (void*)(orig & (~1));
5522 orig_conv.is_owned = (orig & 1) || (orig == 0);
5523 LDKChannelConfig ret = ChannelConfig_clone(&orig_conv);
5524 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5527 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
5528 LDKChannelConfig this_ptr_conv;
5529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5530 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5531 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
5535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5536 LDKChannelConfig this_ptr_conv;
5537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5538 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5539 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
5542 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
5543 LDKChannelConfig this_ptr_conv;
5544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5545 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5546 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
5550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5551 LDKChannelConfig this_ptr_conv;
5552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5554 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5558 LDKChannelConfig this_ptr_conv;
5559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5560 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5561 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5566 LDKChannelConfig this_ptr_conv;
5567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5569 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5572 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) {
5573 LDKChannelConfig ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5574 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5577 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
5578 LDKChannelConfig ret = ChannelConfig_default();
5579 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5582 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
5583 LDKChannelConfig obj_conv;
5584 obj_conv.inner = (void*)(obj & (~1));
5585 obj_conv.is_owned = (obj & 1) || (obj == 0);
5586 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
5587 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5588 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5592 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5594 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5595 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5596 LDKChannelConfig ret = ChannelConfig_read(ser_ref);
5597 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5598 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5602 LDKUserConfig this_ptr_conv;
5603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5604 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5605 UserConfig_free(this_ptr_conv);
5608 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5609 LDKUserConfig orig_conv;
5610 orig_conv.inner = (void*)(orig & (~1));
5611 orig_conv.is_owned = (orig & 1) || (orig == 0);
5612 LDKUserConfig ret = UserConfig_clone(&orig_conv);
5613 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5616 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
5617 LDKUserConfig this_ptr_conv;
5618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5619 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5620 LDKChannelHandshakeConfig ret = UserConfig_get_own_channel_config(&this_ptr_conv);
5621 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5625 LDKUserConfig this_ptr_conv;
5626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5627 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5628 LDKChannelHandshakeConfig val_conv;
5629 val_conv.inner = (void*)(val & (~1));
5630 val_conv.is_owned = (val & 1) || (val == 0);
5631 if (val_conv.inner != NULL)
5632 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5633 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5636 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
5637 LDKUserConfig this_ptr_conv;
5638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5639 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5640 LDKChannelHandshakeLimits ret = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5641 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5645 LDKUserConfig this_ptr_conv;
5646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5647 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5648 LDKChannelHandshakeLimits val_conv;
5649 val_conv.inner = (void*)(val & (~1));
5650 val_conv.is_owned = (val & 1) || (val == 0);
5651 if (val_conv.inner != NULL)
5652 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5653 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5656 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
5657 LDKUserConfig this_ptr_conv;
5658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5659 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5660 LDKChannelConfig ret = UserConfig_get_channel_options(&this_ptr_conv);
5661 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5665 LDKUserConfig this_ptr_conv;
5666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5667 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5668 LDKChannelConfig val_conv;
5669 val_conv.inner = (void*)(val & (~1));
5670 val_conv.is_owned = (val & 1) || (val == 0);
5671 if (val_conv.inner != NULL)
5672 val_conv = ChannelConfig_clone(&val_conv);
5673 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5676 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) {
5677 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5678 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5679 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5680 if (own_channel_config_arg_conv.inner != NULL)
5681 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5682 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5683 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5684 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5685 if (peer_channel_config_limits_arg_conv.inner != NULL)
5686 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5687 LDKChannelConfig channel_options_arg_conv;
5688 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5689 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5690 if (channel_options_arg_conv.inner != NULL)
5691 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5692 LDKUserConfig ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5693 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5696 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5697 LDKUserConfig ret = UserConfig_default();
5698 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5701 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5702 LDKAccessError* orig_conv = (LDKAccessError*)orig;
5703 jclass ret = LDKAccessError_to_java(_env, AccessError_clone(orig_conv));
5707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5708 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5709 FREE((void*)this_ptr);
5710 Access_free(this_ptr_conv);
5713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5714 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5715 FREE((void*)this_ptr);
5716 Watch_free(this_ptr_conv);
5719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5720 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5721 FREE((void*)this_ptr);
5722 Filter_free(this_ptr_conv);
5725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5726 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
5727 FREE((void*)this_ptr);
5728 BroadcasterInterface_free(this_ptr_conv);
5731 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5732 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
5733 jclass ret = LDKConfirmationTarget_to_java(_env, ConfirmationTarget_clone(orig_conv));
5737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5738 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
5739 FREE((void*)this_ptr);
5740 FeeEstimator_free(this_ptr_conv);
5743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5744 LDKChainMonitor this_ptr_conv;
5745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5746 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5747 ChainMonitor_free(this_ptr_conv);
5750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
5751 LDKChainMonitor this_arg_conv;
5752 this_arg_conv.inner = (void*)(this_arg & (~1));
5753 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5754 unsigned char header_arr[80];
5755 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5756 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5757 unsigned char (*header_ref)[80] = &header_arr;
5758 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5759 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
5760 if (txdata_constr.datalen > 0)
5761 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5763 txdata_constr.data = NULL;
5764 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
5765 for (size_t d = 0; d < txdata_constr.datalen; d++) {
5766 long arr_conv_29 = txdata_vals[d];
5767 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
5768 FREE((void*)arr_conv_29);
5769 txdata_constr.data[d] = arr_conv_29_conv;
5771 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
5772 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
5775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
5776 LDKChainMonitor this_arg_conv;
5777 this_arg_conv.inner = (void*)(this_arg & (~1));
5778 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5779 unsigned char header_arr[80];
5780 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5781 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5782 unsigned char (*header_ref)[80] = &header_arr;
5783 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
5786 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
5787 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
5788 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5789 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5790 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5791 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5793 LDKLogger logger_conv = *(LDKLogger*)logger;
5794 if (logger_conv.free == LDKLogger_JCalls_free) {
5795 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5796 LDKLogger_JCalls_clone(logger_conv.this_arg);
5798 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
5799 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
5800 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5801 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
5803 LDKChainMonitor ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
5804 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5807 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
5808 LDKChainMonitor this_arg_conv;
5809 this_arg_conv.inner = (void*)(this_arg & (~1));
5810 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5811 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
5812 *ret = ChainMonitor_as_Watch(&this_arg_conv);
5816 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5817 LDKChainMonitor this_arg_conv;
5818 this_arg_conv.inner = (void*)(this_arg & (~1));
5819 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5820 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5821 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
5825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5826 LDKChannelMonitorUpdate this_ptr_conv;
5827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5828 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5829 ChannelMonitorUpdate_free(this_ptr_conv);
5832 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5833 LDKChannelMonitorUpdate orig_conv;
5834 orig_conv.inner = (void*)(orig & (~1));
5835 orig_conv.is_owned = (orig & 1) || (orig == 0);
5836 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_clone(&orig_conv);
5837 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5840 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5841 LDKChannelMonitorUpdate this_ptr_conv;
5842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5843 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5844 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
5848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5849 LDKChannelMonitorUpdate this_ptr_conv;
5850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5851 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5852 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
5855 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5856 LDKChannelMonitorUpdate obj_conv;
5857 obj_conv.inner = (void*)(obj & (~1));
5858 obj_conv.is_owned = (obj & 1) || (obj == 0);
5859 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
5860 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5861 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5865 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5867 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5868 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5869 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_read(ser_ref);
5870 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5871 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5874 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5875 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
5876 jclass ret = LDKChannelMonitorUpdateErr_to_java(_env, ChannelMonitorUpdateErr_clone(orig_conv));
5880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5881 LDKMonitorUpdateError this_ptr_conv;
5882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5883 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5884 MonitorUpdateError_free(this_ptr_conv);
5887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5888 LDKMonitorEvent this_ptr_conv;
5889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5891 MonitorEvent_free(this_ptr_conv);
5894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5895 LDKHTLCUpdate this_ptr_conv;
5896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5898 HTLCUpdate_free(this_ptr_conv);
5901 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5902 LDKHTLCUpdate orig_conv;
5903 orig_conv.inner = (void*)(orig & (~1));
5904 orig_conv.is_owned = (orig & 1) || (orig == 0);
5905 LDKHTLCUpdate ret = HTLCUpdate_clone(&orig_conv);
5906 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5909 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5910 LDKHTLCUpdate obj_conv;
5911 obj_conv.inner = (void*)(obj & (~1));
5912 obj_conv.is_owned = (obj & 1) || (obj == 0);
5913 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
5914 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5915 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5919 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5921 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5922 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5923 LDKHTLCUpdate ret = HTLCUpdate_read(ser_ref);
5924 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5925 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5929 LDKChannelMonitor this_ptr_conv;
5930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5931 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5932 ChannelMonitor_free(this_ptr_conv);
5935 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
5936 LDKChannelMonitor this_arg_conv;
5937 this_arg_conv.inner = (void*)(this_arg & (~1));
5938 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5939 LDKChannelMonitorUpdate updates_conv;
5940 updates_conv.inner = (void*)(updates & (~1));
5941 updates_conv.is_owned = (updates & 1) || (updates == 0);
5942 if (updates_conv.inner != NULL)
5943 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
5944 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
5945 LDKLogger* logger_conv = (LDKLogger*)logger;
5946 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5947 *ret = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
5951 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5952 LDKChannelMonitor this_arg_conv;
5953 this_arg_conv.inner = (void*)(this_arg & (~1));
5954 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5955 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
5959 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
5960 LDKChannelMonitor this_arg_conv;
5961 this_arg_conv.inner = (void*)(this_arg & (~1));
5962 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5963 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5964 *ret = ChannelMonitor_get_funding_txo(&this_arg_conv);
5968 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5969 LDKChannelMonitor this_arg_conv;
5970 this_arg_conv.inner = (void*)(this_arg & (~1));
5971 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5972 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
5973 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
5974 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
5975 for (size_t o = 0; o < ret_var.datalen; o++) {
5976 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
5977 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5978 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5979 long arr_conv_14_ref;
5980 if (arr_conv_14_var.is_owned) {
5981 arr_conv_14_ref = (long)arr_conv_14_var.inner | 1;
5983 arr_conv_14_ref = (long)arr_conv_14_var.inner & ~1;
5985 ret_arr_ptr[o] = arr_conv_14_ref;
5987 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
5992 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5993 LDKChannelMonitor this_arg_conv;
5994 this_arg_conv.inner = (void*)(this_arg & (~1));
5995 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5996 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
5997 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
5998 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
5999 for (size_t h = 0; h < ret_var.datalen; h++) {
6000 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6001 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
6002 long arr_conv_7_ref = (long)arr_conv_7_copy;
6003 ret_arr_ptr[h] = arr_conv_7_ref;
6005 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6006 CVec_EventZ_free(ret_var);
6010 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
6011 LDKChannelMonitor this_arg_conv;
6012 this_arg_conv.inner = (void*)(this_arg & (~1));
6013 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6014 LDKLogger* logger_conv = (LDKLogger*)logger;
6015 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
6016 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6017 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6018 for (size_t n = 0; n < ret_var.datalen; n++) {
6019 long arr_conv_13_ref = (long)&ret_var.data[n];
6020 ret_arr_ptr[n] = arr_conv_13_ref;
6022 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6023 CVec_TransactionZ_free(ret_var);
6027 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) {
6028 LDKChannelMonitor this_arg_conv;
6029 this_arg_conv.inner = (void*)(this_arg & (~1));
6030 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6031 unsigned char header_arr[80];
6032 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6033 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6034 unsigned char (*header_ref)[80] = &header_arr;
6035 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6036 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6037 if (txdata_constr.datalen > 0)
6038 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6040 txdata_constr.data = NULL;
6041 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6042 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6043 long arr_conv_29 = txdata_vals[d];
6044 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6045 FREE((void*)arr_conv_29);
6046 txdata_constr.data[d] = arr_conv_29_conv;
6048 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6049 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6050 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6051 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6052 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6054 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6055 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6056 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6057 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6059 LDKLogger logger_conv = *(LDKLogger*)logger;
6060 if (logger_conv.free == LDKLogger_JCalls_free) {
6061 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6062 LDKLogger_JCalls_clone(logger_conv.this_arg);
6064 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6065 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6066 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6067 for (size_t b = 0; b < ret_var.datalen; b++) {
6068 /*XXX False */long arr_conv_27_ref = (long)&ret_var.data[b];
6069 ret_arr_ptr[b] = arr_conv_27_ref;
6071 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6072 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(ret_var);
6076 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) {
6077 LDKChannelMonitor this_arg_conv;
6078 this_arg_conv.inner = (void*)(this_arg & (~1));
6079 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6080 unsigned char header_arr[80];
6081 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6082 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6083 unsigned char (*header_ref)[80] = &header_arr;
6084 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6085 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6086 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6087 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6089 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6090 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6091 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6092 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6094 LDKLogger logger_conv = *(LDKLogger*)logger;
6095 if (logger_conv.free == LDKLogger_JCalls_free) {
6096 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6097 LDKLogger_JCalls_clone(logger_conv.this_arg);
6099 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6103 LDKOutPoint this_ptr_conv;
6104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6105 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6106 OutPoint_free(this_ptr_conv);
6109 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6110 LDKOutPoint orig_conv;
6111 orig_conv.inner = (void*)(orig & (~1));
6112 orig_conv.is_owned = (orig & 1) || (orig == 0);
6113 LDKOutPoint ret = OutPoint_clone(&orig_conv);
6114 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6117 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6118 LDKOutPoint this_ptr_conv;
6119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6120 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6121 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6122 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
6126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6127 LDKOutPoint this_ptr_conv;
6128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6129 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6130 LDKThirtyTwoBytes val_ref;
6131 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6132 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6133 OutPoint_set_txid(&this_ptr_conv, val_ref);
6136 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6137 LDKOutPoint this_ptr_conv;
6138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6139 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6140 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
6144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6145 LDKOutPoint this_ptr_conv;
6146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6147 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6148 OutPoint_set_index(&this_ptr_conv, val);
6151 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
6152 LDKThirtyTwoBytes txid_arg_ref;
6153 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
6154 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
6155 LDKOutPoint ret = OutPoint_new(txid_arg_ref, index_arg);
6156 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6159 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6160 LDKOutPoint this_arg_conv;
6161 this_arg_conv.inner = (void*)(this_arg & (~1));
6162 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6163 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
6164 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
6168 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
6169 LDKOutPoint obj_conv;
6170 obj_conv.inner = (void*)(obj & (~1));
6171 obj_conv.is_owned = (obj & 1) || (obj == 0);
6172 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
6173 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6174 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6178 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6180 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6181 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6182 LDKOutPoint ret = OutPoint_read(ser_ref);
6183 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6184 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6188 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
6189 FREE((void*)this_ptr);
6190 SpendableOutputDescriptor_free(this_ptr_conv);
6193 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6194 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
6195 LDKSpendableOutputDescriptor* ret = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
6196 *ret = SpendableOutputDescriptor_clone(orig_conv);
6200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6201 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
6202 FREE((void*)this_ptr);
6203 ChannelKeys_free(this_ptr_conv);
6206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6207 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
6208 FREE((void*)this_ptr);
6209 KeysInterface_free(this_ptr_conv);
6212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6213 LDKInMemoryChannelKeys this_ptr_conv;
6214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6215 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6216 InMemoryChannelKeys_free(this_ptr_conv);
6219 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6220 LDKInMemoryChannelKeys orig_conv;
6221 orig_conv.inner = (void*)(orig & (~1));
6222 orig_conv.is_owned = (orig & 1) || (orig == 0);
6223 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_clone(&orig_conv);
6224 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6227 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6228 LDKInMemoryChannelKeys this_ptr_conv;
6229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6230 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6231 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6232 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
6236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6237 LDKInMemoryChannelKeys this_ptr_conv;
6238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6239 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6240 LDKSecretKey val_ref;
6241 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6242 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6243 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
6246 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6247 LDKInMemoryChannelKeys this_ptr_conv;
6248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6249 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6250 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6251 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
6255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6256 LDKInMemoryChannelKeys this_ptr_conv;
6257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6258 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6259 LDKSecretKey val_ref;
6260 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6261 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6262 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
6265 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6266 LDKInMemoryChannelKeys this_ptr_conv;
6267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6268 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6269 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6270 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
6274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6275 LDKInMemoryChannelKeys this_ptr_conv;
6276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6277 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6278 LDKSecretKey val_ref;
6279 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6280 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6281 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
6284 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6285 LDKInMemoryChannelKeys this_ptr_conv;
6286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6288 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6289 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
6293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6294 LDKInMemoryChannelKeys this_ptr_conv;
6295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6296 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6297 LDKSecretKey val_ref;
6298 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6299 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6300 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
6303 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6304 LDKInMemoryChannelKeys this_ptr_conv;
6305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6306 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6307 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6308 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
6312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6313 LDKInMemoryChannelKeys this_ptr_conv;
6314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6316 LDKSecretKey val_ref;
6317 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6318 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6319 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6322 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
6323 LDKInMemoryChannelKeys this_ptr_conv;
6324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6325 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6326 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6327 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
6331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6332 LDKInMemoryChannelKeys this_ptr_conv;
6333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6334 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6335 LDKThirtyTwoBytes val_ref;
6336 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6337 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6338 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6341 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) {
6342 LDKSecretKey funding_key_ref;
6343 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
6344 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
6345 LDKSecretKey revocation_base_key_ref;
6346 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
6347 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
6348 LDKSecretKey payment_key_ref;
6349 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
6350 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
6351 LDKSecretKey delayed_payment_base_key_ref;
6352 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
6353 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
6354 LDKSecretKey htlc_base_key_ref;
6355 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
6356 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
6357 LDKThirtyTwoBytes commitment_seed_ref;
6358 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
6359 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
6360 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
6361 FREE((void*)key_derivation_params);
6362 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);
6363 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6366 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6367 LDKInMemoryChannelKeys this_arg_conv;
6368 this_arg_conv.inner = (void*)(this_arg & (~1));
6369 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6370 LDKChannelPublicKeys ret = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
6371 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6374 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6375 LDKInMemoryChannelKeys this_arg_conv;
6376 this_arg_conv.inner = (void*)(this_arg & (~1));
6377 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6378 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
6382 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6383 LDKInMemoryChannelKeys this_arg_conv;
6384 this_arg_conv.inner = (void*)(this_arg & (~1));
6385 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6386 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
6390 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6391 LDKInMemoryChannelKeys this_arg_conv;
6392 this_arg_conv.inner = (void*)(this_arg & (~1));
6393 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6394 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6395 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
6399 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
6400 LDKInMemoryChannelKeys obj_conv;
6401 obj_conv.inner = (void*)(obj & (~1));
6402 obj_conv.is_owned = (obj & 1) || (obj == 0);
6403 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
6404 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6405 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6411 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6412 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6413 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_read(ser_ref);
6414 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6415 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6419 LDKKeysManager this_ptr_conv;
6420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6421 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6422 KeysManager_free(this_ptr_conv);
6425 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) {
6426 unsigned char seed_arr[32];
6427 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
6428 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
6429 unsigned char (*seed_ref)[32] = &seed_arr;
6430 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6431 LDKKeysManager ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
6432 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6435 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) {
6436 LDKKeysManager this_arg_conv;
6437 this_arg_conv.inner = (void*)(this_arg & (~1));
6438 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6439 LDKInMemoryChannelKeys ret = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
6440 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
6444 LDKKeysManager this_arg_conv;
6445 this_arg_conv.inner = (void*)(this_arg & (~1));
6446 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6447 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6448 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
6452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6453 LDKChannelManager this_ptr_conv;
6454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6455 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6456 ChannelManager_free(this_ptr_conv);
6459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6460 LDKChannelDetails this_ptr_conv;
6461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6462 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6463 ChannelDetails_free(this_ptr_conv);
6466 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6467 LDKChannelDetails orig_conv;
6468 orig_conv.inner = (void*)(orig & (~1));
6469 orig_conv.is_owned = (orig & 1) || (orig == 0);
6470 LDKChannelDetails ret = ChannelDetails_clone(&orig_conv);
6471 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6474 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6475 LDKChannelDetails this_ptr_conv;
6476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6477 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6478 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6479 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
6483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6484 LDKChannelDetails this_ptr_conv;
6485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6487 LDKThirtyTwoBytes val_ref;
6488 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6489 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6490 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
6493 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6494 LDKChannelDetails this_ptr_conv;
6495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6496 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6497 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6498 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
6502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6503 LDKChannelDetails this_ptr_conv;
6504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6505 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6506 LDKPublicKey val_ref;
6507 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6508 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6509 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
6512 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
6513 LDKChannelDetails this_ptr_conv;
6514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6515 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6516 LDKInitFeatures ret = ChannelDetails_get_counterparty_features(&this_ptr_conv);
6517 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6521 LDKChannelDetails this_ptr_conv;
6522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6523 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6524 LDKInitFeatures val_conv;
6525 val_conv.inner = (void*)(val & (~1));
6526 val_conv.is_owned = (val & 1) || (val == 0);
6527 // Warning: we may need a move here but can't clone!
6528 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
6531 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6532 LDKChannelDetails this_ptr_conv;
6533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6534 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6535 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
6539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6540 LDKChannelDetails this_ptr_conv;
6541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6542 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6543 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
6546 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6547 LDKChannelDetails this_ptr_conv;
6548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6549 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6550 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
6554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6555 LDKChannelDetails this_ptr_conv;
6556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6557 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6558 ChannelDetails_set_user_id(&this_ptr_conv, val);
6561 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6562 LDKChannelDetails this_ptr_conv;
6563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6564 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6565 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
6569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6570 LDKChannelDetails this_ptr_conv;
6571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6572 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6573 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
6576 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6577 LDKChannelDetails this_ptr_conv;
6578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6579 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6580 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
6584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6585 LDKChannelDetails this_ptr_conv;
6586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6587 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6588 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
6591 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
6592 LDKChannelDetails this_ptr_conv;
6593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6595 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
6599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6600 LDKChannelDetails this_ptr_conv;
6601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6603 ChannelDetails_set_is_live(&this_ptr_conv, val);
6606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6607 LDKPaymentSendFailure this_ptr_conv;
6608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6609 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6610 PaymentSendFailure_free(this_ptr_conv);
6613 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) {
6614 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6615 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
6616 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
6617 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6618 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
6620 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6621 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6622 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6623 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6625 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6626 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6627 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6628 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6630 LDKLogger logger_conv = *(LDKLogger*)logger;
6631 if (logger_conv.free == LDKLogger_JCalls_free) {
6632 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6633 LDKLogger_JCalls_clone(logger_conv.this_arg);
6635 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6636 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6637 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6638 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6640 LDKUserConfig config_conv;
6641 config_conv.inner = (void*)(config & (~1));
6642 config_conv.is_owned = (config & 1) || (config == 0);
6643 if (config_conv.inner != NULL)
6644 config_conv = UserConfig_clone(&config_conv);
6645 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);
6646 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6649 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) {
6650 LDKChannelManager this_arg_conv;
6651 this_arg_conv.inner = (void*)(this_arg & (~1));
6652 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6653 LDKPublicKey their_network_key_ref;
6654 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
6655 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
6656 LDKUserConfig override_config_conv;
6657 override_config_conv.inner = (void*)(override_config & (~1));
6658 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
6659 if (override_config_conv.inner != NULL)
6660 override_config_conv = UserConfig_clone(&override_config_conv);
6661 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6662 *ret = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
6666 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6667 LDKChannelManager this_arg_conv;
6668 this_arg_conv.inner = (void*)(this_arg & (~1));
6669 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6670 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
6671 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6672 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6673 for (size_t q = 0; q < ret_var.datalen; q++) {
6674 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
6675 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6676 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6677 long arr_conv_16_ref;
6678 if (arr_conv_16_var.is_owned) {
6679 arr_conv_16_ref = (long)arr_conv_16_var.inner | 1;
6681 arr_conv_16_ref = (long)arr_conv_16_var.inner & ~1;
6683 ret_arr_ptr[q] = arr_conv_16_ref;
6685 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6690 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6691 LDKChannelManager this_arg_conv;
6692 this_arg_conv.inner = (void*)(this_arg & (~1));
6693 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6694 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
6695 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6696 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6697 for (size_t q = 0; q < ret_var.datalen; q++) {
6698 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
6699 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6700 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6701 long arr_conv_16_ref;
6702 if (arr_conv_16_var.is_owned) {
6703 arr_conv_16_ref = (long)arr_conv_16_var.inner | 1;
6705 arr_conv_16_ref = (long)arr_conv_16_var.inner & ~1;
6707 ret_arr_ptr[q] = arr_conv_16_ref;
6709 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6714 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6715 LDKChannelManager this_arg_conv;
6716 this_arg_conv.inner = (void*)(this_arg & (~1));
6717 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6718 unsigned char channel_id_arr[32];
6719 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6720 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6721 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6722 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6723 *ret = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
6727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6728 LDKChannelManager this_arg_conv;
6729 this_arg_conv.inner = (void*)(this_arg & (~1));
6730 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6731 unsigned char channel_id_arr[32];
6732 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6733 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6734 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6735 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
6738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6739 LDKChannelManager this_arg_conv;
6740 this_arg_conv.inner = (void*)(this_arg & (~1));
6741 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6742 ChannelManager_force_close_all_channels(&this_arg_conv);
6745 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) {
6746 LDKChannelManager this_arg_conv;
6747 this_arg_conv.inner = (void*)(this_arg & (~1));
6748 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6749 LDKRoute route_conv;
6750 route_conv.inner = (void*)(route & (~1));
6751 route_conv.is_owned = (route & 1) || (route == 0);
6752 LDKThirtyTwoBytes payment_hash_ref;
6753 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6754 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
6755 LDKThirtyTwoBytes payment_secret_ref;
6756 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6757 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6758 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6759 *ret = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
6763 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) {
6764 LDKChannelManager this_arg_conv;
6765 this_arg_conv.inner = (void*)(this_arg & (~1));
6766 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6767 unsigned char temporary_channel_id_arr[32];
6768 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
6769 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
6770 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
6771 LDKOutPoint funding_txo_conv;
6772 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6773 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6774 if (funding_txo_conv.inner != NULL)
6775 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6776 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
6779 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) {
6780 LDKChannelManager this_arg_conv;
6781 this_arg_conv.inner = (void*)(this_arg & (~1));
6782 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6783 LDKThreeBytes rgb_ref;
6784 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
6785 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
6786 LDKThirtyTwoBytes alias_ref;
6787 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
6788 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
6789 LDKCVec_NetAddressZ addresses_constr;
6790 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
6791 if (addresses_constr.datalen > 0)
6792 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6794 addresses_constr.data = NULL;
6795 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
6796 for (size_t m = 0; m < addresses_constr.datalen; m++) {
6797 long arr_conv_12 = addresses_vals[m];
6798 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
6799 FREE((void*)arr_conv_12);
6800 addresses_constr.data[m] = arr_conv_12_conv;
6802 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
6803 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
6806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
6807 LDKChannelManager this_arg_conv;
6808 this_arg_conv.inner = (void*)(this_arg & (~1));
6809 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6810 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
6813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
6814 LDKChannelManager this_arg_conv;
6815 this_arg_conv.inner = (void*)(this_arg & (~1));
6816 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6817 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
6820 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) {
6821 LDKChannelManager this_arg_conv;
6822 this_arg_conv.inner = (void*)(this_arg & (~1));
6823 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6824 unsigned char payment_hash_arr[32];
6825 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6826 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
6827 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
6828 LDKThirtyTwoBytes payment_secret_ref;
6829 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6830 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6831 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
6835 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) {
6836 LDKChannelManager this_arg_conv;
6837 this_arg_conv.inner = (void*)(this_arg & (~1));
6838 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6839 LDKThirtyTwoBytes payment_preimage_ref;
6840 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
6841 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
6842 LDKThirtyTwoBytes payment_secret_ref;
6843 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6844 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6845 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
6849 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6850 LDKChannelManager this_arg_conv;
6851 this_arg_conv.inner = (void*)(this_arg & (~1));
6852 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6853 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6854 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
6858 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) {
6859 LDKChannelManager this_arg_conv;
6860 this_arg_conv.inner = (void*)(this_arg & (~1));
6861 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6862 LDKOutPoint funding_txo_conv;
6863 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6864 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6865 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
6868 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6869 LDKChannelManager this_arg_conv;
6870 this_arg_conv.inner = (void*)(this_arg & (~1));
6871 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6872 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6873 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
6877 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6878 LDKChannelManager this_arg_conv;
6879 this_arg_conv.inner = (void*)(this_arg & (~1));
6880 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6881 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6882 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
6886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
6887 LDKChannelManager this_arg_conv;
6888 this_arg_conv.inner = (void*)(this_arg & (~1));
6889 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6890 unsigned char header_arr[80];
6891 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6892 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6893 unsigned char (*header_ref)[80] = &header_arr;
6894 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6895 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6896 if (txdata_constr.datalen > 0)
6897 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6899 txdata_constr.data = NULL;
6900 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6901 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6902 long arr_conv_29 = txdata_vals[d];
6903 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6904 FREE((void*)arr_conv_29);
6905 txdata_constr.data[d] = arr_conv_29_conv;
6907 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6908 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
6912 LDKChannelManager this_arg_conv;
6913 this_arg_conv.inner = (void*)(this_arg & (~1));
6914 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6915 unsigned char header_arr[80];
6916 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6917 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6918 unsigned char (*header_ref)[80] = &header_arr;
6919 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
6922 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
6923 LDKChannelManager this_arg_conv;
6924 this_arg_conv.inner = (void*)(this_arg & (~1));
6925 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6926 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6927 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
6931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6932 LDKChannelManagerReadArgs this_ptr_conv;
6933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6934 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6935 ChannelManagerReadArgs_free(this_ptr_conv);
6938 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
6939 LDKChannelManagerReadArgs this_ptr_conv;
6940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6941 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6942 long ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
6946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6947 LDKChannelManagerReadArgs this_ptr_conv;
6948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6949 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6950 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
6951 if (val_conv.free == LDKKeysInterface_JCalls_free) {
6952 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6953 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
6955 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
6958 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
6959 LDKChannelManagerReadArgs this_ptr_conv;
6960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6961 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6962 long ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
6966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6967 LDKChannelManagerReadArgs this_ptr_conv;
6968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6969 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6970 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
6971 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
6972 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6973 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
6975 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
6978 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
6979 LDKChannelManagerReadArgs this_ptr_conv;
6980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6981 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6982 long ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
6986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6987 LDKChannelManagerReadArgs this_ptr_conv;
6988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6989 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6990 LDKWatch val_conv = *(LDKWatch*)val;
6991 if (val_conv.free == LDKWatch_JCalls_free) {
6992 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6993 LDKWatch_JCalls_clone(val_conv.this_arg);
6995 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
6998 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
6999 LDKChannelManagerReadArgs this_ptr_conv;
7000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7001 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7002 long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
7006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7007 LDKChannelManagerReadArgs this_ptr_conv;
7008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7009 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7010 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
7011 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
7012 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7013 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
7015 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
7018 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
7019 LDKChannelManagerReadArgs this_ptr_conv;
7020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7021 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7022 long ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
7026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7027 LDKChannelManagerReadArgs this_ptr_conv;
7028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7029 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7030 LDKLogger val_conv = *(LDKLogger*)val;
7031 if (val_conv.free == LDKLogger_JCalls_free) {
7032 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7033 LDKLogger_JCalls_clone(val_conv.this_arg);
7035 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
7038 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
7039 LDKChannelManagerReadArgs this_ptr_conv;
7040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7041 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7042 LDKUserConfig ret = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
7043 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7047 LDKChannelManagerReadArgs this_ptr_conv;
7048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7049 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7050 LDKUserConfig val_conv;
7051 val_conv.inner = (void*)(val & (~1));
7052 val_conv.is_owned = (val & 1) || (val == 0);
7053 if (val_conv.inner != NULL)
7054 val_conv = UserConfig_clone(&val_conv);
7055 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
7058 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) {
7059 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7060 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7061 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7062 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7064 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7065 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
7066 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7067 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
7069 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7070 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7071 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7072 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7074 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7075 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7076 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7077 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7079 LDKLogger logger_conv = *(LDKLogger*)logger;
7080 if (logger_conv.free == LDKLogger_JCalls_free) {
7081 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7082 LDKLogger_JCalls_clone(logger_conv.this_arg);
7084 LDKUserConfig default_config_conv;
7085 default_config_conv.inner = (void*)(default_config & (~1));
7086 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
7087 if (default_config_conv.inner != NULL)
7088 default_config_conv = UserConfig_clone(&default_config_conv);
7089 LDKCVec_ChannelMonitorZ channel_monitors_constr;
7090 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
7091 if (channel_monitors_constr.datalen > 0)
7092 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7094 channel_monitors_constr.data = NULL;
7095 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
7096 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
7097 long arr_conv_16 = channel_monitors_vals[q];
7098 LDKChannelMonitor arr_conv_16_conv;
7099 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7100 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7101 // Warning: we may need a move here but can't clone!
7102 channel_monitors_constr.data[q] = arr_conv_16_conv;
7104 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
7105 LDKChannelManagerReadArgs ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr);
7106 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7110 LDKDecodeError this_ptr_conv;
7111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7112 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7113 DecodeError_free(this_ptr_conv);
7116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7117 LDKInit this_ptr_conv;
7118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7119 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7120 Init_free(this_ptr_conv);
7123 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7125 orig_conv.inner = (void*)(orig & (~1));
7126 orig_conv.is_owned = (orig & 1) || (orig == 0);
7127 LDKInit ret = Init_clone(&orig_conv);
7128 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7132 LDKErrorMessage this_ptr_conv;
7133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7134 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7135 ErrorMessage_free(this_ptr_conv);
7138 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7139 LDKErrorMessage orig_conv;
7140 orig_conv.inner = (void*)(orig & (~1));
7141 orig_conv.is_owned = (orig & 1) || (orig == 0);
7142 LDKErrorMessage ret = ErrorMessage_clone(&orig_conv);
7143 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7146 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7147 LDKErrorMessage this_ptr_conv;
7148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7149 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7150 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7151 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
7155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7156 LDKErrorMessage this_ptr_conv;
7157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7158 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7159 LDKThirtyTwoBytes val_ref;
7160 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7161 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7162 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
7165 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
7166 LDKErrorMessage this_ptr_conv;
7167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7168 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7169 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
7170 char* _buf = MALLOC(_str.len + 1, "str conv buf");
7171 memcpy(_buf, _str.chars, _str.len);
7173 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
7178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7179 LDKErrorMessage this_ptr_conv;
7180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7181 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7182 LDKCVec_u8Z val_ref;
7183 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
7184 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7185 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7186 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
7189 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
7190 LDKThirtyTwoBytes channel_id_arg_ref;
7191 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7192 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7193 LDKCVec_u8Z data_arg_ref;
7194 data_arg_ref.data = (*_env)->GetByteArrayElements (_env, data_arg, NULL);
7195 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
7196 LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7197 (*_env)->ReleaseByteArrayElements(_env, data_arg, (int8_t*)data_arg_ref.data, 0);
7198 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7202 LDKPing this_ptr_conv;
7203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7204 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7205 Ping_free(this_ptr_conv);
7208 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7210 orig_conv.inner = (void*)(orig & (~1));
7211 orig_conv.is_owned = (orig & 1) || (orig == 0);
7212 LDKPing ret = Ping_clone(&orig_conv);
7213 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7216 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7217 LDKPing this_ptr_conv;
7218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7219 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7220 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7225 LDKPing this_ptr_conv;
7226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7227 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7228 Ping_set_ponglen(&this_ptr_conv, val);
7231 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7232 LDKPing this_ptr_conv;
7233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7234 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7235 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7240 LDKPing this_ptr_conv;
7241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7242 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7243 Ping_set_byteslen(&this_ptr_conv, val);
7246 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
7247 LDKPing ret = Ping_new(ponglen_arg, byteslen_arg);
7248 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7252 LDKPong this_ptr_conv;
7253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7254 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7255 Pong_free(this_ptr_conv);
7258 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7260 orig_conv.inner = (void*)(orig & (~1));
7261 orig_conv.is_owned = (orig & 1) || (orig == 0);
7262 LDKPong ret = Pong_clone(&orig_conv);
7263 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7266 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7267 LDKPong this_ptr_conv;
7268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7269 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7270 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
7274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7275 LDKPong this_ptr_conv;
7276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7277 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7278 Pong_set_byteslen(&this_ptr_conv, val);
7281 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
7282 LDKPong ret = Pong_new(byteslen_arg);
7283 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7287 LDKOpenChannel this_ptr_conv;
7288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7289 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7290 OpenChannel_free(this_ptr_conv);
7293 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7294 LDKOpenChannel orig_conv;
7295 orig_conv.inner = (void*)(orig & (~1));
7296 orig_conv.is_owned = (orig & 1) || (orig == 0);
7297 LDKOpenChannel ret = OpenChannel_clone(&orig_conv);
7298 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7301 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7302 LDKOpenChannel this_ptr_conv;
7303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7304 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7305 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7306 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
7310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7311 LDKOpenChannel this_ptr_conv;
7312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7313 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7314 LDKThirtyTwoBytes val_ref;
7315 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7316 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7317 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
7320 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7321 LDKOpenChannel this_ptr_conv;
7322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7323 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7324 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7325 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
7329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7330 LDKOpenChannel this_ptr_conv;
7331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7332 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7333 LDKThirtyTwoBytes val_ref;
7334 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7335 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7336 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7339 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7340 LDKOpenChannel this_ptr_conv;
7341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7342 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7343 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
7347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7348 LDKOpenChannel this_ptr_conv;
7349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7351 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
7354 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7355 LDKOpenChannel this_ptr_conv;
7356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7357 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7358 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
7362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7363 LDKOpenChannel this_ptr_conv;
7364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7365 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7366 OpenChannel_set_push_msat(&this_ptr_conv, val);
7369 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7370 LDKOpenChannel this_ptr_conv;
7371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7372 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7373 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
7377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7378 LDKOpenChannel this_ptr_conv;
7379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7380 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7381 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7384 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7385 LDKOpenChannel this_ptr_conv;
7386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7388 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7392 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) {
7393 LDKOpenChannel this_ptr_conv;
7394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7395 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7396 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7399 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7400 LDKOpenChannel this_ptr_conv;
7401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7402 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7403 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7408 LDKOpenChannel this_ptr_conv;
7409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7410 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7411 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7414 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7415 LDKOpenChannel this_ptr_conv;
7416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7417 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7418 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
7422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7423 LDKOpenChannel this_ptr_conv;
7424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7425 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7426 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7429 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7430 LDKOpenChannel this_ptr_conv;
7431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7432 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7433 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
7437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7438 LDKOpenChannel this_ptr_conv;
7439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7440 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7441 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
7444 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7445 LDKOpenChannel this_ptr_conv;
7446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7447 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7448 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
7452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7453 LDKOpenChannel this_ptr_conv;
7454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7455 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7456 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
7459 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7460 LDKOpenChannel this_ptr_conv;
7461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7462 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7463 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
7467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7468 LDKOpenChannel this_ptr_conv;
7469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7471 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7474 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7475 LDKOpenChannel this_ptr_conv;
7476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7477 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7478 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7479 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7484 LDKOpenChannel this_ptr_conv;
7485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7487 LDKPublicKey val_ref;
7488 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7489 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7490 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7493 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7494 LDKOpenChannel this_ptr_conv;
7495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7496 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7497 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7498 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7503 LDKOpenChannel this_ptr_conv;
7504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7505 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7506 LDKPublicKey val_ref;
7507 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7508 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7509 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7512 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7513 LDKOpenChannel this_ptr_conv;
7514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7515 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7516 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7517 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
7521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7522 LDKOpenChannel this_ptr_conv;
7523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7524 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7525 LDKPublicKey val_ref;
7526 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7527 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7528 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
7531 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7532 LDKOpenChannel this_ptr_conv;
7533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7534 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7535 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7536 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7541 LDKOpenChannel this_ptr_conv;
7542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7544 LDKPublicKey val_ref;
7545 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7546 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7547 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7550 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7551 LDKOpenChannel this_ptr_conv;
7552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7554 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7555 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
7559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7560 LDKOpenChannel this_ptr_conv;
7561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7562 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7563 LDKPublicKey val_ref;
7564 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7565 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7566 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7569 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7570 LDKOpenChannel this_ptr_conv;
7571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7572 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7573 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7574 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
7578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7579 LDKOpenChannel this_ptr_conv;
7580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7582 LDKPublicKey val_ref;
7583 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7584 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7585 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7588 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
7589 LDKOpenChannel this_ptr_conv;
7590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7591 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7592 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
7596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
7597 LDKOpenChannel this_ptr_conv;
7598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7599 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7600 OpenChannel_set_channel_flags(&this_ptr_conv, val);
7603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7604 LDKAcceptChannel this_ptr_conv;
7605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7606 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7607 AcceptChannel_free(this_ptr_conv);
7610 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7611 LDKAcceptChannel orig_conv;
7612 orig_conv.inner = (void*)(orig & (~1));
7613 orig_conv.is_owned = (orig & 1) || (orig == 0);
7614 LDKAcceptChannel ret = AcceptChannel_clone(&orig_conv);
7615 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7618 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7619 LDKAcceptChannel this_ptr_conv;
7620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7621 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7622 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7623 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
7627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7628 LDKAcceptChannel this_ptr_conv;
7629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7630 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7631 LDKThirtyTwoBytes val_ref;
7632 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7633 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7634 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7637 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7638 LDKAcceptChannel this_ptr_conv;
7639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7640 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7641 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
7645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7646 LDKAcceptChannel this_ptr_conv;
7647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7648 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7649 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7652 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7653 LDKAcceptChannel this_ptr_conv;
7654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7655 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7656 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7660 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) {
7661 LDKAcceptChannel this_ptr_conv;
7662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7663 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7664 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7667 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7668 LDKAcceptChannel this_ptr_conv;
7669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7670 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7671 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7676 LDKAcceptChannel this_ptr_conv;
7677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7678 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7679 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7682 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7683 LDKAcceptChannel this_ptr_conv;
7684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7685 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7686 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
7690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7691 LDKAcceptChannel this_ptr_conv;
7692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7693 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7694 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7697 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
7698 LDKAcceptChannel this_ptr_conv;
7699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7700 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7701 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
7705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7706 LDKAcceptChannel this_ptr_conv;
7707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7709 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
7712 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7713 LDKAcceptChannel this_ptr_conv;
7714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7715 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7716 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
7720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7721 LDKAcceptChannel this_ptr_conv;
7722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7724 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
7727 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7728 LDKAcceptChannel this_ptr_conv;
7729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7730 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7731 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
7735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7736 LDKAcceptChannel this_ptr_conv;
7737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7739 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7742 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7743 LDKAcceptChannel this_ptr_conv;
7744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7745 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7746 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7747 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7752 LDKAcceptChannel this_ptr_conv;
7753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7754 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7755 LDKPublicKey val_ref;
7756 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7757 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7758 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7761 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7762 LDKAcceptChannel this_ptr_conv;
7763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7764 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7765 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7766 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7771 LDKAcceptChannel this_ptr_conv;
7772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7773 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7774 LDKPublicKey val_ref;
7775 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7776 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7777 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7780 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7781 LDKAcceptChannel this_ptr_conv;
7782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7783 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7784 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7785 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
7789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7790 LDKAcceptChannel this_ptr_conv;
7791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7792 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7793 LDKPublicKey val_ref;
7794 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7795 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7796 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
7799 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7800 LDKAcceptChannel this_ptr_conv;
7801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7802 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7803 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7804 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7809 LDKAcceptChannel this_ptr_conv;
7810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7811 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7812 LDKPublicKey val_ref;
7813 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7814 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7815 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7818 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7819 LDKAcceptChannel this_ptr_conv;
7820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7821 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7822 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7823 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
7827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7828 LDKAcceptChannel this_ptr_conv;
7829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7830 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7831 LDKPublicKey val_ref;
7832 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7833 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7834 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7837 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7838 LDKAcceptChannel this_ptr_conv;
7839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7840 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7841 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7842 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
7846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7847 LDKAcceptChannel this_ptr_conv;
7848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7849 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7850 LDKPublicKey val_ref;
7851 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7852 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7853 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7857 LDKFundingCreated this_ptr_conv;
7858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7859 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7860 FundingCreated_free(this_ptr_conv);
7863 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7864 LDKFundingCreated orig_conv;
7865 orig_conv.inner = (void*)(orig & (~1));
7866 orig_conv.is_owned = (orig & 1) || (orig == 0);
7867 LDKFundingCreated ret = FundingCreated_clone(&orig_conv);
7868 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7871 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7872 LDKFundingCreated this_ptr_conv;
7873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7874 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7875 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7876 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
7880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7881 LDKFundingCreated this_ptr_conv;
7882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7883 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7884 LDKThirtyTwoBytes val_ref;
7885 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7886 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7887 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
7890 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
7891 LDKFundingCreated this_ptr_conv;
7892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7893 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7894 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7895 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
7899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7900 LDKFundingCreated this_ptr_conv;
7901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7902 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7903 LDKThirtyTwoBytes val_ref;
7904 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7905 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7906 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
7909 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
7910 LDKFundingCreated this_ptr_conv;
7911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7912 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7913 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
7917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7918 LDKFundingCreated this_ptr_conv;
7919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7920 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7921 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
7924 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7925 LDKFundingCreated this_ptr_conv;
7926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7927 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7928 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7929 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
7933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7934 LDKFundingCreated this_ptr_conv;
7935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7936 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7937 LDKSignature val_ref;
7938 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7939 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7940 FundingCreated_set_signature(&this_ptr_conv, val_ref);
7943 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) {
7944 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
7945 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
7946 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
7947 LDKThirtyTwoBytes funding_txid_arg_ref;
7948 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
7949 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
7950 LDKSignature signature_arg_ref;
7951 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7952 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7953 LDKFundingCreated ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
7954 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7958 LDKFundingSigned this_ptr_conv;
7959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7961 FundingSigned_free(this_ptr_conv);
7964 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7965 LDKFundingSigned orig_conv;
7966 orig_conv.inner = (void*)(orig & (~1));
7967 orig_conv.is_owned = (orig & 1) || (orig == 0);
7968 LDKFundingSigned ret = FundingSigned_clone(&orig_conv);
7969 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7972 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7973 LDKFundingSigned this_ptr_conv;
7974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7975 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7976 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7977 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
7981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7982 LDKFundingSigned this_ptr_conv;
7983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7984 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7985 LDKThirtyTwoBytes val_ref;
7986 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7987 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7988 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
7991 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7992 LDKFundingSigned this_ptr_conv;
7993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7994 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7995 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7996 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
8000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8001 LDKFundingSigned this_ptr_conv;
8002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8003 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8004 LDKSignature val_ref;
8005 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8006 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8007 FundingSigned_set_signature(&this_ptr_conv, val_ref);
8010 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
8011 LDKThirtyTwoBytes channel_id_arg_ref;
8012 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8013 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8014 LDKSignature signature_arg_ref;
8015 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8016 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8017 LDKFundingSigned ret = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
8018 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8022 LDKFundingLocked this_ptr_conv;
8023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8024 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8025 FundingLocked_free(this_ptr_conv);
8028 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8029 LDKFundingLocked orig_conv;
8030 orig_conv.inner = (void*)(orig & (~1));
8031 orig_conv.is_owned = (orig & 1) || (orig == 0);
8032 LDKFundingLocked ret = FundingLocked_clone(&orig_conv);
8033 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8036 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8037 LDKFundingLocked this_ptr_conv;
8038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8039 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8040 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8041 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
8045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8046 LDKFundingLocked this_ptr_conv;
8047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8048 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8049 LDKThirtyTwoBytes val_ref;
8050 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8051 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8052 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
8055 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8056 LDKFundingLocked this_ptr_conv;
8057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8058 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8059 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8060 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8065 LDKFundingLocked this_ptr_conv;
8066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8067 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8068 LDKPublicKey val_ref;
8069 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8070 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8071 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8074 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
8075 LDKThirtyTwoBytes channel_id_arg_ref;
8076 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8077 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8078 LDKPublicKey next_per_commitment_point_arg_ref;
8079 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8080 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8081 LDKFundingLocked ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
8082 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8086 LDKShutdown this_ptr_conv;
8087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8088 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8089 Shutdown_free(this_ptr_conv);
8092 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8093 LDKShutdown orig_conv;
8094 orig_conv.inner = (void*)(orig & (~1));
8095 orig_conv.is_owned = (orig & 1) || (orig == 0);
8096 LDKShutdown ret = Shutdown_clone(&orig_conv);
8097 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8100 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8101 LDKShutdown this_ptr_conv;
8102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8103 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8104 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8105 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
8109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8110 LDKShutdown this_ptr_conv;
8111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8112 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8113 LDKThirtyTwoBytes val_ref;
8114 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8115 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8116 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8119 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8120 LDKShutdown this_ptr_conv;
8121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8122 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8123 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8124 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8125 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8130 LDKShutdown this_ptr_conv;
8131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8132 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8133 LDKCVec_u8Z val_ref;
8134 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
8135 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
8136 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8137 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
8140 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
8141 LDKThirtyTwoBytes channel_id_arg_ref;
8142 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8143 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8144 LDKCVec_u8Z scriptpubkey_arg_ref;
8145 scriptpubkey_arg_ref.data = (*_env)->GetByteArrayElements (_env, scriptpubkey_arg, NULL);
8146 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
8147 LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8148 (*_env)->ReleaseByteArrayElements(_env, scriptpubkey_arg, (int8_t*)scriptpubkey_arg_ref.data, 0);
8149 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8153 LDKClosingSigned this_ptr_conv;
8154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8156 ClosingSigned_free(this_ptr_conv);
8159 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8160 LDKClosingSigned orig_conv;
8161 orig_conv.inner = (void*)(orig & (~1));
8162 orig_conv.is_owned = (orig & 1) || (orig == 0);
8163 LDKClosingSigned ret = ClosingSigned_clone(&orig_conv);
8164 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8167 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8168 LDKClosingSigned this_ptr_conv;
8169 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8170 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8171 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8172 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
8176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8177 LDKClosingSigned this_ptr_conv;
8178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8179 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8180 LDKThirtyTwoBytes val_ref;
8181 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8182 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8183 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
8186 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8187 LDKClosingSigned this_ptr_conv;
8188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8189 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8190 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
8194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8195 LDKClosingSigned this_ptr_conv;
8196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8197 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8198 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
8201 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8202 LDKClosingSigned this_ptr_conv;
8203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8204 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8205 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8206 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
8210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8211 LDKClosingSigned this_ptr_conv;
8212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8213 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8214 LDKSignature val_ref;
8215 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8216 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8217 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
8220 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) {
8221 LDKThirtyTwoBytes channel_id_arg_ref;
8222 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8223 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8224 LDKSignature signature_arg_ref;
8225 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8226 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8227 LDKClosingSigned ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
8228 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8232 LDKUpdateAddHTLC this_ptr_conv;
8233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8234 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8235 UpdateAddHTLC_free(this_ptr_conv);
8238 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8239 LDKUpdateAddHTLC orig_conv;
8240 orig_conv.inner = (void*)(orig & (~1));
8241 orig_conv.is_owned = (orig & 1) || (orig == 0);
8242 LDKUpdateAddHTLC ret = UpdateAddHTLC_clone(&orig_conv);
8243 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8246 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8247 LDKUpdateAddHTLC this_ptr_conv;
8248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8249 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8250 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8251 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
8255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8256 LDKUpdateAddHTLC this_ptr_conv;
8257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8258 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8259 LDKThirtyTwoBytes val_ref;
8260 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8261 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8262 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
8265 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8266 LDKUpdateAddHTLC this_ptr_conv;
8267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8268 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8269 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
8273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8274 LDKUpdateAddHTLC this_ptr_conv;
8275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8276 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8277 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
8280 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8281 LDKUpdateAddHTLC this_ptr_conv;
8282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8283 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8284 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
8288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8289 LDKUpdateAddHTLC this_ptr_conv;
8290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8291 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8292 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
8295 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8296 LDKUpdateAddHTLC this_ptr_conv;
8297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8298 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8299 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8300 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
8304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8305 LDKUpdateAddHTLC this_ptr_conv;
8306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8308 LDKThirtyTwoBytes val_ref;
8309 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8310 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8311 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
8314 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
8315 LDKUpdateAddHTLC this_ptr_conv;
8316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8317 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8318 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
8322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8323 LDKUpdateAddHTLC this_ptr_conv;
8324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8325 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8326 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
8329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8330 LDKUpdateFulfillHTLC this_ptr_conv;
8331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8332 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8333 UpdateFulfillHTLC_free(this_ptr_conv);
8336 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8337 LDKUpdateFulfillHTLC orig_conv;
8338 orig_conv.inner = (void*)(orig & (~1));
8339 orig_conv.is_owned = (orig & 1) || (orig == 0);
8340 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_clone(&orig_conv);
8341 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8344 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8345 LDKUpdateFulfillHTLC this_ptr_conv;
8346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8348 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8349 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
8353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8354 LDKUpdateFulfillHTLC this_ptr_conv;
8355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8356 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8357 LDKThirtyTwoBytes val_ref;
8358 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8359 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8360 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
8363 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8364 LDKUpdateFulfillHTLC this_ptr_conv;
8365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8366 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8367 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
8371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8372 LDKUpdateFulfillHTLC this_ptr_conv;
8373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8374 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8375 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
8378 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
8379 LDKUpdateFulfillHTLC this_ptr_conv;
8380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8381 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8382 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8383 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
8387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8388 LDKUpdateFulfillHTLC this_ptr_conv;
8389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8390 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8391 LDKThirtyTwoBytes val_ref;
8392 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8393 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8394 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
8397 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) {
8398 LDKThirtyTwoBytes channel_id_arg_ref;
8399 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8400 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8401 LDKThirtyTwoBytes payment_preimage_arg_ref;
8402 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
8403 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
8404 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
8405 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8409 LDKUpdateFailHTLC this_ptr_conv;
8410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8411 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8412 UpdateFailHTLC_free(this_ptr_conv);
8415 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8416 LDKUpdateFailHTLC orig_conv;
8417 orig_conv.inner = (void*)(orig & (~1));
8418 orig_conv.is_owned = (orig & 1) || (orig == 0);
8419 LDKUpdateFailHTLC ret = UpdateFailHTLC_clone(&orig_conv);
8420 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8423 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8424 LDKUpdateFailHTLC this_ptr_conv;
8425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8426 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8427 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8428 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
8432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8433 LDKUpdateFailHTLC this_ptr_conv;
8434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8435 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8436 LDKThirtyTwoBytes val_ref;
8437 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8438 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8439 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
8442 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8443 LDKUpdateFailHTLC this_ptr_conv;
8444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8445 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8446 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
8450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8451 LDKUpdateFailHTLC this_ptr_conv;
8452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8453 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8454 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
8457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8458 LDKUpdateFailMalformedHTLC this_ptr_conv;
8459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8460 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8461 UpdateFailMalformedHTLC_free(this_ptr_conv);
8464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8465 LDKUpdateFailMalformedHTLC orig_conv;
8466 orig_conv.inner = (void*)(orig & (~1));
8467 orig_conv.is_owned = (orig & 1) || (orig == 0);
8468 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_clone(&orig_conv);
8469 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8472 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8473 LDKUpdateFailMalformedHTLC this_ptr_conv;
8474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8475 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8476 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8477 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
8481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8482 LDKUpdateFailMalformedHTLC this_ptr_conv;
8483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8484 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8485 LDKThirtyTwoBytes val_ref;
8486 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8487 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8488 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
8491 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8492 LDKUpdateFailMalformedHTLC this_ptr_conv;
8493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8494 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8495 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
8499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8500 LDKUpdateFailMalformedHTLC this_ptr_conv;
8501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8502 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8503 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
8506 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
8507 LDKUpdateFailMalformedHTLC this_ptr_conv;
8508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8509 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8510 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
8514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8515 LDKUpdateFailMalformedHTLC this_ptr_conv;
8516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8517 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8518 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
8521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8522 LDKCommitmentSigned this_ptr_conv;
8523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8524 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8525 CommitmentSigned_free(this_ptr_conv);
8528 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8529 LDKCommitmentSigned orig_conv;
8530 orig_conv.inner = (void*)(orig & (~1));
8531 orig_conv.is_owned = (orig & 1) || (orig == 0);
8532 LDKCommitmentSigned ret = CommitmentSigned_clone(&orig_conv);
8533 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8536 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8537 LDKCommitmentSigned this_ptr_conv;
8538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8539 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8540 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8541 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
8545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8546 LDKCommitmentSigned this_ptr_conv;
8547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8548 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8549 LDKThirtyTwoBytes val_ref;
8550 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8551 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8552 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
8555 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8556 LDKCommitmentSigned this_ptr_conv;
8557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8558 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8559 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8560 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
8564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8565 LDKCommitmentSigned this_ptr_conv;
8566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8568 LDKSignature val_ref;
8569 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8570 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8571 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
8574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
8575 LDKCommitmentSigned this_ptr_conv;
8576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8577 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8578 LDKCVec_SignatureZ val_constr;
8579 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
8580 if (val_constr.datalen > 0)
8581 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8583 val_constr.data = NULL;
8584 for (size_t i = 0; i < val_constr.datalen; i++) {
8585 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
8586 LDKSignature arr_conv_8_ref;
8587 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
8588 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
8589 val_constr.data[i] = arr_conv_8_ref;
8591 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
8594 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) {
8595 LDKThirtyTwoBytes channel_id_arg_ref;
8596 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8597 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8598 LDKSignature signature_arg_ref;
8599 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8600 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8601 LDKCVec_SignatureZ htlc_signatures_arg_constr;
8602 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
8603 if (htlc_signatures_arg_constr.datalen > 0)
8604 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8606 htlc_signatures_arg_constr.data = NULL;
8607 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
8608 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
8609 LDKSignature arr_conv_8_ref;
8610 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
8611 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
8612 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
8614 LDKCommitmentSigned ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
8615 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8619 LDKRevokeAndACK this_ptr_conv;
8620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8621 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8622 RevokeAndACK_free(this_ptr_conv);
8625 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8626 LDKRevokeAndACK orig_conv;
8627 orig_conv.inner = (void*)(orig & (~1));
8628 orig_conv.is_owned = (orig & 1) || (orig == 0);
8629 LDKRevokeAndACK ret = RevokeAndACK_clone(&orig_conv);
8630 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8633 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8634 LDKRevokeAndACK this_ptr_conv;
8635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8636 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8637 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8638 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
8642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8643 LDKRevokeAndACK this_ptr_conv;
8644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8645 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8646 LDKThirtyTwoBytes val_ref;
8647 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8648 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8649 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
8652 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
8653 LDKRevokeAndACK this_ptr_conv;
8654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8655 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8656 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8657 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
8661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8662 LDKRevokeAndACK this_ptr_conv;
8663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8664 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8665 LDKThirtyTwoBytes val_ref;
8666 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8667 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8668 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
8671 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8672 LDKRevokeAndACK this_ptr_conv;
8673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8674 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8675 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8676 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8681 LDKRevokeAndACK this_ptr_conv;
8682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8683 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8684 LDKPublicKey val_ref;
8685 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8686 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8687 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8690 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) {
8691 LDKThirtyTwoBytes channel_id_arg_ref;
8692 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8693 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8694 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
8695 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
8696 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
8697 LDKPublicKey next_per_commitment_point_arg_ref;
8698 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8699 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8700 LDKRevokeAndACK ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
8701 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8705 LDKUpdateFee this_ptr_conv;
8706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8707 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8708 UpdateFee_free(this_ptr_conv);
8711 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8712 LDKUpdateFee orig_conv;
8713 orig_conv.inner = (void*)(orig & (~1));
8714 orig_conv.is_owned = (orig & 1) || (orig == 0);
8715 LDKUpdateFee ret = UpdateFee_clone(&orig_conv);
8716 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8719 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8720 LDKUpdateFee this_ptr_conv;
8721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8722 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8723 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8724 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
8728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8729 LDKUpdateFee this_ptr_conv;
8730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8731 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8732 LDKThirtyTwoBytes val_ref;
8733 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8734 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8735 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
8738 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
8739 LDKUpdateFee this_ptr_conv;
8740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8741 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8742 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
8746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8747 LDKUpdateFee this_ptr_conv;
8748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8749 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8750 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
8753 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
8754 LDKThirtyTwoBytes channel_id_arg_ref;
8755 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8756 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8757 LDKUpdateFee ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
8758 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8762 LDKDataLossProtect this_ptr_conv;
8763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8764 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8765 DataLossProtect_free(this_ptr_conv);
8768 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8769 LDKDataLossProtect orig_conv;
8770 orig_conv.inner = (void*)(orig & (~1));
8771 orig_conv.is_owned = (orig & 1) || (orig == 0);
8772 LDKDataLossProtect ret = DataLossProtect_clone(&orig_conv);
8773 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8776 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
8777 LDKDataLossProtect this_ptr_conv;
8778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8779 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8780 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8781 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
8785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8786 LDKDataLossProtect this_ptr_conv;
8787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8788 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8789 LDKThirtyTwoBytes val_ref;
8790 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8791 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8792 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
8795 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8796 LDKDataLossProtect this_ptr_conv;
8797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8799 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8800 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
8804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8805 LDKDataLossProtect this_ptr_conv;
8806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8808 LDKPublicKey val_ref;
8809 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8810 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8811 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
8814 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) {
8815 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
8816 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
8817 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
8818 LDKPublicKey my_current_per_commitment_point_arg_ref;
8819 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
8820 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
8821 LDKDataLossProtect ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
8822 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8826 LDKChannelReestablish this_ptr_conv;
8827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8828 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8829 ChannelReestablish_free(this_ptr_conv);
8832 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8833 LDKChannelReestablish orig_conv;
8834 orig_conv.inner = (void*)(orig & (~1));
8835 orig_conv.is_owned = (orig & 1) || (orig == 0);
8836 LDKChannelReestablish ret = ChannelReestablish_clone(&orig_conv);
8837 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8840 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8841 LDKChannelReestablish this_ptr_conv;
8842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8843 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8844 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8845 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
8849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8850 LDKChannelReestablish this_ptr_conv;
8851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8852 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8853 LDKThirtyTwoBytes val_ref;
8854 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8855 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8856 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
8859 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8860 LDKChannelReestablish this_ptr_conv;
8861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8863 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
8867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8868 LDKChannelReestablish this_ptr_conv;
8869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8870 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8871 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
8874 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8875 LDKChannelReestablish this_ptr_conv;
8876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8877 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8878 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
8882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8883 LDKChannelReestablish this_ptr_conv;
8884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8885 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8886 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
8889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8890 LDKAnnouncementSignatures this_ptr_conv;
8891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8892 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8893 AnnouncementSignatures_free(this_ptr_conv);
8896 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8897 LDKAnnouncementSignatures orig_conv;
8898 orig_conv.inner = (void*)(orig & (~1));
8899 orig_conv.is_owned = (orig & 1) || (orig == 0);
8900 LDKAnnouncementSignatures ret = AnnouncementSignatures_clone(&orig_conv);
8901 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8904 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8905 LDKAnnouncementSignatures this_ptr_conv;
8906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8907 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8908 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8909 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
8913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8914 LDKAnnouncementSignatures this_ptr_conv;
8915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8916 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8917 LDKThirtyTwoBytes val_ref;
8918 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8919 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8920 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
8923 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8924 LDKAnnouncementSignatures this_ptr_conv;
8925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8926 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8927 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
8931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8932 LDKAnnouncementSignatures this_ptr_conv;
8933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8934 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8935 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
8938 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8939 LDKAnnouncementSignatures this_ptr_conv;
8940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8941 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8942 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8943 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
8947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8948 LDKAnnouncementSignatures this_ptr_conv;
8949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8950 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8951 LDKSignature val_ref;
8952 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8953 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8954 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
8957 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8958 LDKAnnouncementSignatures this_ptr_conv;
8959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8961 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8962 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
8966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8967 LDKAnnouncementSignatures this_ptr_conv;
8968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8969 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8970 LDKSignature val_ref;
8971 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8972 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8973 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
8976 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) {
8977 LDKThirtyTwoBytes channel_id_arg_ref;
8978 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8979 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8980 LDKSignature node_signature_arg_ref;
8981 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
8982 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
8983 LDKSignature bitcoin_signature_arg_ref;
8984 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
8985 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
8986 LDKAnnouncementSignatures ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
8987 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8991 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
8992 FREE((void*)this_ptr);
8993 NetAddress_free(this_ptr_conv);
8996 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8997 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
8998 LDKNetAddress* ret = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
8999 *ret = NetAddress_clone(orig_conv);
9003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9004 LDKUnsignedNodeAnnouncement this_ptr_conv;
9005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9006 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9007 UnsignedNodeAnnouncement_free(this_ptr_conv);
9010 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9011 LDKUnsignedNodeAnnouncement orig_conv;
9012 orig_conv.inner = (void*)(orig & (~1));
9013 orig_conv.is_owned = (orig & 1) || (orig == 0);
9014 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_clone(&orig_conv);
9015 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9018 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9019 LDKUnsignedNodeAnnouncement this_ptr_conv;
9020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9021 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9022 LDKNodeFeatures ret = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9023 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9027 LDKUnsignedNodeAnnouncement this_ptr_conv;
9028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9029 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9030 LDKNodeFeatures val_conv;
9031 val_conv.inner = (void*)(val & (~1));
9032 val_conv.is_owned = (val & 1) || (val == 0);
9033 // Warning: we may need a move here but can't clone!
9034 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9037 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9038 LDKUnsignedNodeAnnouncement this_ptr_conv;
9039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9040 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9041 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9046 LDKUnsignedNodeAnnouncement this_ptr_conv;
9047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9048 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9049 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9052 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9053 LDKUnsignedNodeAnnouncement this_ptr_conv;
9054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9055 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9056 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9057 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
9061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9062 LDKUnsignedNodeAnnouncement this_ptr_conv;
9063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9064 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9065 LDKPublicKey val_ref;
9066 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9067 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9068 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
9071 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
9072 LDKUnsignedNodeAnnouncement this_ptr_conv;
9073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9074 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9075 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
9076 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
9080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9081 LDKUnsignedNodeAnnouncement this_ptr_conv;
9082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9083 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9084 LDKThreeBytes val_ref;
9085 CHECK((*_env)->GetArrayLength (_env, val) == 3);
9086 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
9087 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
9090 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
9091 LDKUnsignedNodeAnnouncement this_ptr_conv;
9092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9094 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9095 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
9099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9100 LDKUnsignedNodeAnnouncement this_ptr_conv;
9101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9102 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9103 LDKThirtyTwoBytes val_ref;
9104 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9105 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9106 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
9109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9110 LDKUnsignedNodeAnnouncement this_ptr_conv;
9111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9112 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9113 LDKCVec_NetAddressZ val_constr;
9114 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9115 if (val_constr.datalen > 0)
9116 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9118 val_constr.data = NULL;
9119 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9120 for (size_t m = 0; m < val_constr.datalen; m++) {
9121 long arr_conv_12 = val_vals[m];
9122 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9123 FREE((void*)arr_conv_12);
9124 val_constr.data[m] = arr_conv_12_conv;
9126 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9127 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
9130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9131 LDKNodeAnnouncement this_ptr_conv;
9132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9133 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9134 NodeAnnouncement_free(this_ptr_conv);
9137 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9138 LDKNodeAnnouncement orig_conv;
9139 orig_conv.inner = (void*)(orig & (~1));
9140 orig_conv.is_owned = (orig & 1) || (orig == 0);
9141 LDKNodeAnnouncement ret = NodeAnnouncement_clone(&orig_conv);
9142 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9145 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9146 LDKNodeAnnouncement this_ptr_conv;
9147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9148 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9149 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9150 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
9154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9155 LDKNodeAnnouncement this_ptr_conv;
9156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9157 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9158 LDKSignature val_ref;
9159 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9160 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9161 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
9164 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9165 LDKNodeAnnouncement this_ptr_conv;
9166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9167 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9168 LDKUnsignedNodeAnnouncement ret = NodeAnnouncement_get_contents(&this_ptr_conv);
9169 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9173 LDKNodeAnnouncement this_ptr_conv;
9174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9175 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9176 LDKUnsignedNodeAnnouncement val_conv;
9177 val_conv.inner = (void*)(val & (~1));
9178 val_conv.is_owned = (val & 1) || (val == 0);
9179 if (val_conv.inner != NULL)
9180 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
9181 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
9184 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9185 LDKSignature signature_arg_ref;
9186 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9187 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9188 LDKUnsignedNodeAnnouncement contents_arg_conv;
9189 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9190 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9191 if (contents_arg_conv.inner != NULL)
9192 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
9193 LDKNodeAnnouncement ret = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
9194 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9198 LDKUnsignedChannelAnnouncement this_ptr_conv;
9199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9200 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9201 UnsignedChannelAnnouncement_free(this_ptr_conv);
9204 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9205 LDKUnsignedChannelAnnouncement orig_conv;
9206 orig_conv.inner = (void*)(orig & (~1));
9207 orig_conv.is_owned = (orig & 1) || (orig == 0);
9208 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_clone(&orig_conv);
9209 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9212 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9213 LDKUnsignedChannelAnnouncement this_ptr_conv;
9214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9215 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9216 LDKChannelFeatures ret = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
9217 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9221 LDKUnsignedChannelAnnouncement this_ptr_conv;
9222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9223 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9224 LDKChannelFeatures val_conv;
9225 val_conv.inner = (void*)(val & (~1));
9226 val_conv.is_owned = (val & 1) || (val == 0);
9227 // Warning: we may need a move here but can't clone!
9228 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
9231 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9232 LDKUnsignedChannelAnnouncement this_ptr_conv;
9233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9234 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9235 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9236 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
9240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9241 LDKUnsignedChannelAnnouncement this_ptr_conv;
9242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9243 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9244 LDKThirtyTwoBytes val_ref;
9245 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9246 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9247 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
9250 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9251 LDKUnsignedChannelAnnouncement this_ptr_conv;
9252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9253 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9254 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
9258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9259 LDKUnsignedChannelAnnouncement this_ptr_conv;
9260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9261 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9262 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
9265 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9266 LDKUnsignedChannelAnnouncement this_ptr_conv;
9267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9268 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9269 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9270 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
9274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9275 LDKUnsignedChannelAnnouncement this_ptr_conv;
9276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9277 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9278 LDKPublicKey val_ref;
9279 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9280 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9281 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
9284 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9285 LDKUnsignedChannelAnnouncement this_ptr_conv;
9286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9288 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9289 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
9293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9294 LDKUnsignedChannelAnnouncement this_ptr_conv;
9295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9296 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9297 LDKPublicKey val_ref;
9298 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9299 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9300 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
9303 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9304 LDKUnsignedChannelAnnouncement this_ptr_conv;
9305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9306 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9307 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9308 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
9312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9313 LDKUnsignedChannelAnnouncement this_ptr_conv;
9314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9316 LDKPublicKey val_ref;
9317 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9318 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9319 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
9322 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9323 LDKUnsignedChannelAnnouncement this_ptr_conv;
9324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9325 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9326 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9327 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
9331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9332 LDKUnsignedChannelAnnouncement this_ptr_conv;
9333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9334 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9335 LDKPublicKey val_ref;
9336 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9337 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9338 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
9341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9342 LDKChannelAnnouncement this_ptr_conv;
9343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9344 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9345 ChannelAnnouncement_free(this_ptr_conv);
9348 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9349 LDKChannelAnnouncement orig_conv;
9350 orig_conv.inner = (void*)(orig & (~1));
9351 orig_conv.is_owned = (orig & 1) || (orig == 0);
9352 LDKChannelAnnouncement ret = ChannelAnnouncement_clone(&orig_conv);
9353 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9356 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9357 LDKChannelAnnouncement this_ptr_conv;
9358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9359 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9360 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9361 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
9365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9366 LDKChannelAnnouncement this_ptr_conv;
9367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9368 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9369 LDKSignature val_ref;
9370 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9371 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9372 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
9375 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9376 LDKChannelAnnouncement this_ptr_conv;
9377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9378 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9379 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9380 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
9384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9385 LDKChannelAnnouncement this_ptr_conv;
9386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9388 LDKSignature val_ref;
9389 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9390 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9391 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
9394 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9395 LDKChannelAnnouncement this_ptr_conv;
9396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9397 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9398 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9399 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
9403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9404 LDKChannelAnnouncement this_ptr_conv;
9405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9406 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9407 LDKSignature val_ref;
9408 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9409 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9410 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
9413 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9414 LDKChannelAnnouncement this_ptr_conv;
9415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9416 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9417 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9418 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
9422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9423 LDKChannelAnnouncement this_ptr_conv;
9424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9425 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9426 LDKSignature val_ref;
9427 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9428 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9429 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
9432 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9433 LDKChannelAnnouncement this_ptr_conv;
9434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9435 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9436 LDKUnsignedChannelAnnouncement ret = ChannelAnnouncement_get_contents(&this_ptr_conv);
9437 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9441 LDKChannelAnnouncement this_ptr_conv;
9442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9443 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9444 LDKUnsignedChannelAnnouncement val_conv;
9445 val_conv.inner = (void*)(val & (~1));
9446 val_conv.is_owned = (val & 1) || (val == 0);
9447 if (val_conv.inner != NULL)
9448 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
9449 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
9452 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) {
9453 LDKSignature node_signature_1_arg_ref;
9454 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
9455 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
9456 LDKSignature node_signature_2_arg_ref;
9457 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
9458 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
9459 LDKSignature bitcoin_signature_1_arg_ref;
9460 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
9461 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
9462 LDKSignature bitcoin_signature_2_arg_ref;
9463 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
9464 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
9465 LDKUnsignedChannelAnnouncement contents_arg_conv;
9466 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9467 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9468 if (contents_arg_conv.inner != NULL)
9469 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
9470 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);
9471 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9475 LDKUnsignedChannelUpdate this_ptr_conv;
9476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9477 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9478 UnsignedChannelUpdate_free(this_ptr_conv);
9481 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9482 LDKUnsignedChannelUpdate orig_conv;
9483 orig_conv.inner = (void*)(orig & (~1));
9484 orig_conv.is_owned = (orig & 1) || (orig == 0);
9485 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_clone(&orig_conv);
9486 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9489 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9490 LDKUnsignedChannelUpdate this_ptr_conv;
9491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9492 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9493 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9494 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
9498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9499 LDKUnsignedChannelUpdate this_ptr_conv;
9500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9501 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9502 LDKThirtyTwoBytes val_ref;
9503 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9504 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9505 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
9508 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9509 LDKUnsignedChannelUpdate this_ptr_conv;
9510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9511 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9512 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
9516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9517 LDKUnsignedChannelUpdate this_ptr_conv;
9518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9519 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9520 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
9523 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9524 LDKUnsignedChannelUpdate this_ptr_conv;
9525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9526 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9527 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
9531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9532 LDKUnsignedChannelUpdate this_ptr_conv;
9533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9534 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9535 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
9538 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
9539 LDKUnsignedChannelUpdate this_ptr_conv;
9540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9541 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9542 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
9546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
9547 LDKUnsignedChannelUpdate this_ptr_conv;
9548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9549 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9550 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
9553 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
9554 LDKUnsignedChannelUpdate this_ptr_conv;
9555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9556 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9557 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
9561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9562 LDKUnsignedChannelUpdate this_ptr_conv;
9563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9564 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9565 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
9568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9569 LDKUnsignedChannelUpdate this_ptr_conv;
9570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9571 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9572 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
9576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9577 LDKUnsignedChannelUpdate this_ptr_conv;
9578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9579 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9580 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
9583 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9584 LDKUnsignedChannelUpdate this_ptr_conv;
9585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9586 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9587 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
9591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9592 LDKUnsignedChannelUpdate this_ptr_conv;
9593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9595 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
9598 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
9599 LDKUnsignedChannelUpdate this_ptr_conv;
9600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9601 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9602 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
9606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9607 LDKUnsignedChannelUpdate this_ptr_conv;
9608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9609 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9610 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
9613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9614 LDKChannelUpdate this_ptr_conv;
9615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9616 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9617 ChannelUpdate_free(this_ptr_conv);
9620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9621 LDKChannelUpdate orig_conv;
9622 orig_conv.inner = (void*)(orig & (~1));
9623 orig_conv.is_owned = (orig & 1) || (orig == 0);
9624 LDKChannelUpdate ret = ChannelUpdate_clone(&orig_conv);
9625 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9628 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9629 LDKChannelUpdate this_ptr_conv;
9630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9631 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9632 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9633 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
9637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9638 LDKChannelUpdate this_ptr_conv;
9639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9640 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9641 LDKSignature val_ref;
9642 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9643 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9644 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
9647 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9648 LDKChannelUpdate this_ptr_conv;
9649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9650 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9651 LDKUnsignedChannelUpdate ret = ChannelUpdate_get_contents(&this_ptr_conv);
9652 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9656 LDKChannelUpdate this_ptr_conv;
9657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9658 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9659 LDKUnsignedChannelUpdate val_conv;
9660 val_conv.inner = (void*)(val & (~1));
9661 val_conv.is_owned = (val & 1) || (val == 0);
9662 if (val_conv.inner != NULL)
9663 val_conv = UnsignedChannelUpdate_clone(&val_conv);
9664 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
9667 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9668 LDKSignature signature_arg_ref;
9669 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9670 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9671 LDKUnsignedChannelUpdate contents_arg_conv;
9672 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9673 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9674 if (contents_arg_conv.inner != NULL)
9675 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
9676 LDKChannelUpdate ret = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
9677 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9681 LDKQueryChannelRange this_ptr_conv;
9682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9683 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9684 QueryChannelRange_free(this_ptr_conv);
9687 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9688 LDKQueryChannelRange orig_conv;
9689 orig_conv.inner = (void*)(orig & (~1));
9690 orig_conv.is_owned = (orig & 1) || (orig == 0);
9691 LDKQueryChannelRange ret = QueryChannelRange_clone(&orig_conv);
9692 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9695 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9696 LDKQueryChannelRange this_ptr_conv;
9697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9699 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9700 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
9704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9705 LDKQueryChannelRange this_ptr_conv;
9706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9707 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9708 LDKThirtyTwoBytes val_ref;
9709 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9710 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9711 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9714 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9715 LDKQueryChannelRange this_ptr_conv;
9716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9717 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9718 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
9722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9723 LDKQueryChannelRange this_ptr_conv;
9724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9725 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9726 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
9729 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9730 LDKQueryChannelRange this_ptr_conv;
9731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9732 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9733 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
9737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9738 LDKQueryChannelRange this_ptr_conv;
9739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9740 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9741 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9744 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) {
9745 LDKThirtyTwoBytes chain_hash_arg_ref;
9746 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9747 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9748 LDKQueryChannelRange ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
9749 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9753 LDKReplyChannelRange this_ptr_conv;
9754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9755 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9756 ReplyChannelRange_free(this_ptr_conv);
9759 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9760 LDKReplyChannelRange orig_conv;
9761 orig_conv.inner = (void*)(orig & (~1));
9762 orig_conv.is_owned = (orig & 1) || (orig == 0);
9763 LDKReplyChannelRange ret = ReplyChannelRange_clone(&orig_conv);
9764 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9767 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9768 LDKReplyChannelRange this_ptr_conv;
9769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9770 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9771 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9772 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
9776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9777 LDKReplyChannelRange this_ptr_conv;
9778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9779 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9780 LDKThirtyTwoBytes val_ref;
9781 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9782 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9783 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9786 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9787 LDKReplyChannelRange this_ptr_conv;
9788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9789 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9790 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
9794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9795 LDKReplyChannelRange this_ptr_conv;
9796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9798 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
9801 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9802 LDKReplyChannelRange this_ptr_conv;
9803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9804 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9805 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
9809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9810 LDKReplyChannelRange this_ptr_conv;
9811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9812 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9813 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9817 LDKReplyChannelRange this_ptr_conv;
9818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9819 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9820 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
9824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9825 LDKReplyChannelRange this_ptr_conv;
9826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9827 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9828 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
9831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9832 LDKReplyChannelRange this_ptr_conv;
9833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9834 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9835 LDKCVec_u64Z val_constr;
9836 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9837 if (val_constr.datalen > 0)
9838 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9840 val_constr.data = NULL;
9841 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9842 for (size_t g = 0; g < val_constr.datalen; g++) {
9843 long arr_conv_6 = val_vals[g];
9844 val_constr.data[g] = arr_conv_6;
9846 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9847 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
9850 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) {
9851 LDKThirtyTwoBytes chain_hash_arg_ref;
9852 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9853 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9854 LDKCVec_u64Z short_channel_ids_arg_constr;
9855 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
9856 if (short_channel_ids_arg_constr.datalen > 0)
9857 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9859 short_channel_ids_arg_constr.data = NULL;
9860 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
9861 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
9862 long arr_conv_6 = short_channel_ids_arg_vals[g];
9863 short_channel_ids_arg_constr.data[g] = arr_conv_6;
9865 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
9866 LDKReplyChannelRange ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
9867 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9871 LDKQueryShortChannelIds this_ptr_conv;
9872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9873 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9874 QueryShortChannelIds_free(this_ptr_conv);
9877 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9878 LDKQueryShortChannelIds orig_conv;
9879 orig_conv.inner = (void*)(orig & (~1));
9880 orig_conv.is_owned = (orig & 1) || (orig == 0);
9881 LDKQueryShortChannelIds ret = QueryShortChannelIds_clone(&orig_conv);
9882 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9885 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9886 LDKQueryShortChannelIds this_ptr_conv;
9887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9888 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9889 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9890 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
9894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9895 LDKQueryShortChannelIds this_ptr_conv;
9896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9898 LDKThirtyTwoBytes val_ref;
9899 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9900 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9901 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
9904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9905 LDKQueryShortChannelIds this_ptr_conv;
9906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9907 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9908 LDKCVec_u64Z val_constr;
9909 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9910 if (val_constr.datalen > 0)
9911 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9913 val_constr.data = NULL;
9914 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9915 for (size_t g = 0; g < val_constr.datalen; g++) {
9916 long arr_conv_6 = val_vals[g];
9917 val_constr.data[g] = arr_conv_6;
9919 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9920 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
9923 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
9924 LDKThirtyTwoBytes chain_hash_arg_ref;
9925 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9926 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9927 LDKCVec_u64Z short_channel_ids_arg_constr;
9928 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
9929 if (short_channel_ids_arg_constr.datalen > 0)
9930 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9932 short_channel_ids_arg_constr.data = NULL;
9933 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
9934 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
9935 long arr_conv_6 = short_channel_ids_arg_vals[g];
9936 short_channel_ids_arg_constr.data[g] = arr_conv_6;
9938 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
9939 LDKQueryShortChannelIds ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
9940 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9944 LDKReplyShortChannelIdsEnd this_ptr_conv;
9945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9946 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9947 ReplyShortChannelIdsEnd_free(this_ptr_conv);
9950 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9951 LDKReplyShortChannelIdsEnd orig_conv;
9952 orig_conv.inner = (void*)(orig & (~1));
9953 orig_conv.is_owned = (orig & 1) || (orig == 0);
9954 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_clone(&orig_conv);
9955 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9958 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9959 LDKReplyShortChannelIdsEnd this_ptr_conv;
9960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9961 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9962 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9963 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
9967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9968 LDKReplyShortChannelIdsEnd this_ptr_conv;
9969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9970 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9971 LDKThirtyTwoBytes val_ref;
9972 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9973 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9974 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
9977 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9978 LDKReplyShortChannelIdsEnd this_ptr_conv;
9979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9980 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9981 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
9985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9986 LDKReplyShortChannelIdsEnd this_ptr_conv;
9987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9988 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9989 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
9992 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
9993 LDKThirtyTwoBytes chain_hash_arg_ref;
9994 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9995 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9996 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
9997 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10001 LDKGossipTimestampFilter this_ptr_conv;
10002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10003 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10004 GossipTimestampFilter_free(this_ptr_conv);
10007 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10008 LDKGossipTimestampFilter orig_conv;
10009 orig_conv.inner = (void*)(orig & (~1));
10010 orig_conv.is_owned = (orig & 1) || (orig == 0);
10011 LDKGossipTimestampFilter ret = GossipTimestampFilter_clone(&orig_conv);
10012 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10015 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10016 LDKGossipTimestampFilter this_ptr_conv;
10017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10018 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10019 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10020 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
10024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10025 LDKGossipTimestampFilter this_ptr_conv;
10026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10027 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10028 LDKThirtyTwoBytes val_ref;
10029 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10030 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10031 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
10034 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10035 LDKGossipTimestampFilter this_ptr_conv;
10036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10037 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10038 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
10042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10043 LDKGossipTimestampFilter this_ptr_conv;
10044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10045 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10046 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
10049 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
10050 LDKGossipTimestampFilter this_ptr_conv;
10051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10052 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10053 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
10057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10058 LDKGossipTimestampFilter this_ptr_conv;
10059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10060 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10061 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
10064 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) {
10065 LDKThirtyTwoBytes chain_hash_arg_ref;
10066 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10067 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10068 LDKGossipTimestampFilter ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
10069 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10073 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
10074 FREE((void*)this_ptr);
10075 ErrorAction_free(this_ptr_conv);
10078 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10079 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
10080 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10081 *ret = ErrorAction_clone(orig_conv);
10085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10086 LDKLightningError this_ptr_conv;
10087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10088 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10089 LightningError_free(this_ptr_conv);
10092 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
10093 LDKLightningError this_ptr_conv;
10094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10095 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10096 LDKStr _str = LightningError_get_err(&this_ptr_conv);
10097 char* _buf = MALLOC(_str.len + 1, "str conv buf");
10098 memcpy(_buf, _str.chars, _str.len);
10099 _buf[_str.len] = 0;
10100 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
10105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10106 LDKLightningError this_ptr_conv;
10107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10109 LDKCVec_u8Z val_ref;
10110 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
10111 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
10112 LightningError_set_err(&this_ptr_conv, val_ref);
10113 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
10116 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
10117 LDKLightningError this_ptr_conv;
10118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10119 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10120 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10121 *ret = LightningError_get_action(&this_ptr_conv);
10125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10126 LDKLightningError this_ptr_conv;
10127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10128 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10129 LDKErrorAction val_conv = *(LDKErrorAction*)val;
10131 LightningError_set_action(&this_ptr_conv, val_conv);
10134 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
10135 LDKCVec_u8Z err_arg_ref;
10136 err_arg_ref.data = (*_env)->GetByteArrayElements (_env, err_arg, NULL);
10137 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
10138 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
10139 FREE((void*)action_arg);
10140 LDKLightningError ret = LightningError_new(err_arg_ref, action_arg_conv);
10141 (*_env)->ReleaseByteArrayElements(_env, err_arg, (int8_t*)err_arg_ref.data, 0);
10142 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10146 LDKCommitmentUpdate this_ptr_conv;
10147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10148 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10149 CommitmentUpdate_free(this_ptr_conv);
10152 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10153 LDKCommitmentUpdate orig_conv;
10154 orig_conv.inner = (void*)(orig & (~1));
10155 orig_conv.is_owned = (orig & 1) || (orig == 0);
10156 LDKCommitmentUpdate ret = CommitmentUpdate_clone(&orig_conv);
10157 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10161 LDKCommitmentUpdate this_ptr_conv;
10162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10163 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10164 LDKCVec_UpdateAddHTLCZ val_constr;
10165 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10166 if (val_constr.datalen > 0)
10167 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10169 val_constr.data = NULL;
10170 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10171 for (size_t p = 0; p < val_constr.datalen; p++) {
10172 long arr_conv_15 = val_vals[p];
10173 LDKUpdateAddHTLC arr_conv_15_conv;
10174 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10175 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10176 if (arr_conv_15_conv.inner != NULL)
10177 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10178 val_constr.data[p] = arr_conv_15_conv;
10180 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10181 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
10184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10185 LDKCommitmentUpdate this_ptr_conv;
10186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10187 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10188 LDKCVec_UpdateFulfillHTLCZ val_constr;
10189 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10190 if (val_constr.datalen > 0)
10191 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10193 val_constr.data = NULL;
10194 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10195 for (size_t t = 0; t < val_constr.datalen; t++) {
10196 long arr_conv_19 = val_vals[t];
10197 LDKUpdateFulfillHTLC arr_conv_19_conv;
10198 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10199 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10200 if (arr_conv_19_conv.inner != NULL)
10201 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10202 val_constr.data[t] = arr_conv_19_conv;
10204 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10205 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
10208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10209 LDKCommitmentUpdate this_ptr_conv;
10210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10211 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10212 LDKCVec_UpdateFailHTLCZ val_constr;
10213 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10214 if (val_constr.datalen > 0)
10215 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10217 val_constr.data = NULL;
10218 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10219 for (size_t q = 0; q < val_constr.datalen; q++) {
10220 long arr_conv_16 = val_vals[q];
10221 LDKUpdateFailHTLC arr_conv_16_conv;
10222 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10223 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10224 if (arr_conv_16_conv.inner != NULL)
10225 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
10226 val_constr.data[q] = arr_conv_16_conv;
10228 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10229 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
10232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10233 LDKCommitmentUpdate this_ptr_conv;
10234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10235 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10236 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
10237 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10238 if (val_constr.datalen > 0)
10239 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10241 val_constr.data = NULL;
10242 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10243 for (size_t z = 0; z < val_constr.datalen; z++) {
10244 long arr_conv_25 = val_vals[z];
10245 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
10246 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
10247 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
10248 if (arr_conv_25_conv.inner != NULL)
10249 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
10250 val_constr.data[z] = arr_conv_25_conv;
10252 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10253 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
10256 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
10257 LDKCommitmentUpdate this_ptr_conv;
10258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10259 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10260 LDKUpdateFee ret = CommitmentUpdate_get_update_fee(&this_ptr_conv);
10261 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10265 LDKCommitmentUpdate this_ptr_conv;
10266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10268 LDKUpdateFee val_conv;
10269 val_conv.inner = (void*)(val & (~1));
10270 val_conv.is_owned = (val & 1) || (val == 0);
10271 if (val_conv.inner != NULL)
10272 val_conv = UpdateFee_clone(&val_conv);
10273 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
10276 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
10277 LDKCommitmentUpdate this_ptr_conv;
10278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10279 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10280 LDKCommitmentSigned ret = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
10281 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10285 LDKCommitmentUpdate this_ptr_conv;
10286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10288 LDKCommitmentSigned val_conv;
10289 val_conv.inner = (void*)(val & (~1));
10290 val_conv.is_owned = (val & 1) || (val == 0);
10291 if (val_conv.inner != NULL)
10292 val_conv = CommitmentSigned_clone(&val_conv);
10293 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
10296 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) {
10297 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
10298 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
10299 if (update_add_htlcs_arg_constr.datalen > 0)
10300 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10302 update_add_htlcs_arg_constr.data = NULL;
10303 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
10304 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
10305 long arr_conv_15 = update_add_htlcs_arg_vals[p];
10306 LDKUpdateAddHTLC arr_conv_15_conv;
10307 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10308 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10309 if (arr_conv_15_conv.inner != NULL)
10310 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10311 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
10313 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
10314 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
10315 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
10316 if (update_fulfill_htlcs_arg_constr.datalen > 0)
10317 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10319 update_fulfill_htlcs_arg_constr.data = NULL;
10320 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
10321 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
10322 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
10323 LDKUpdateFulfillHTLC arr_conv_19_conv;
10324 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10325 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10326 if (arr_conv_19_conv.inner != NULL)
10327 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10328 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
10330 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
10331 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
10332 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
10333 if (update_fail_htlcs_arg_constr.datalen > 0)
10334 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10336 update_fail_htlcs_arg_constr.data = NULL;
10337 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
10338 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
10339 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
10340 LDKUpdateFailHTLC arr_conv_16_conv;
10341 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10342 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10343 if (arr_conv_16_conv.inner != NULL)
10344 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
10345 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
10347 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
10348 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
10349 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
10350 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
10351 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10353 update_fail_malformed_htlcs_arg_constr.data = NULL;
10354 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
10355 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
10356 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
10357 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
10358 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
10359 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
10360 if (arr_conv_25_conv.inner != NULL)
10361 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
10362 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
10364 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
10365 LDKUpdateFee update_fee_arg_conv;
10366 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
10367 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
10368 if (update_fee_arg_conv.inner != NULL)
10369 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
10370 LDKCommitmentSigned commitment_signed_arg_conv;
10371 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
10372 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
10373 if (commitment_signed_arg_conv.inner != NULL)
10374 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
10375 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);
10376 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10380 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
10381 FREE((void*)this_ptr);
10382 HTLCFailChannelUpdate_free(this_ptr_conv);
10385 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10386 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
10387 LDKHTLCFailChannelUpdate* ret = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
10388 *ret = HTLCFailChannelUpdate_clone(orig_conv);
10392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10393 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
10394 FREE((void*)this_ptr);
10395 ChannelMessageHandler_free(this_ptr_conv);
10398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10399 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
10400 FREE((void*)this_ptr);
10401 RoutingMessageHandler_free(this_ptr_conv);
10404 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
10405 LDKAcceptChannel obj_conv;
10406 obj_conv.inner = (void*)(obj & (~1));
10407 obj_conv.is_owned = (obj & 1) || (obj == 0);
10408 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
10409 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10410 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10414 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10415 LDKu8slice ser_ref;
10416 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10417 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10418 LDKAcceptChannel ret = AcceptChannel_read(ser_ref);
10419 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10420 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10423 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
10424 LDKAnnouncementSignatures obj_conv;
10425 obj_conv.inner = (void*)(obj & (~1));
10426 obj_conv.is_owned = (obj & 1) || (obj == 0);
10427 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
10428 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10429 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10433 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10434 LDKu8slice ser_ref;
10435 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10436 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10437 LDKAnnouncementSignatures ret = AnnouncementSignatures_read(ser_ref);
10438 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10439 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10442 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
10443 LDKChannelReestablish obj_conv;
10444 obj_conv.inner = (void*)(obj & (~1));
10445 obj_conv.is_owned = (obj & 1) || (obj == 0);
10446 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
10447 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10448 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10453 LDKu8slice ser_ref;
10454 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10455 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10456 LDKChannelReestablish ret = ChannelReestablish_read(ser_ref);
10457 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10458 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10461 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10462 LDKClosingSigned obj_conv;
10463 obj_conv.inner = (void*)(obj & (~1));
10464 obj_conv.is_owned = (obj & 1) || (obj == 0);
10465 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
10466 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10467 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10471 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10472 LDKu8slice ser_ref;
10473 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10474 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10475 LDKClosingSigned ret = ClosingSigned_read(ser_ref);
10476 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10477 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10480 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10481 LDKCommitmentSigned obj_conv;
10482 obj_conv.inner = (void*)(obj & (~1));
10483 obj_conv.is_owned = (obj & 1) || (obj == 0);
10484 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
10485 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10486 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10490 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10491 LDKu8slice ser_ref;
10492 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10493 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10494 LDKCommitmentSigned ret = CommitmentSigned_read(ser_ref);
10495 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10496 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10499 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
10500 LDKFundingCreated obj_conv;
10501 obj_conv.inner = (void*)(obj & (~1));
10502 obj_conv.is_owned = (obj & 1) || (obj == 0);
10503 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
10504 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10505 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10509 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10510 LDKu8slice ser_ref;
10511 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10512 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10513 LDKFundingCreated ret = FundingCreated_read(ser_ref);
10514 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10515 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10518 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10519 LDKFundingSigned obj_conv;
10520 obj_conv.inner = (void*)(obj & (~1));
10521 obj_conv.is_owned = (obj & 1) || (obj == 0);
10522 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
10523 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10524 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10528 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10529 LDKu8slice ser_ref;
10530 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10531 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10532 LDKFundingSigned ret = FundingSigned_read(ser_ref);
10533 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10534 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10537 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
10538 LDKFundingLocked obj_conv;
10539 obj_conv.inner = (void*)(obj & (~1));
10540 obj_conv.is_owned = (obj & 1) || (obj == 0);
10541 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
10542 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10543 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10547 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10548 LDKu8slice ser_ref;
10549 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10550 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10551 LDKFundingLocked ret = FundingLocked_read(ser_ref);
10552 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10553 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10556 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
10558 obj_conv.inner = (void*)(obj & (~1));
10559 obj_conv.is_owned = (obj & 1) || (obj == 0);
10560 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
10561 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10562 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10567 LDKu8slice ser_ref;
10568 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10569 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10570 LDKInit ret = Init_read(ser_ref);
10571 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10572 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10575 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
10576 LDKOpenChannel obj_conv;
10577 obj_conv.inner = (void*)(obj & (~1));
10578 obj_conv.is_owned = (obj & 1) || (obj == 0);
10579 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
10580 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10581 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10585 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10586 LDKu8slice ser_ref;
10587 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10588 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10589 LDKOpenChannel ret = OpenChannel_read(ser_ref);
10590 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10591 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10594 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
10595 LDKRevokeAndACK obj_conv;
10596 obj_conv.inner = (void*)(obj & (~1));
10597 obj_conv.is_owned = (obj & 1) || (obj == 0);
10598 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
10599 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10600 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10604 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10605 LDKu8slice ser_ref;
10606 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10607 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10608 LDKRevokeAndACK ret = RevokeAndACK_read(ser_ref);
10609 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10610 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10613 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
10614 LDKShutdown obj_conv;
10615 obj_conv.inner = (void*)(obj & (~1));
10616 obj_conv.is_owned = (obj & 1) || (obj == 0);
10617 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
10618 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10619 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10623 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10624 LDKu8slice ser_ref;
10625 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10626 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10627 LDKShutdown ret = Shutdown_read(ser_ref);
10628 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10629 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10632 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10633 LDKUpdateFailHTLC obj_conv;
10634 obj_conv.inner = (void*)(obj & (~1));
10635 obj_conv.is_owned = (obj & 1) || (obj == 0);
10636 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
10637 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10638 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10642 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10643 LDKu8slice ser_ref;
10644 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10645 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10646 LDKUpdateFailHTLC ret = UpdateFailHTLC_read(ser_ref);
10647 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10648 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10651 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10652 LDKUpdateFailMalformedHTLC obj_conv;
10653 obj_conv.inner = (void*)(obj & (~1));
10654 obj_conv.is_owned = (obj & 1) || (obj == 0);
10655 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
10656 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10657 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10661 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_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 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_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_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
10671 LDKUpdateFee obj_conv;
10672 obj_conv.inner = (void*)(obj & (~1));
10673 obj_conv.is_owned = (obj & 1) || (obj == 0);
10674 LDKCVec_u8Z arg_var = UpdateFee_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);
10680 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10681 LDKu8slice ser_ref;
10682 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10683 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10684 LDKUpdateFee ret = UpdateFee_read(ser_ref);
10685 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10686 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10689 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10690 LDKUpdateFulfillHTLC obj_conv;
10691 obj_conv.inner = (void*)(obj & (~1));
10692 obj_conv.is_owned = (obj & 1) || (obj == 0);
10693 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
10694 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10695 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10699 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10700 LDKu8slice ser_ref;
10701 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10702 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10703 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_read(ser_ref);
10704 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10705 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10708 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10709 LDKUpdateAddHTLC obj_conv;
10710 obj_conv.inner = (void*)(obj & (~1));
10711 obj_conv.is_owned = (obj & 1) || (obj == 0);
10712 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
10713 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10714 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10718 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10719 LDKu8slice ser_ref;
10720 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10721 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10722 LDKUpdateAddHTLC ret = UpdateAddHTLC_read(ser_ref);
10723 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10724 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10727 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
10729 obj_conv.inner = (void*)(obj & (~1));
10730 obj_conv.is_owned = (obj & 1) || (obj == 0);
10731 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
10732 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10733 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10737 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10738 LDKu8slice ser_ref;
10739 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10740 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10741 LDKPing ret = Ping_read(ser_ref);
10742 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10743 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10746 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
10748 obj_conv.inner = (void*)(obj & (~1));
10749 obj_conv.is_owned = (obj & 1) || (obj == 0);
10750 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
10751 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10752 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10756 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10757 LDKu8slice ser_ref;
10758 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10759 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10760 LDKPong ret = Pong_read(ser_ref);
10761 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10762 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10765 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10766 LDKUnsignedChannelAnnouncement obj_conv;
10767 obj_conv.inner = (void*)(obj & (~1));
10768 obj_conv.is_owned = (obj & 1) || (obj == 0);
10769 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
10770 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10771 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10775 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10776 LDKu8slice ser_ref;
10777 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10778 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10779 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_read(ser_ref);
10780 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10781 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10784 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10785 LDKChannelAnnouncement obj_conv;
10786 obj_conv.inner = (void*)(obj & (~1));
10787 obj_conv.is_owned = (obj & 1) || (obj == 0);
10788 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
10789 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10790 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10794 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10795 LDKu8slice ser_ref;
10796 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10797 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10798 LDKChannelAnnouncement ret = ChannelAnnouncement_read(ser_ref);
10799 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10800 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10803 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
10804 LDKUnsignedChannelUpdate obj_conv;
10805 obj_conv.inner = (void*)(obj & (~1));
10806 obj_conv.is_owned = (obj & 1) || (obj == 0);
10807 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
10808 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10809 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10813 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10814 LDKu8slice ser_ref;
10815 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10816 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10817 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_read(ser_ref);
10818 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10819 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10822 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
10823 LDKChannelUpdate obj_conv;
10824 obj_conv.inner = (void*)(obj & (~1));
10825 obj_conv.is_owned = (obj & 1) || (obj == 0);
10826 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
10827 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10828 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10832 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10833 LDKu8slice ser_ref;
10834 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10835 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10836 LDKChannelUpdate ret = ChannelUpdate_read(ser_ref);
10837 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10838 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10841 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
10842 LDKErrorMessage obj_conv;
10843 obj_conv.inner = (void*)(obj & (~1));
10844 obj_conv.is_owned = (obj & 1) || (obj == 0);
10845 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
10846 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10847 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10851 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10852 LDKu8slice ser_ref;
10853 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10854 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10855 LDKErrorMessage ret = ErrorMessage_read(ser_ref);
10856 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10857 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10860 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10861 LDKUnsignedNodeAnnouncement obj_conv;
10862 obj_conv.inner = (void*)(obj & (~1));
10863 obj_conv.is_owned = (obj & 1) || (obj == 0);
10864 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
10865 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10866 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10870 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10871 LDKu8slice ser_ref;
10872 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10873 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10874 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_read(ser_ref);
10875 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10876 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10879 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10880 LDKNodeAnnouncement obj_conv;
10881 obj_conv.inner = (void*)(obj & (~1));
10882 obj_conv.is_owned = (obj & 1) || (obj == 0);
10883 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
10884 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10885 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10889 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10890 LDKu8slice ser_ref;
10891 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10892 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10893 LDKNodeAnnouncement ret = NodeAnnouncement_read(ser_ref);
10894 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10895 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10898 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10899 LDKu8slice ser_ref;
10900 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10901 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10902 LDKQueryShortChannelIds ret = QueryShortChannelIds_read(ser_ref);
10903 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10904 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10907 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
10908 LDKQueryShortChannelIds obj_conv;
10909 obj_conv.inner = (void*)(obj & (~1));
10910 obj_conv.is_owned = (obj & 1) || (obj == 0);
10911 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
10912 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10913 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10917 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10918 LDKu8slice ser_ref;
10919 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10920 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10921 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_read(ser_ref);
10922 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10923 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10926 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
10927 LDKReplyShortChannelIdsEnd obj_conv;
10928 obj_conv.inner = (void*)(obj & (~1));
10929 obj_conv.is_owned = (obj & 1) || (obj == 0);
10930 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
10931 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10932 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10936 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10937 LDKu8slice ser_ref;
10938 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10939 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10940 LDKQueryChannelRange ret = QueryChannelRange_read(ser_ref);
10941 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10942 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10945 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
10946 LDKQueryChannelRange obj_conv;
10947 obj_conv.inner = (void*)(obj & (~1));
10948 obj_conv.is_owned = (obj & 1) || (obj == 0);
10949 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
10950 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10951 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10955 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10956 LDKu8slice ser_ref;
10957 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10958 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10959 LDKReplyChannelRange ret = ReplyChannelRange_read(ser_ref);
10960 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10961 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10964 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
10965 LDKReplyChannelRange obj_conv;
10966 obj_conv.inner = (void*)(obj & (~1));
10967 obj_conv.is_owned = (obj & 1) || (obj == 0);
10968 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
10969 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10970 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10974 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10975 LDKu8slice ser_ref;
10976 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10977 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10978 LDKGossipTimestampFilter ret = GossipTimestampFilter_read(ser_ref);
10979 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10980 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10983 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
10984 LDKGossipTimestampFilter obj_conv;
10985 obj_conv.inner = (void*)(obj & (~1));
10986 obj_conv.is_owned = (obj & 1) || (obj == 0);
10987 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
10988 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10989 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10994 LDKMessageHandler this_ptr_conv;
10995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10996 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10997 MessageHandler_free(this_ptr_conv);
11000 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
11001 LDKMessageHandler this_ptr_conv;
11002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11003 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11004 long ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
11008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11009 LDKMessageHandler this_ptr_conv;
11010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11011 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11012 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
11013 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
11014 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11015 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
11017 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
11020 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
11021 LDKMessageHandler this_ptr_conv;
11022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11023 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11024 long ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
11028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11029 LDKMessageHandler this_ptr_conv;
11030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11031 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11032 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
11033 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
11034 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11035 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
11037 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
11040 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
11041 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
11042 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
11043 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11044 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
11046 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
11047 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
11048 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11049 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
11051 LDKMessageHandler ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
11052 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11056 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
11057 FREE((void*)this_ptr);
11058 SocketDescriptor_free(this_ptr_conv);
11061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11062 LDKPeerHandleError this_ptr_conv;
11063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11064 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11065 PeerHandleError_free(this_ptr_conv);
11068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
11069 LDKPeerHandleError this_ptr_conv;
11070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11072 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
11076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11077 LDKPeerHandleError this_ptr_conv;
11078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11079 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11080 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
11083 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
11084 LDKPeerHandleError ret = PeerHandleError_new(no_connection_possible_arg);
11085 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11089 LDKPeerManager this_ptr_conv;
11090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11091 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11092 PeerManager_free(this_ptr_conv);
11095 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) {
11096 LDKMessageHandler message_handler_conv;
11097 message_handler_conv.inner = (void*)(message_handler & (~1));
11098 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
11099 // Warning: we may need a move here but can't clone!
11100 LDKSecretKey our_node_secret_ref;
11101 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
11102 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
11103 unsigned char ephemeral_random_data_arr[32];
11104 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
11105 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
11106 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
11107 LDKLogger logger_conv = *(LDKLogger*)logger;
11108 if (logger_conv.free == LDKLogger_JCalls_free) {
11109 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11110 LDKLogger_JCalls_clone(logger_conv.this_arg);
11112 LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
11113 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11116 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
11117 LDKPeerManager this_arg_conv;
11118 this_arg_conv.inner = (void*)(this_arg & (~1));
11119 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11120 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
11121 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, NULL, NULL);
11122 for (size_t i = 0; i < ret_var.datalen; i++) {
11123 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
11124 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
11125 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
11127 CVec_PublicKeyZ_free(ret_var);
11131 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) {
11132 LDKPeerManager this_arg_conv;
11133 this_arg_conv.inner = (void*)(this_arg & (~1));
11134 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11135 LDKPublicKey their_node_id_ref;
11136 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
11137 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11138 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
11139 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
11140 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11141 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
11143 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11144 *ret = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
11148 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
11149 LDKPeerManager this_arg_conv;
11150 this_arg_conv.inner = (void*)(this_arg & (~1));
11151 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11152 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
11153 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
11154 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11155 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
11157 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11158 *ret = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
11162 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
11163 LDKPeerManager this_arg_conv;
11164 this_arg_conv.inner = (void*)(this_arg & (~1));
11165 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11166 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
11167 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11168 *ret = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
11172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
11173 LDKPeerManager this_arg_conv;
11174 this_arg_conv.inner = (void*)(this_arg & (~1));
11175 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11176 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
11177 LDKu8slice data_ref;
11178 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
11179 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
11180 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11181 *ret = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
11182 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
11186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
11187 LDKPeerManager this_arg_conv;
11188 this_arg_conv.inner = (void*)(this_arg & (~1));
11189 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11190 PeerManager_process_events(&this_arg_conv);
11193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
11194 LDKPeerManager this_arg_conv;
11195 this_arg_conv.inner = (void*)(this_arg & (~1));
11196 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11197 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
11198 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
11201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
11202 LDKPeerManager this_arg_conv;
11203 this_arg_conv.inner = (void*)(this_arg & (~1));
11204 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11205 PeerManager_timer_tick_occured(&this_arg_conv);
11208 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
11209 unsigned char commitment_seed_arr[32];
11210 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
11211 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
11212 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
11213 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
11214 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
11218 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
11219 LDKPublicKey per_commitment_point_ref;
11220 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11221 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11222 unsigned char base_secret_arr[32];
11223 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
11224 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
11225 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
11226 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
11227 *ret = derive_private_key(per_commitment_point_ref, base_secret_ref);
11231 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
11232 LDKPublicKey per_commitment_point_ref;
11233 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11234 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11235 LDKPublicKey base_point_ref;
11236 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
11237 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
11238 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
11239 *ret = derive_public_key(per_commitment_point_ref, base_point_ref);
11243 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) {
11244 unsigned char per_commitment_secret_arr[32];
11245 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
11246 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
11247 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
11248 unsigned char countersignatory_revocation_base_secret_arr[32];
11249 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
11250 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
11251 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
11252 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
11253 *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
11257 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) {
11258 LDKPublicKey per_commitment_point_ref;
11259 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11260 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11261 LDKPublicKey countersignatory_revocation_base_point_ref;
11262 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
11263 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
11264 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
11265 *ret = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
11269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11270 LDKTxCreationKeys this_ptr_conv;
11271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11272 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11273 TxCreationKeys_free(this_ptr_conv);
11276 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11277 LDKTxCreationKeys orig_conv;
11278 orig_conv.inner = (void*)(orig & (~1));
11279 orig_conv.is_owned = (orig & 1) || (orig == 0);
11280 LDKTxCreationKeys ret = TxCreationKeys_clone(&orig_conv);
11281 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11284 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
11285 LDKTxCreationKeys this_ptr_conv;
11286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11288 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11289 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
11293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11294 LDKTxCreationKeys this_ptr_conv;
11295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11296 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11297 LDKPublicKey val_ref;
11298 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11299 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11300 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
11303 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11304 LDKTxCreationKeys this_ptr_conv;
11305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11306 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11307 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11308 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
11312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11313 LDKTxCreationKeys this_ptr_conv;
11314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11316 LDKPublicKey val_ref;
11317 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11318 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11319 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
11322 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11323 LDKTxCreationKeys this_ptr_conv;
11324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11325 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11326 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11327 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
11331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11332 LDKTxCreationKeys this_ptr_conv;
11333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11334 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11335 LDKPublicKey val_ref;
11336 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11337 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11338 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
11341 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11342 LDKTxCreationKeys this_ptr_conv;
11343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11344 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11345 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11346 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
11350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11351 LDKTxCreationKeys this_ptr_conv;
11352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11353 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11354 LDKPublicKey val_ref;
11355 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11356 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11357 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
11360 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11361 LDKTxCreationKeys this_ptr_conv;
11362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11363 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11364 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11365 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
11369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11370 LDKTxCreationKeys this_ptr_conv;
11371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11372 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11373 LDKPublicKey val_ref;
11374 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11375 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11376 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
11379 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) {
11380 LDKPublicKey per_commitment_point_arg_ref;
11381 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
11382 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
11383 LDKPublicKey revocation_key_arg_ref;
11384 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
11385 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
11386 LDKPublicKey broadcaster_htlc_key_arg_ref;
11387 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
11388 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
11389 LDKPublicKey countersignatory_htlc_key_arg_ref;
11390 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
11391 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
11392 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
11393 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
11394 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
11395 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);
11396 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11399 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
11400 LDKTxCreationKeys obj_conv;
11401 obj_conv.inner = (void*)(obj & (~1));
11402 obj_conv.is_owned = (obj & 1) || (obj == 0);
11403 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
11404 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11405 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11410 LDKu8slice ser_ref;
11411 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11412 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11413 LDKTxCreationKeys ret = TxCreationKeys_read(ser_ref);
11414 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11415 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11419 LDKPreCalculatedTxCreationKeys this_ptr_conv;
11420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11421 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11422 PreCalculatedTxCreationKeys_free(this_ptr_conv);
11425 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
11426 LDKTxCreationKeys keys_conv;
11427 keys_conv.inner = (void*)(keys & (~1));
11428 keys_conv.is_owned = (keys & 1) || (keys == 0);
11429 if (keys_conv.inner != NULL)
11430 keys_conv = TxCreationKeys_clone(&keys_conv);
11431 LDKPreCalculatedTxCreationKeys ret = PreCalculatedTxCreationKeys_new(keys_conv);
11432 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11435 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
11436 LDKPreCalculatedTxCreationKeys this_arg_conv;
11437 this_arg_conv.inner = (void*)(this_arg & (~1));
11438 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11439 LDKTxCreationKeys ret = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
11440 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11443 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
11444 LDKPreCalculatedTxCreationKeys this_arg_conv;
11445 this_arg_conv.inner = (void*)(this_arg & (~1));
11446 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11447 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11448 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
11452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11453 LDKChannelPublicKeys this_ptr_conv;
11454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11455 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11456 ChannelPublicKeys_free(this_ptr_conv);
11459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11460 LDKChannelPublicKeys orig_conv;
11461 orig_conv.inner = (void*)(orig & (~1));
11462 orig_conv.is_owned = (orig & 1) || (orig == 0);
11463 LDKChannelPublicKeys ret = ChannelPublicKeys_clone(&orig_conv);
11464 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11467 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
11468 LDKChannelPublicKeys this_ptr_conv;
11469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11471 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11472 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
11476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11477 LDKChannelPublicKeys this_ptr_conv;
11478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11479 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11480 LDKPublicKey val_ref;
11481 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11482 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11483 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
11486 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
11487 LDKChannelPublicKeys this_ptr_conv;
11488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11489 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11490 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11491 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
11495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11496 LDKChannelPublicKeys this_ptr_conv;
11497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11498 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11499 LDKPublicKey val_ref;
11500 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11501 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11502 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
11505 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(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_payment_point(&this_ptr_conv).compressed_form);
11514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(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_payment_point(&this_ptr_conv, val_ref);
11524 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_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_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
11533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_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_delayed_payment_basepoint(&this_ptr_conv, val_ref);
11543 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(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_htlc_basepoint(&this_ptr_conv).compressed_form);
11552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(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_htlc_basepoint(&this_ptr_conv, val_ref);
11562 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) {
11563 LDKPublicKey funding_pubkey_arg_ref;
11564 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
11565 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
11566 LDKPublicKey revocation_basepoint_arg_ref;
11567 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
11568 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
11569 LDKPublicKey payment_point_arg_ref;
11570 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
11571 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
11572 LDKPublicKey delayed_payment_basepoint_arg_ref;
11573 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
11574 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
11575 LDKPublicKey htlc_basepoint_arg_ref;
11576 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
11577 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
11578 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);
11579 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11582 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
11583 LDKChannelPublicKeys obj_conv;
11584 obj_conv.inner = (void*)(obj & (~1));
11585 obj_conv.is_owned = (obj & 1) || (obj == 0);
11586 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
11587 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11588 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11592 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11593 LDKu8slice ser_ref;
11594 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11595 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11596 LDKChannelPublicKeys ret = ChannelPublicKeys_read(ser_ref);
11597 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11598 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11601 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) {
11602 LDKPublicKey per_commitment_point_ref;
11603 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11604 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11605 LDKPublicKey broadcaster_delayed_payment_base_ref;
11606 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
11607 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
11608 LDKPublicKey broadcaster_htlc_base_ref;
11609 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
11610 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
11611 LDKPublicKey countersignatory_revocation_base_ref;
11612 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
11613 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
11614 LDKPublicKey countersignatory_htlc_base_ref;
11615 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
11616 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
11617 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
11618 *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);
11622 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) {
11623 LDKPublicKey revocation_key_ref;
11624 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
11625 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
11626 LDKPublicKey broadcaster_delayed_payment_key_ref;
11627 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
11628 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
11629 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
11630 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11631 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11636 LDKHTLCOutputInCommitment this_ptr_conv;
11637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11639 HTLCOutputInCommitment_free(this_ptr_conv);
11642 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11643 LDKHTLCOutputInCommitment orig_conv;
11644 orig_conv.inner = (void*)(orig & (~1));
11645 orig_conv.is_owned = (orig & 1) || (orig == 0);
11646 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_clone(&orig_conv);
11647 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
11651 LDKHTLCOutputInCommitment this_ptr_conv;
11652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11653 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11654 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
11658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11659 LDKHTLCOutputInCommitment this_ptr_conv;
11660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11661 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11662 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
11665 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11666 LDKHTLCOutputInCommitment this_ptr_conv;
11667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11668 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11669 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
11673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11674 LDKHTLCOutputInCommitment this_ptr_conv;
11675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11676 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11677 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
11680 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
11681 LDKHTLCOutputInCommitment this_ptr_conv;
11682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11683 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11684 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
11688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11689 LDKHTLCOutputInCommitment this_ptr_conv;
11690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11691 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11692 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
11695 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
11696 LDKHTLCOutputInCommitment this_ptr_conv;
11697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11699 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11700 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
11704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11705 LDKHTLCOutputInCommitment this_ptr_conv;
11706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11707 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11708 LDKThirtyTwoBytes val_ref;
11709 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11710 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11711 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
11714 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
11715 LDKHTLCOutputInCommitment obj_conv;
11716 obj_conv.inner = (void*)(obj & (~1));
11717 obj_conv.is_owned = (obj & 1) || (obj == 0);
11718 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
11719 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11720 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11724 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11725 LDKu8slice ser_ref;
11726 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11727 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11728 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_read(ser_ref);
11729 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11730 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11733 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
11734 LDKHTLCOutputInCommitment htlc_conv;
11735 htlc_conv.inner = (void*)(htlc & (~1));
11736 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
11737 LDKTxCreationKeys keys_conv;
11738 keys_conv.inner = (void*)(keys & (~1));
11739 keys_conv.is_owned = (keys & 1) || (keys == 0);
11740 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
11741 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11742 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11746 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
11747 LDKPublicKey broadcaster_ref;
11748 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
11749 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
11750 LDKPublicKey countersignatory_ref;
11751 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
11752 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
11753 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
11754 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11755 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11759 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) {
11760 unsigned char prev_hash_arr[32];
11761 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
11762 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
11763 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
11764 LDKHTLCOutputInCommitment htlc_conv;
11765 htlc_conv.inner = (void*)(htlc & (~1));
11766 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
11767 LDKPublicKey broadcaster_delayed_payment_key_ref;
11768 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
11769 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
11770 LDKPublicKey revocation_key_ref;
11771 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
11772 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
11773 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
11774 *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
11778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11779 LDKHolderCommitmentTransaction this_ptr_conv;
11780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11781 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11782 HolderCommitmentTransaction_free(this_ptr_conv);
11785 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11786 LDKHolderCommitmentTransaction orig_conv;
11787 orig_conv.inner = (void*)(orig & (~1));
11788 orig_conv.is_owned = (orig & 1) || (orig == 0);
11789 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_clone(&orig_conv);
11790 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11793 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
11794 LDKHolderCommitmentTransaction this_ptr_conv;
11795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11796 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11797 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
11798 *ret = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
11802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11803 LDKHolderCommitmentTransaction this_ptr_conv;
11804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11806 LDKTransaction val_conv = *(LDKTransaction*)val;
11808 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
11811 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
11812 LDKHolderCommitmentTransaction this_ptr_conv;
11813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11814 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11815 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
11816 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
11820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11821 LDKHolderCommitmentTransaction this_ptr_conv;
11822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11823 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11824 LDKSignature val_ref;
11825 CHECK((*_env)->GetArrayLength (_env, val) == 64);
11826 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
11827 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
11830 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
11831 LDKHolderCommitmentTransaction this_ptr_conv;
11832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11834 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
11838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11839 LDKHolderCommitmentTransaction this_ptr_conv;
11840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11841 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11842 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
11845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray 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 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_constr;
11850 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11851 if (val_constr.datalen > 0)
11852 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
11854 val_constr.data = NULL;
11855 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11856 for (size_t q = 0; q < val_constr.datalen; q++) {
11857 long arr_conv_42 = val_vals[q];
11858 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
11859 FREE((void*)arr_conv_42);
11860 val_constr.data[q] = arr_conv_42_conv;
11862 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11863 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_constr);
11866 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) {
11867 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
11868 FREE((void*)unsigned_tx);
11869 LDKSignature counterparty_sig_ref;
11870 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
11871 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
11872 LDKPublicKey holder_funding_key_ref;
11873 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
11874 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
11875 LDKPublicKey counterparty_funding_key_ref;
11876 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
11877 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
11878 LDKTxCreationKeys keys_conv;
11879 keys_conv.inner = (void*)(keys & (~1));
11880 keys_conv.is_owned = (keys & 1) || (keys == 0);
11881 if (keys_conv.inner != NULL)
11882 keys_conv = TxCreationKeys_clone(&keys_conv);
11883 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_constr;
11884 htlc_data_constr.datalen = (*_env)->GetArrayLength (_env, htlc_data);
11885 if (htlc_data_constr.datalen > 0)
11886 htlc_data_constr.data = MALLOC(htlc_data_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
11888 htlc_data_constr.data = NULL;
11889 long* htlc_data_vals = (*_env)->GetLongArrayElements (_env, htlc_data, NULL);
11890 for (size_t q = 0; q < htlc_data_constr.datalen; q++) {
11891 long arr_conv_42 = htlc_data_vals[q];
11892 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
11893 FREE((void*)arr_conv_42);
11894 htlc_data_constr.data[q] = arr_conv_42_conv;
11896 (*_env)->ReleaseLongArrayElements (_env, htlc_data, htlc_data_vals, 0);
11897 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);
11898 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11901 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
11902 LDKHolderCommitmentTransaction this_arg_conv;
11903 this_arg_conv.inner = (void*)(this_arg & (~1));
11904 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11905 LDKTxCreationKeys ret = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
11906 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11909 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
11910 LDKHolderCommitmentTransaction this_arg_conv;
11911 this_arg_conv.inner = (void*)(this_arg & (~1));
11912 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11913 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
11914 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
11918 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) {
11919 LDKHolderCommitmentTransaction this_arg_conv;
11920 this_arg_conv.inner = (void*)(this_arg & (~1));
11921 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11922 unsigned char funding_key_arr[32];
11923 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
11924 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
11925 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
11926 LDKu8slice funding_redeemscript_ref;
11927 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
11928 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
11929 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
11930 (*_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);
11931 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
11935 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) {
11936 LDKHolderCommitmentTransaction this_arg_conv;
11937 this_arg_conv.inner = (void*)(this_arg & (~1));
11938 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11939 unsigned char htlc_base_key_arr[32];
11940 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
11941 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
11942 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
11943 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11944 *ret = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
11948 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
11949 LDKHolderCommitmentTransaction obj_conv;
11950 obj_conv.inner = (void*)(obj & (~1));
11951 obj_conv.is_owned = (obj & 1) || (obj == 0);
11952 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
11953 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11954 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11958 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11959 LDKu8slice ser_ref;
11960 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11961 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11962 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_read(ser_ref);
11963 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11964 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11968 LDKInitFeatures this_ptr_conv;
11969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11970 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11971 InitFeatures_free(this_ptr_conv);
11974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11975 LDKNodeFeatures this_ptr_conv;
11976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11977 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11978 NodeFeatures_free(this_ptr_conv);
11981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11982 LDKChannelFeatures this_ptr_conv;
11983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11984 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11985 ChannelFeatures_free(this_ptr_conv);
11988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11989 LDKRouteHop this_ptr_conv;
11990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11991 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11992 RouteHop_free(this_ptr_conv);
11995 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11996 LDKRouteHop orig_conv;
11997 orig_conv.inner = (void*)(orig & (~1));
11998 orig_conv.is_owned = (orig & 1) || (orig == 0);
11999 LDKRouteHop ret = RouteHop_clone(&orig_conv);
12000 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12003 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
12004 LDKRouteHop this_ptr_conv;
12005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12006 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12007 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12008 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
12012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12013 LDKRouteHop this_ptr_conv;
12014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12015 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12016 LDKPublicKey val_ref;
12017 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12018 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12019 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
12022 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12023 LDKRouteHop this_ptr_conv;
12024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12025 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12026 LDKNodeFeatures ret = RouteHop_get_node_features(&this_ptr_conv);
12027 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12031 LDKRouteHop this_ptr_conv;
12032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12034 LDKNodeFeatures val_conv;
12035 val_conv.inner = (void*)(val & (~1));
12036 val_conv.is_owned = (val & 1) || (val == 0);
12037 // Warning: we may need a move here but can't clone!
12038 RouteHop_set_node_features(&this_ptr_conv, val_conv);
12041 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12042 LDKRouteHop this_ptr_conv;
12043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12044 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12045 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
12049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12050 LDKRouteHop this_ptr_conv;
12051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12052 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12053 RouteHop_set_short_channel_id(&this_ptr_conv, val);
12056 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 LDKChannelFeatures ret = RouteHop_get_channel_features(&this_ptr_conv);
12061 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12065 LDKRouteHop this_ptr_conv;
12066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12067 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12068 LDKChannelFeatures val_conv;
12069 val_conv.inner = (void*)(val & (~1));
12070 val_conv.is_owned = (val & 1) || (val == 0);
12071 // Warning: we may need a move here but can't clone!
12072 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
12075 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12076 LDKRouteHop this_ptr_conv;
12077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12078 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12079 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
12083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12084 LDKRouteHop this_ptr_conv;
12085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12086 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12087 RouteHop_set_fee_msat(&this_ptr_conv, val);
12090 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
12091 LDKRouteHop this_ptr_conv;
12092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12094 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
12098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12099 LDKRouteHop this_ptr_conv;
12100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12101 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12102 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
12105 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) {
12106 LDKPublicKey pubkey_arg_ref;
12107 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
12108 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
12109 LDKNodeFeatures node_features_arg_conv;
12110 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
12111 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
12112 // Warning: we may need a move here but can't clone!
12113 LDKChannelFeatures channel_features_arg_conv;
12114 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
12115 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
12116 // Warning: we may need a move here but can't clone!
12117 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);
12118 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12122 LDKRoute this_ptr_conv;
12123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12124 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12125 Route_free(this_ptr_conv);
12128 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12129 LDKRoute orig_conv;
12130 orig_conv.inner = (void*)(orig & (~1));
12131 orig_conv.is_owned = (orig & 1) || (orig == 0);
12132 LDKRoute ret = Route_clone(&orig_conv);
12133 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
12137 LDKRoute this_ptr_conv;
12138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12139 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12140 LDKCVec_CVec_RouteHopZZ val_constr;
12141 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12142 if (val_constr.datalen > 0)
12143 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12145 val_constr.data = NULL;
12146 for (size_t m = 0; m < val_constr.datalen; m++) {
12147 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
12148 LDKCVec_RouteHopZ arr_conv_12_constr;
12149 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
12150 if (arr_conv_12_constr.datalen > 0)
12151 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12153 arr_conv_12_constr.data = NULL;
12154 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
12155 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
12156 long arr_conv_10 = arr_conv_12_vals[k];
12157 LDKRouteHop arr_conv_10_conv;
12158 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
12159 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
12160 if (arr_conv_10_conv.inner != NULL)
12161 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
12162 arr_conv_12_constr.data[k] = arr_conv_10_conv;
12164 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
12165 val_constr.data[m] = arr_conv_12_constr;
12167 Route_set_paths(&this_ptr_conv, val_constr);
12170 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
12171 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
12172 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
12173 if (paths_arg_constr.datalen > 0)
12174 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12176 paths_arg_constr.data = NULL;
12177 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
12178 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
12179 LDKCVec_RouteHopZ arr_conv_12_constr;
12180 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
12181 if (arr_conv_12_constr.datalen > 0)
12182 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12184 arr_conv_12_constr.data = NULL;
12185 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
12186 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
12187 long arr_conv_10 = arr_conv_12_vals[k];
12188 LDKRouteHop arr_conv_10_conv;
12189 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
12190 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
12191 if (arr_conv_10_conv.inner != NULL)
12192 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
12193 arr_conv_12_constr.data[k] = arr_conv_10_conv;
12195 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
12196 paths_arg_constr.data[m] = arr_conv_12_constr;
12198 LDKRoute ret = Route_new(paths_arg_constr);
12199 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12202 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
12204 obj_conv.inner = (void*)(obj & (~1));
12205 obj_conv.is_owned = (obj & 1) || (obj == 0);
12206 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
12207 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12208 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12212 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12213 LDKu8slice ser_ref;
12214 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12215 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12216 LDKRoute ret = Route_read(ser_ref);
12217 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12218 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12222 LDKRouteHint this_ptr_conv;
12223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12224 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12225 RouteHint_free(this_ptr_conv);
12228 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12229 LDKRouteHint orig_conv;
12230 orig_conv.inner = (void*)(orig & (~1));
12231 orig_conv.is_owned = (orig & 1) || (orig == 0);
12232 LDKRouteHint ret = RouteHint_clone(&orig_conv);
12233 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12236 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12237 LDKRouteHint this_ptr_conv;
12238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12239 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12240 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12241 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
12245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12246 LDKRouteHint this_ptr_conv;
12247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12248 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12249 LDKPublicKey val_ref;
12250 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12251 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12252 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
12255 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12256 LDKRouteHint this_ptr_conv;
12257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12258 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12259 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
12263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12264 LDKRouteHint this_ptr_conv;
12265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12266 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12267 RouteHint_set_short_channel_id(&this_ptr_conv, val);
12270 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
12271 LDKRouteHint this_ptr_conv;
12272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12273 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12274 LDKRoutingFees ret = RouteHint_get_fees(&this_ptr_conv);
12275 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12279 LDKRouteHint this_ptr_conv;
12280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12281 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12282 LDKRoutingFees val_conv;
12283 val_conv.inner = (void*)(val & (~1));
12284 val_conv.is_owned = (val & 1) || (val == 0);
12285 if (val_conv.inner != NULL)
12286 val_conv = RoutingFees_clone(&val_conv);
12287 RouteHint_set_fees(&this_ptr_conv, val_conv);
12290 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
12298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
12299 LDKRouteHint this_ptr_conv;
12300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12301 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12302 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
12305 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12306 LDKRouteHint this_ptr_conv;
12307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12308 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12309 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
12313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12314 LDKRouteHint this_ptr_conv;
12315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12316 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12317 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
12320 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) {
12321 LDKPublicKey src_node_id_arg_ref;
12322 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
12323 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
12324 LDKRoutingFees fees_arg_conv;
12325 fees_arg_conv.inner = (void*)(fees_arg & (~1));
12326 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
12327 if (fees_arg_conv.inner != NULL)
12328 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
12329 LDKRouteHint ret = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
12330 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12333 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) {
12334 LDKPublicKey our_node_id_ref;
12335 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
12336 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
12337 LDKNetworkGraph network_conv;
12338 network_conv.inner = (void*)(network & (~1));
12339 network_conv.is_owned = (network & 1) || (network == 0);
12340 LDKPublicKey target_ref;
12341 CHECK((*_env)->GetArrayLength (_env, target) == 33);
12342 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
12343 LDKCVec_ChannelDetailsZ first_hops_constr;
12344 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
12345 if (first_hops_constr.datalen > 0)
12346 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12348 first_hops_constr.data = NULL;
12349 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
12350 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
12351 long arr_conv_16 = first_hops_vals[q];
12352 LDKChannelDetails arr_conv_16_conv;
12353 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
12354 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
12355 first_hops_constr.data[q] = arr_conv_16_conv;
12357 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
12358 LDKCVec_RouteHintZ last_hops_constr;
12359 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
12360 if (last_hops_constr.datalen > 0)
12361 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12363 last_hops_constr.data = NULL;
12364 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
12365 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
12366 long arr_conv_11 = last_hops_vals[l];
12367 LDKRouteHint arr_conv_11_conv;
12368 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
12369 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
12370 if (arr_conv_11_conv.inner != NULL)
12371 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
12372 last_hops_constr.data[l] = arr_conv_11_conv;
12374 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
12375 LDKLogger logger_conv = *(LDKLogger*)logger;
12376 if (logger_conv.free == LDKLogger_JCalls_free) {
12377 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12378 LDKLogger_JCalls_clone(logger_conv.this_arg);
12380 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12381 *ret = get_route(our_node_id_ref, &network_conv, target_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
12382 FREE(first_hops_constr.data);
12386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12387 LDKNetworkGraph this_ptr_conv;
12388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12389 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12390 NetworkGraph_free(this_ptr_conv);
12393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12394 LDKLockedNetworkGraph this_ptr_conv;
12395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12396 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12397 LockedNetworkGraph_free(this_ptr_conv);
12400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12401 LDKNetGraphMsgHandler this_ptr_conv;
12402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12404 NetGraphMsgHandler_free(this_ptr_conv);
12407 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
12408 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
12409 LDKLogger logger_conv = *(LDKLogger*)logger;
12410 if (logger_conv.free == LDKLogger_JCalls_free) {
12411 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12412 LDKLogger_JCalls_clone(logger_conv.this_arg);
12414 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
12415 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12418 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
12419 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
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 LDKNetworkGraph network_graph_conv;
12426 network_graph_conv.inner = (void*)(network_graph & (~1));
12427 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
12428 // Warning: we may need a move here but can't clone!
12429 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
12430 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12433 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
12434 LDKNetGraphMsgHandler this_arg_conv;
12435 this_arg_conv.inner = (void*)(this_arg & (~1));
12436 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12437 LDKLockedNetworkGraph ret = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
12438 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12441 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
12442 LDKLockedNetworkGraph this_arg_conv;
12443 this_arg_conv.inner = (void*)(this_arg & (~1));
12444 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12445 LDKNetworkGraph ret = LockedNetworkGraph_graph(&this_arg_conv);
12446 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12449 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
12450 LDKNetGraphMsgHandler this_arg_conv;
12451 this_arg_conv.inner = (void*)(this_arg & (~1));
12452 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12453 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
12454 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
12458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12459 LDKDirectionalChannelInfo this_ptr_conv;
12460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12462 DirectionalChannelInfo_free(this_ptr_conv);
12465 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
12466 LDKDirectionalChannelInfo this_ptr_conv;
12467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12468 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12469 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
12473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12474 LDKDirectionalChannelInfo this_ptr_conv;
12475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12476 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12477 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
12480 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
12481 LDKDirectionalChannelInfo this_ptr_conv;
12482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12483 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12484 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
12488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12489 LDKDirectionalChannelInfo this_ptr_conv;
12490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12491 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12492 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
12495 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
12496 LDKDirectionalChannelInfo this_ptr_conv;
12497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12498 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12499 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
12503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
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_set_cltv_expiry_delta(&this_ptr_conv, val);
12510 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(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 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
12518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong 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_htlc_minimum_msat(&this_ptr_conv, val);
12525 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(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 LDKChannelUpdate ret = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
12530 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong 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 LDKChannelUpdate val_conv;
12538 val_conv.inner = (void*)(val & (~1));
12539 val_conv.is_owned = (val & 1) || (val == 0);
12540 if (val_conv.inner != NULL)
12541 val_conv = ChannelUpdate_clone(&val_conv);
12542 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
12545 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12546 LDKDirectionalChannelInfo obj_conv;
12547 obj_conv.inner = (void*)(obj & (~1));
12548 obj_conv.is_owned = (obj & 1) || (obj == 0);
12549 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
12550 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12551 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12555 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12556 LDKu8slice ser_ref;
12557 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12558 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12559 LDKDirectionalChannelInfo ret = DirectionalChannelInfo_read(ser_ref);
12560 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12561 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12565 LDKChannelInfo this_ptr_conv;
12566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12568 ChannelInfo_free(this_ptr_conv);
12571 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12572 LDKChannelInfo this_ptr_conv;
12573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12574 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12575 LDKChannelFeatures ret = ChannelInfo_get_features(&this_ptr_conv);
12576 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12580 LDKChannelInfo this_ptr_conv;
12581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12582 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12583 LDKChannelFeatures val_conv;
12584 val_conv.inner = (void*)(val & (~1));
12585 val_conv.is_owned = (val & 1) || (val == 0);
12586 // Warning: we may need a move here but can't clone!
12587 ChannelInfo_set_features(&this_ptr_conv, val_conv);
12590 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
12591 LDKChannelInfo this_ptr_conv;
12592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12593 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12594 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12595 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
12599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12600 LDKChannelInfo this_ptr_conv;
12601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12603 LDKPublicKey val_ref;
12604 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12605 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12606 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
12609 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
12610 LDKChannelInfo this_ptr_conv;
12611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12612 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12613 LDKDirectionalChannelInfo ret = ChannelInfo_get_one_to_two(&this_ptr_conv);
12614 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
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 LDKDirectionalChannelInfo val_conv;
12622 val_conv.inner = (void*)(val & (~1));
12623 val_conv.is_owned = (val & 1) || (val == 0);
12624 // Warning: we may need a move here but can't clone!
12625 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
12628 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
12629 LDKChannelInfo this_ptr_conv;
12630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12631 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12632 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12633 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
12637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12638 LDKChannelInfo this_ptr_conv;
12639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12640 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12641 LDKPublicKey val_ref;
12642 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12643 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12644 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
12647 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
12648 LDKChannelInfo this_ptr_conv;
12649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12650 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12651 LDKDirectionalChannelInfo ret = ChannelInfo_get_two_to_one(&this_ptr_conv);
12652 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
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 val_conv;
12660 val_conv.inner = (void*)(val & (~1));
12661 val_conv.is_owned = (val & 1) || (val == 0);
12662 // Warning: we may need a move here but can't clone!
12663 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
12666 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
12667 LDKChannelInfo this_ptr_conv;
12668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12670 LDKChannelAnnouncement ret = ChannelInfo_get_announcement_message(&this_ptr_conv);
12671 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
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 LDKChannelAnnouncement val_conv;
12679 val_conv.inner = (void*)(val & (~1));
12680 val_conv.is_owned = (val & 1) || (val == 0);
12681 if (val_conv.inner != NULL)
12682 val_conv = ChannelAnnouncement_clone(&val_conv);
12683 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
12686 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12687 LDKChannelInfo obj_conv;
12688 obj_conv.inner = (void*)(obj & (~1));
12689 obj_conv.is_owned = (obj & 1) || (obj == 0);
12690 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
12691 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12692 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12696 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12697 LDKu8slice ser_ref;
12698 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12699 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12700 LDKChannelInfo ret = ChannelInfo_read(ser_ref);
12701 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12702 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12706 LDKRoutingFees this_ptr_conv;
12707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12709 RoutingFees_free(this_ptr_conv);
12712 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12713 LDKRoutingFees orig_conv;
12714 orig_conv.inner = (void*)(orig & (~1));
12715 orig_conv.is_owned = (orig & 1) || (orig == 0);
12716 LDKRoutingFees ret = RoutingFees_clone(&orig_conv);
12717 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12720 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12721 LDKRoutingFees 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 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
12728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12729 LDKRoutingFees this_ptr_conv;
12730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12731 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12732 RoutingFees_set_base_msat(&this_ptr_conv, val);
12735 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
12736 LDKRoutingFees this_ptr_conv;
12737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12739 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
12743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12744 LDKRoutingFees this_ptr_conv;
12745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12746 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12747 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
12750 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
12751 LDKRoutingFees ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
12752 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12755 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12756 LDKu8slice ser_ref;
12757 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12758 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12759 LDKRoutingFees ret = RoutingFees_read(ser_ref);
12760 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12761 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12764 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
12765 LDKRoutingFees obj_conv;
12766 obj_conv.inner = (void*)(obj & (~1));
12767 obj_conv.is_owned = (obj & 1) || (obj == 0);
12768 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
12769 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12770 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12775 LDKNodeAnnouncementInfo this_ptr_conv;
12776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12777 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12778 NodeAnnouncementInfo_free(this_ptr_conv);
12781 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12782 LDKNodeAnnouncementInfo this_ptr_conv;
12783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12784 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12785 LDKNodeFeatures ret = NodeAnnouncementInfo_get_features(&this_ptr_conv);
12786 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12790 LDKNodeAnnouncementInfo this_ptr_conv;
12791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12792 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12793 LDKNodeFeatures val_conv;
12794 val_conv.inner = (void*)(val & (~1));
12795 val_conv.is_owned = (val & 1) || (val == 0);
12796 // Warning: we may need a move here but can't clone!
12797 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
12800 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
12801 LDKNodeAnnouncementInfo this_ptr_conv;
12802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12803 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12804 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
12808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12809 LDKNodeAnnouncementInfo this_ptr_conv;
12810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12811 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12812 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
12815 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
12816 LDKNodeAnnouncementInfo this_ptr_conv;
12817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12818 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12819 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
12820 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
12824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12825 LDKNodeAnnouncementInfo this_ptr_conv;
12826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12827 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12828 LDKThreeBytes val_ref;
12829 CHECK((*_env)->GetArrayLength (_env, val) == 3);
12830 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
12831 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
12834 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
12835 LDKNodeAnnouncementInfo this_ptr_conv;
12836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12837 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12838 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12839 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
12843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12844 LDKNodeAnnouncementInfo this_ptr_conv;
12845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12846 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12847 LDKThirtyTwoBytes val_ref;
12848 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12849 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12850 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
12853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
12854 LDKNodeAnnouncementInfo this_ptr_conv;
12855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12856 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12857 LDKCVec_NetAddressZ val_constr;
12858 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12859 if (val_constr.datalen > 0)
12860 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12862 val_constr.data = NULL;
12863 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
12864 for (size_t m = 0; m < val_constr.datalen; m++) {
12865 long arr_conv_12 = val_vals[m];
12866 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
12867 FREE((void*)arr_conv_12);
12868 val_constr.data[m] = arr_conv_12_conv;
12870 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
12871 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
12874 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
12875 LDKNodeAnnouncementInfo this_ptr_conv;
12876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12877 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12878 LDKNodeAnnouncement ret = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
12879 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
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 LDKNodeAnnouncement val_conv;
12887 val_conv.inner = (void*)(val & (~1));
12888 val_conv.is_owned = (val & 1) || (val == 0);
12889 if (val_conv.inner != NULL)
12890 val_conv = NodeAnnouncement_clone(&val_conv);
12891 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
12894 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) {
12895 LDKNodeFeatures features_arg_conv;
12896 features_arg_conv.inner = (void*)(features_arg & (~1));
12897 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
12898 // Warning: we may need a move here but can't clone!
12899 LDKThreeBytes rgb_arg_ref;
12900 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
12901 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
12902 LDKThirtyTwoBytes alias_arg_ref;
12903 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
12904 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
12905 LDKCVec_NetAddressZ addresses_arg_constr;
12906 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
12907 if (addresses_arg_constr.datalen > 0)
12908 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12910 addresses_arg_constr.data = NULL;
12911 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
12912 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
12913 long arr_conv_12 = addresses_arg_vals[m];
12914 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
12915 FREE((void*)arr_conv_12);
12916 addresses_arg_constr.data[m] = arr_conv_12_conv;
12918 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
12919 LDKNodeAnnouncement announcement_message_arg_conv;
12920 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
12921 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
12922 if (announcement_message_arg_conv.inner != NULL)
12923 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
12924 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
12925 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12928 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12929 LDKNodeAnnouncementInfo obj_conv;
12930 obj_conv.inner = (void*)(obj & (~1));
12931 obj_conv.is_owned = (obj & 1) || (obj == 0);
12932 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
12933 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12934 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12938 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12939 LDKu8slice ser_ref;
12940 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12941 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12942 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_read(ser_ref);
12943 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12944 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12948 LDKNodeInfo this_ptr_conv;
12949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12950 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12951 NodeInfo_free(this_ptr_conv);
12954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
12955 LDKNodeInfo this_ptr_conv;
12956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12957 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12958 LDKCVec_u64Z val_constr;
12959 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12960 if (val_constr.datalen > 0)
12961 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
12963 val_constr.data = NULL;
12964 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
12965 for (size_t g = 0; g < val_constr.datalen; g++) {
12966 long arr_conv_6 = val_vals[g];
12967 val_constr.data[g] = arr_conv_6;
12969 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
12970 NodeInfo_set_channels(&this_ptr_conv, val_constr);
12973 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
12974 LDKNodeInfo this_ptr_conv;
12975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12976 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12977 LDKRoutingFees ret = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
12978 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12982 LDKNodeInfo this_ptr_conv;
12983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12984 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12985 LDKRoutingFees val_conv;
12986 val_conv.inner = (void*)(val & (~1));
12987 val_conv.is_owned = (val & 1) || (val == 0);
12988 if (val_conv.inner != NULL)
12989 val_conv = RoutingFees_clone(&val_conv);
12990 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
12993 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
12994 LDKNodeInfo this_ptr_conv;
12995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12996 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12997 LDKNodeAnnouncementInfo ret = NodeInfo_get_announcement_info(&this_ptr_conv);
12998 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13002 LDKNodeInfo this_ptr_conv;
13003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13004 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13005 LDKNodeAnnouncementInfo val_conv;
13006 val_conv.inner = (void*)(val & (~1));
13007 val_conv.is_owned = (val & 1) || (val == 0);
13008 // Warning: we may need a move here but can't clone!
13009 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
13012 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) {
13013 LDKCVec_u64Z channels_arg_constr;
13014 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
13015 if (channels_arg_constr.datalen > 0)
13016 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
13018 channels_arg_constr.data = NULL;
13019 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
13020 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
13021 long arr_conv_6 = channels_arg_vals[g];
13022 channels_arg_constr.data[g] = arr_conv_6;
13024 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
13025 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
13026 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
13027 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
13028 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
13029 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
13030 LDKNodeAnnouncementInfo announcement_info_arg_conv;
13031 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
13032 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
13033 // Warning: we may need a move here but can't clone!
13034 LDKNodeInfo ret = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
13035 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13038 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13039 LDKNodeInfo obj_conv;
13040 obj_conv.inner = (void*)(obj & (~1));
13041 obj_conv.is_owned = (obj & 1) || (obj == 0);
13042 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
13043 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13044 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13048 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13049 LDKu8slice ser_ref;
13050 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13051 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13052 LDKNodeInfo ret = NodeInfo_read(ser_ref);
13053 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13054 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13057 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
13058 LDKNetworkGraph obj_conv;
13059 obj_conv.inner = (void*)(obj & (~1));
13060 obj_conv.is_owned = (obj & 1) || (obj == 0);
13061 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
13062 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13063 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13067 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13068 LDKu8slice ser_ref;
13069 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13070 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13071 LDKNetworkGraph ret = NetworkGraph_read(ser_ref);
13072 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13073 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13076 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
13077 LDKNetworkGraph ret = NetworkGraph_new();
13078 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13081 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) {
13082 LDKNetworkGraph this_arg_conv;
13083 this_arg_conv.inner = (void*)(this_arg & (~1));
13084 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13085 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);